Bug 1313254 part 6 - [css-grid] A few comment tweaks. rs=dholbert
authorMats Palmgren <mats@mozilla.com>
Sat, 05 Nov 2016 02:57:08 +0100
changeset 321266 fb521e9bf8f8adc6631ea272669bb43999658b0b
parent 321265 255168adca1c8912fc1a6ce035369ff2d8d383d6
child 321267 1354f15ccab53581cd3d6ce25d625f2a8b09ff01
push id30920
push userphilringnalda@gmail.com
push dateSat, 05 Nov 2016 20:41:02 +0000
treeherdermozilla-central@c44c01dfd264 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1313254
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1313254 part 6 - [css-grid] A few comment tweaks. rs=dholbert
layout/generic/nsGridContainerFrame.cpp
--- a/layout/generic/nsGridContainerFrame.cpp
+++ b/layout/generic/nsGridContainerFrame.cpp
@@ -162,18 +162,18 @@ ResolvePercentSizeParts(const nsStyleCoo
     *aPercent = 0.0f;
   }
 }
 
 // Synthesize a baseline from a border box.  For an alphabetical baseline
 // this is the end edge of the border box.  For a central baseline it's
 // the center of the border box.
 // https://drafts.csswg.org/css-align-3/#synthesize-baselines
-// For a first-baseline the measure is from the border-box start edge and
-// for a last baseline the measure is from the border-box end edge.
+// For a 'first baseline' the measure is from the border-box start edge and
+// for a 'last baseline' the measure is from the border-box end edge.
 static nscoord
 SynthesizeBaselineFromBorderBox(BaselineSharingGroup aGroup,
                                 WritingMode aWM,
                                 nscoord aBorderBoxSize)
 {
   if (aGroup == BaselineSharingGroup::eFirst) {
     return aWM.IsAlphabeticalBaseline() ? aBorderBoxSize : aBorderBoxSize / 2;
   }
@@ -804,23 +804,23 @@ struct nsGridContainerFrame::GridArea
 
 struct nsGridContainerFrame::GridItemInfo
 {
   /**
    * Item state per axis.
    */
   enum StateBits : uint8_t {
     eIsFlexing =              0x1, // does the item span a flex track?
-    eFirstBaseline =          0x2, // participate in first-baseline alignment?
-    // ditto last baseline, mutually exclusive w. eFirstBaseline
+    eFirstBaseline =          0x2, // participate in 'first baseline' alignment?
+    // ditto 'last baseline', mutually exclusive w. eFirstBaseline
     eLastBaseline =           0x4,
     eIsBaselineAligned = eFirstBaseline | eLastBaseline,
     // One of e[Self|Content]Baseline is set when eIsBaselineAligned is true
-    eSelfBaseline =           0x8, // is it *-self:[last-]baseline alignment?
-    // Ditto *-content:[last-]baseline. Mutually exclusive w. eSelfBaseline.
+    eSelfBaseline =           0x8, // is it *-self:[last ]baseline alignment?
+    // Ditto *-content:[last ]baseline. Mutually exclusive w. eSelfBaseline.
     eContentBaseline =       0x10,
     eAllBaselineBits = eIsBaselineAligned | eSelfBaseline | eContentBaseline,
     // Clamp per https://drafts.csswg.org/css-grid/#min-size-auto
     eClampMarginBoxMinSize = 0x20,
   };
 
   explicit GridItemInfo(nsIFrame* aFrame,
                         const GridArea& aArea)
@@ -829,17 +829,17 @@ struct nsGridContainerFrame::GridItemInf
   {
     mState[eLogicalAxisBlock] = StateBits(0);
     mState[eLogicalAxisInline] = StateBits(0);
     mBaselineOffset[eLogicalAxisBlock] = nscoord(0);
     mBaselineOffset[eLogicalAxisInline] = nscoord(0);
   }
 
   /**
-   * If the item is [align|justify]-self:[last-]baseline aligned in the given
+   * If the item is [align|justify]-self:[last ]baseline aligned in the given
    * axis then set aBaselineOffset to the baseline offset and return aAlign.
    * Otherwise, return a fallback alignment.
    */
   uint8_t GetSelfBaseline(uint8_t aAlign, LogicalAxis aAxis,
                           nscoord* aBaselineOffset) const
   {
     MOZ_ASSERT(aAlign == NS_STYLE_ALIGN_BASELINE ||
                aAlign == NS_STYLE_ALIGN_LAST_BASELINE);
@@ -908,17 +908,17 @@ nsGridContainerFrame::GridItemInfo::Dump
     if (!state) {
       return;
     }
     printf("%s", aMsg);
     if (state & ItemState::eIsFlexing) {
       printf("flexing ");
     }
     if (state & ItemState::eFirstBaseline) {
-      printf("baseline %s-alignment ",
+      printf("first baseline %s-alignment ",
              (state & ItemState::eSelfBaseline) ? "self" : "content");
     }
     if (state & ItemState::eLastBaseline) {
       printf("last baseline %s-alignment ",
              (state & ItemState::eSelfBaseline) ? "self" : "content");
     }
     if (state & ItemState::eIsBaselineAligned) {
       printf("%.2fpx", NSAppUnitsToFloatPixels(mBaselineOffset[aAxis],
@@ -2049,17 +2049,17 @@ struct MOZ_STACK_CLASS nsGridContainerFr
     for (; !mIter.AtEnd(); mIter.Next()) {
       nsIFrame* child = *mIter;
       nsIFrame* childFirstInFlow = child->FirstInFlow();
       DebugOnly<size_t> len = mGridItems.Length();
       for (auto& itemInfo : mSharedGridData->mGridItems) {
         if (itemInfo.mFrame == childFirstInFlow) {
           auto item = mGridItems.AppendElement(GridItemInfo(child, itemInfo.mArea));
           // Copy the item's baseline data so that the item's last fragment can do
-          // last baseline alignment if necessary.
+          // 'last baseline' alignment if necessary.
           item->mState[0] |= itemInfo.mState[0] & ItemState::eAllBaselineBits;
           item->mState[1] |= itemInfo.mState[1] & ItemState::eAllBaselineBits;
           item->mBaselineOffset[0] = itemInfo.mBaselineOffset[0];
           item->mBaselineOffset[1] = itemInfo.mBaselineOffset[1];
           break;
         }
       }
       MOZ_ASSERT(mGridItems.Length() == len + 1, "can't find GridItemInfo");
@@ -4126,32 +4126,32 @@ nsGridContainerFrame::Tracks::Initialize
     auto childWM = child->GetWritingMode();
     const bool isOrthogonal = wm.IsOrthogonalTo(childWM);
     const bool isInlineAxis = mAxis == eLogicalAxisInline; // i.e. columns
     // XXX update the line below to include orthogonal grid/table boxes
     // XXX since they have baselines in both dimensions. And flexbox with
     // XXX reversed main/cross axis?
     const bool itemHasBaselineParallelToTrack = isInlineAxis == isOrthogonal;
     if (itemHasBaselineParallelToTrack) {
-      // [align|justify]-self:[last-]baseline.
+      // [align|justify]-self:[last ]baseline.
       auto selfAlignment = isOrthogonal ?
         child->StylePosition()->UsedJustifySelf(containerSC) :
         child->StylePosition()->UsedAlignSelf(containerSC);
       selfAlignment &= ~NS_STYLE_ALIGN_FLAG_BITS;
       if (selfAlignment == NS_STYLE_ALIGN_BASELINE) {
         state |= ItemState::eFirstBaseline | ItemState::eSelfBaseline;
         const GridArea& area = gridItem.mArea;
         baselineTrack = isInlineAxis ? area.mCols.mStart : area.mRows.mStart;
       } else if (selfAlignment == NS_STYLE_ALIGN_LAST_BASELINE) {
         state |= ItemState::eLastBaseline | ItemState::eSelfBaseline;
         const GridArea& area = gridItem.mArea;
         baselineTrack = (isInlineAxis ? area.mCols.mEnd : area.mRows.mEnd) - 1;
       }
 
-      // [align|justify]-content:[last-]baseline.
+      // [align|justify]-content:[last ]baseline.
       // https://drafts.csswg.org/css-align-3/#baseline-align-content
       // "[...] and its computed 'align-self' or 'justify-self' (whichever
       // affects its block axis) is 'stretch' or 'self-start' ('self-end').
       // For this purpose, the 'start', 'end', 'flex-start', and 'flex-end'
       // values of 'align-self' are treated as either 'self-start' or
       // 'self-end', whichever they end up equivalent to.
       auto alignContent = child->StylePosition()->mAlignContent;
       alignContent &= ~NS_STYLE_ALIGN_FLAG_BITS;
@@ -4261,17 +4261,17 @@ nsGridContainerFrame::Tracks::Initialize
         } else {
           state &= ~ItemState::eAllBaselineBits;
         }
       }
     }
     MOZ_ASSERT((state &
                 (ItemState::eFirstBaseline | ItemState::eLastBaseline)) !=
                (ItemState::eFirstBaseline | ItemState::eLastBaseline),
-               "baseline and last baseline bits are mutually exclusive");
+               "first/last baseline bits are mutually exclusive");
     MOZ_ASSERT((state &
                 (ItemState::eSelfBaseline | ItemState::eContentBaseline)) !=
                (ItemState::eSelfBaseline | ItemState::eContentBaseline),
                "*-self and *-content baseline bits are mutually exclusive");
     MOZ_ASSERT(!(state &
                  (ItemState::eFirstBaseline | ItemState::eLastBaseline)) ==
                !(state &
                  (ItemState::eSelfBaseline | ItemState::eContentBaseline)),
@@ -4855,28 +4855,28 @@ nsGridContainerFrame::Tracks::AlignJusti
         (alignment == NS_STYLE_ALIGN_SPACE_BETWEEN && mSizes.Length() == 1)) {
       auto fallback = ::GetAlignJustifyFallbackIfAny(valueAndFallback, aWM,
                                                      isAlign, &overflowSafe);
       if (fallback) {
         alignment = fallback;
       }
     }
     if (space == 0 || (space < 0 && overflowSafe)) {
-      // XXX check that this makes sense also for [last-]baseline (bug 1151204).
+      // XXX check that this makes sense also for [last ]baseline (bug 1151204).
       alignment = NS_STYLE_ALIGN_START;
     }
   }
 
   // Optimize the cases where we just need to set each track's position.
   nscoord pos = 0;
   bool distribute = true;
   switch (alignment) {
     case NS_STYLE_ALIGN_BASELINE:
     case NS_STYLE_ALIGN_LAST_BASELINE:
-      NS_WARNING("'NYI: baseline/last baseline' (bug 1151204)"); // XXX
+      NS_WARNING("NYI: 'first/last baseline' (bug 1151204)"); // XXX
       MOZ_FALLTHROUGH;
     case NS_STYLE_ALIGN_START:
       distribute = false;
       break;
     case NS_STYLE_ALIGN_END:
       pos = space;
       distribute = false;
       break;
@@ -5172,17 +5172,17 @@ nsGridContainerFrame::ReflowInFlowChild(
       cb.BStart(wm) = std::max(0, gridAreaBOffset);
       toFragmentainerEnd = aFragmentainer->mToFragmentainerEnd -
         aState.mFragBStart - cb.BStart(wm);
       toFragmentainerEnd = std::max(toFragmentainerEnd, 0);
     }
     cb += aContentArea.Origin(wm);
     aState.mRows.AlignBaselineSubtree(*aGridItemInfo);
     aState.mCols.AlignBaselineSubtree(*aGridItemInfo);
-    // Setup [align|justify]-content:[last-]baseline related frame properties.
+    // Setup [align|justify]-content:[last ]baseline related frame properties.
     // These are added to the padding in SizeComputationInput::InitOffsets.
     // (a negative value signals the value is for 'last baseline' and should be
     //  added to the (logical) end padding)
     typedef const FramePropertyDescriptor<SmallValueHolder<nscoord>>* Prop;
     auto SetProp = [aGridItemInfo, aChild] (LogicalAxis aGridAxis,
                                             Prop aProp) {
       auto state = aGridItemInfo->mState[aGridAxis];
       auto baselineAdjust = (state & ItemState::eContentBaseline) ?
@@ -6173,24 +6173,24 @@ nsGridContainerFrame::Reflow(nsPresConte
                        wm, sz, bp.IStart(wm),
                        bp.IEnd(wm), desiredSize.ISize(wm));
     CalculateBaselines(BaselineSet::eBoth, &gridReflowInput.mIter,
                        &gridReflowInput.mGridItems, gridReflowInput.mRows,
                        0, gridReflowInput.mRows.mSizes.Length(),
                        wm, sz, bp.BStart(wm),
                        bp.BEnd(wm), desiredSize.BSize(wm));
   } else {
-    // Only compute first-baseline if this fragment contains the first track.
+    // Only compute 'first baseline' if this fragment contains the first track.
     // XXXmats maybe remove this condition? bug 1306499
     BaselineSet baselines = BaselineSet::eNone;
     if (gridReflowInput.mStartRow == 0 &&
         gridReflowInput.mStartRow != gridReflowInput.mNextFragmentStartRow) {
       baselines = BaselineSet::eFirst;
     }
-    // Only compute last baseline if this fragment contains the last track.
+    // Only compute 'last baseline' if this fragment contains the last track.
     // XXXmats maybe remove this condition? bug 1306499
     uint32_t len = gridReflowInput.mRows.mSizes.Length();
     if (gridReflowInput.mStartRow != len &&
         gridReflowInput.mNextFragmentStartRow == len) {
       baselines = BaselineSet(baselines | BaselineSet::eLast);
     }
     Maybe<GridItemCSSOrderIterator> iter;
     Maybe<nsTArray<GridItemInfo>> gridItems;
@@ -6720,33 +6720,33 @@ nsGridContainerFrame::CalculateBaselines
     mBaseline[axis][BaselineSharingGroup::eFirst] =
       SynthesizeBaseline(gridOrderFirstItem,
                          axis,
                          BaselineSharingGroup::eFirst,
                          aCBPhysicalSize,
                          aCBSize,
                          aWM);
   } else {
-    // We have a first-baseline group in the start track in this fragment.
+    // We have a 'first baseline' group in the start track in this fragment.
     // Convert it from track to grid container border-box coordinates.
     MOZ_ASSERT(!aGridItems->IsEmpty());
     nscoord gapBeforeStartTrack = aFragmentStartTrack == 0 ?
       aTracks.GridLineEdge(aFragmentStartTrack, GridLineSide::eAfterGridGap) :
       nscoord(0); // no content gap at start of fragment
     mBaseline[axis][BaselineSharingGroup::eFirst] =
       aCBBorderPaddingStart + gapBeforeStartTrack + firstBaseline;
   }
 
   auto lastBaseline = aTracks.mBaseline[BaselineSharingGroup::eLast];
   if (!(aBaselineSet & BaselineSet::eLast)) {
     mBaseline[axis][BaselineSharingGroup::eLast] =
       ::SynthesizeBaselineFromBorderBox(BaselineSharingGroup::eLast, aWM,
                                         aCBSize);
   } else if (lastBaseline == NS_INTRINSIC_WIDTH_UNKNOWN) {
-    // For finding items for the last baseline we need to create a reverse
+    // For finding items for the 'last baseline' we need to create a reverse
     // iterator ('aIter' is the forward iterator from the GridReflowInput).
     using Iter = ReverseGridItemCSSOrderIterator;
     auto orderState = aIter->ItemsAreAlreadyInOrder() ?
       Iter::OrderState::eKnownOrdered : Iter::OrderState::eKnownUnordered;
     Iter iter(this, kPrincipalList, Iter::ChildFilter::eSkipPlaceholders,
               orderState);
     iter.SetGridItemCount(aGridItems->Length());
     FindItemInGridOrderResult gridOrderLastItem =
@@ -6757,17 +6757,17 @@ nsGridContainerFrame::CalculateBaselines
     mBaseline[axis][BaselineSharingGroup::eLast] =
       SynthesizeBaseline(gridOrderLastItem,
                          axis,
                          BaselineSharingGroup::eLast,
                          aCBPhysicalSize,
                          aCBSize,
                          aWM);
   } else {
-    // We have a last baseline group in the end track in this fragment.
+    // We have a 'last baseline' group in the end track in this fragment.
     // Convert it from track to grid container border-box coordinates.
     MOZ_ASSERT(!aGridItems->IsEmpty());
     auto borderBoxStartToEndOfEndTrack = aCBBorderPaddingStart +
       aTracks.GridLineEdge(aFirstExcludedTrack, GridLineSide::eBeforeGridGap) -
       aTracks.GridLineEdge(aFragmentStartTrack, GridLineSide::eBeforeGridGap);
     mBaseline[axis][BaselineSharingGroup::eLast] =
       (aCBSize - borderBoxStartToEndOfEndTrack) + lastBaseline;
   }