address dbaron review comment: Add/update FIXMEs about expected cross-axes in SingleLineCrossAxisPositionTracker::ComputeLineCrossSize and FlexItem::FlexItem
authorDaniel Holbert <dholbert@cs.stanford.edu>
Fri, 14 Sep 2012 16:30:06 -0700
changeset 1781 1a76d847bfc614c9a05cd1564952168b2c103128
parent 1780 732635b825f628fad68c681313bac337f1b9e337
child 1782 98bf1adb812acc2d6cd215ca43055575b12945f4
push id1456
push userdholbert@mozilla.com
push dateFri, 14 Sep 2012 23:31:18 +0000
address dbaron review comment: Add/update FIXMEs about expected cross-axes in SingleLineCrossAxisPositionTracker::ComputeLineCrossSize and FlexItem::FlexItem
flexbox-mainImpl.patch
--- a/flexbox-mainImpl.patch
+++ b/flexbox-mainImpl.patch
@@ -1,17 +1,17 @@
 # HG changeset patch
 # Parent 27a0fac79f9646b0ef05fcd7807feaaf99f64fb2
 # 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,2152 @@
+@@ -3,56 +3,2157 @@
  
  /* 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"
@@ -668,16 +668,19 @@ diff --git a/layout/generic/nsFlexContai
 +
 +  // If the flex item's inline axis is the same as the cross axis, then
 +  // 'align-self:baseline' is identical to 'flex-start'. If that's the case, we
 +  // just directly convert our align-self value here, so that we don't have to
 +  // handle this with special cases elsewhere.
 +  // Moreover: for the time being (until we support writing-modes),
 +  // all inline axes are horizontal -- so we can just check if the cross axis
 +  // is horizontal.
++  // FIXME: Once we support writing-mode (vertical text), this IsAxisHorizontal
++  // check won't be sufficient anymore -- we'll actually need to compare our
++  // inline axis vs. the cross axis.
 +  if (mAlignSelf == NS_STYLE_ALIGN_ITEMS_BASELINE &&
 +      IsAxisHorizontal(aAxisTracker.GetCrossAxis())) {
 +    mAlignSelf = NS_STYLE_ALIGN_ITEMS_FLEX_START;
 +  }
 +}
 +
 +uint32_t
 +FlexItem::GetNumAutoMarginsInAxis(AxisOrientationType aAxis) const
@@ -1447,21 +1450,23 @@ diff --git a/layout/generic/nsFlexContai
 +  nscoord largestOuterCrossSize = 0;
 +  for (uint32_t i = 0; i < aItems.Length(); ++i) {
 +    const FlexItem& curItem = aItems[i];
 +    nscoord curOuterCrossSize = curItem.GetCrossSize() +
 +      curItem.GetMarginBorderPaddingSizeInAxis(mAxis);
 +
 +    if (curItem.GetAlignSelf() == NS_STYLE_ALIGN_ITEMS_BASELINE &&
 +        curItem.GetNumAutoMarginsInAxis(mAxis) == 0) {
-+      // XXXdholbert Once we support multi-line with "wrap-reverse", that will
-+      // give us bottom-to-top cross axes.
++      // FIXME: Once we support multi-line flexbox with "wrap-reverse", that'll
++      // give us bottom-to-top cross axes. (But for now, we assume eAxis_TB.)
++      // FIXME: Once we support "writing-mode", we'll have to do baseline
++      // alignment in vertical flex containers here (w/ horizontal cross-axes).
 +      MOZ_ASSERT(mAxis == eAxis_TB,
 +                 "Only expecting to do baseline-alignment in horizontal "
-+                 "flex containers (with top-to-bottom cross axis)");
++                 "flex containers, with top-to-bottom cross axis");
 +
 +      // Find distance from our item's cross-start and cross-end margin-box
 +      // edges to its baseline.
 +      //
 +      // Here's a diagram of a flex-item that we might be doing this on.
 +      // "mmm" is the margin-box, "bbb" is the border-box. The bottom of
 +      // the text "BASE" is the baseline.
 +      //