fix some straggling old terminology ('distribute'/'justify'/'start') and remove one needless use of float math in packing-space distribution
authorDaniel Holbert <dholbert@cs.stanford.edu>
Thu, 23 Aug 2012 12:52:08 -0700
changeset 1753 35152679b00a51736edcf4f5906fc191c76aa584
parent 1752 00e7575e8ab0a6c423db89f76a9eed29f29b78e9
child 1754 b5a83ad2e2e23babc292d2a3ae47dba76f4b0fbb
push id1431
push userdholbert@mozilla.com
push dateThu, 23 Aug 2012 19:52:10 +0000
fix some straggling old terminology ('distribute'/'justify'/'start') and remove one needless use of float math in packing-space distribution
flexbox-mainImpl.patch
--- a/flexbox-mainImpl.patch
+++ b/flexbox-mainImpl.patch
@@ -1,17 +1,17 @@
 # HG changeset patch
 # Parent 8775c5eae983afbb9a14204d80ded514a69c763d
 # User Daniel Holbert <dholbert@cs.stanford.edu>
 Bug 666041 patch 7: implementation of flex container class for CSS3 flexbox. r?dbaron
 
 diff --git a/layout/generic/nsFlexContainerFrame.cpp b/layout/generic/nsFlexContainerFrame.cpp
 --- a/layout/generic/nsFlexContainerFrame.cpp
 +++ b/layout/generic/nsFlexContainerFrame.cpp
-@@ -3,56 +3,2124 @@
+@@ -3,56 +3,2123 @@
  
  /* This Source Code is subject to the terms of the Mozilla Public License
   * version 2.0 (the "License"). You can obtain a copy of the License at
   * http://mozilla.org/MPL/2.0/. */
  
  /* rendering object for CSS display: -moz-flex */
  
  #include "nsFlexContainerFrame.h"
@@ -1323,34 +1323,33 @@ diff --git a/layout/generic/nsFlexContai
 +        mPosition += mPackingSpaceRemaining;
 +        break;
 +      case NS_STYLE_JUSTIFY_CONTENT_CENTER:
 +        // Half the packing space goes at the beginning
 +        mPosition += mPackingSpaceRemaining / 2;
 +        break;
 +      case NS_STYLE_JUSTIFY_CONTENT_SPACE_BETWEEN:
 +        MOZ_ASSERT(mPackingSpaceRemaining >= 0,
-+                   "negative packing space should make us use 'start' "
-+                   "instead of 'justify'");
++                   "negative packing space should make us use 'flex-start' "
++                   "instead of 'space-between'");
 +        // 1 packing space between each flex item, no packing space at ends.
 +        mNumPackingSpacesRemaining = aItems.Length() - 1;
 +        break;
 +      case NS_STYLE_JUSTIFY_CONTENT_SPACE_AROUND:
 +        MOZ_ASSERT(mPackingSpaceRemaining >= 0,
 +                   "negative packing space should make us use 'center' "
-+                   "instead of 'distribute'");
++                   "instead of 'space-around'");
 +        // 1 packing space between each flex item, plus half a packing space
 +        // at beginning & end.  So our number of full packing-spaces is equal
 +        // to the number of flex items.
 +        mNumPackingSpacesRemaining = aItems.Length();
 +        if (mNumPackingSpacesRemaining > 0) {
 +          // The edges (start/end) share one full packing space
 +          nscoord totalEdgePackingSpace =
-+            NSToCoordRound(float(mPackingSpaceRemaining) /
-+                           mNumPackingSpacesRemaining);
++            mPackingSpaceRemaining / mNumPackingSpacesRemaining;
 +
 +          // ...and we'll use half of that right now, at the start
 +          mPosition += totalEdgePackingSpace / 2;
 +          // ...but we need to subtract all of it right away, so that we won't
 +          // hand out any of it to intermediate packing spaces.
 +          mPackingSpaceRemaining -= totalEdgePackingSpace;
 +          mNumPackingSpacesRemaining--;
 +        }