Bug 1107786 - part 3, [css-grid] Implement layout and painting per the CSS 'order' property for absolute positioned grid items. r=dholbert
authorMats Palmgren <mats@mozilla.com>
Thu, 26 Mar 2015 18:57:39 +0000
changeset 264824 c2c20dfa58f642b911acbb4bdb81fa08c879503d
parent 264823 33d6a3e888a8aa2e6ac5ee2635123cc0d4a40448
child 264825 fbbe7bf4392999f3817557d7ce83cf44d5638555
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1107786
milestone39.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 1107786 - part 3, [css-grid] Implement layout and painting per the CSS 'order' property for absolute positioned grid items. r=dholbert
layout/generic/nsGridContainerFrame.cpp
--- a/layout/generic/nsGridContainerFrame.cpp
+++ b/layout/generic/nsGridContainerFrame.cpp
@@ -1244,26 +1244,36 @@ nsGridContainerFrame::BuildDisplayList(n
                                        const nsRect&           aDirtyRect,
                                        const nsDisplayListSet& aLists)
 {
   DisplayBorderBackgroundOutline(aBuilder, aLists);
 
   // Our children are all grid-level boxes, which behave the same as
   // inline-blocks in painting, so their borders/backgrounds all go on
   // the BlockBorderBackgrounds list.
-  nsDisplayListSet childLists(aLists, aLists.BlockBorderBackgrounds());
+  // Also, we capture positioned descendants so we can sort them by
+  // CSS 'order'.
+  nsDisplayList positionedDescendants;
+  nsDisplayListSet childLists(aLists.BlockBorderBackgrounds(),
+                              aLists.BlockBorderBackgrounds(),
+                              aLists.Floats(),
+                              aLists.Content(),
+                              &positionedDescendants,
+                              aLists.Outlines());
   typedef GridItemCSSOrderIterator::OrderState OrderState;
   OrderState order = mIsNormalFlowInCSSOrder ? OrderState::eKnownOrdered
                                              : OrderState::eKnownUnordered;
   GridItemCSSOrderIterator iter(this, kPrincipalList, order);
   for (; !iter.AtEnd(); iter.Next()) {
     nsIFrame* child = *iter;
     BuildDisplayListForChild(aBuilder, child, aDirtyRect, childLists,
                              ::GetDisplayFlagsForGridItem(child));
   }
+  positionedDescendants.SortByCSSOrder(aBuilder);
+  aLists.PositionedDescendants()->AppendToTop(&positionedDescendants);
 }
 
 #ifdef DEBUG_FRAME_DUMP
 nsresult
 nsGridContainerFrame::GetFrameName(nsAString& aResult) const
 {
   return MakeFrameName(NS_LITERAL_STRING("GridContainer"), aResult);
 }