Bug 1204585 part 1 - [css-grid] Use the grid area's size when converting to physical coordinates for abs.pos. items. r=dholbert
authorMats Palmgren <mats@mozilla.com>
Tue, 15 Sep 2015 23:34:08 +0200
changeset 296999 a31775ecf4e27d31e7345943a992499c6c1d23fa
parent 296998 c8ca0ad7ecc45ecefebd9f90525ddf87764f9069
child 297000 c87dd24d11434d712161ade705a55fa910154e93
push id962
push userjlund@mozilla.com
push dateFri, 04 Dec 2015 23:28:54 +0000
treeherdermozilla-release@23a2d286e80f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1204585
milestone43.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 1204585 part 1 - [css-grid] Use the grid area's size when converting to physical coordinates for abs.pos. items. r=dholbert It's the item's grid area that forms the containing block rect, not the grid container.
layout/generic/nsGridContainerFrame.cpp
--- a/layout/generic/nsGridContainerFrame.cpp
+++ b/layout/generic/nsGridContainerFrame.cpp
@@ -2421,32 +2421,33 @@ nsGridContainerFrame::ReflowChildren(Gri
       LogicalMargin pad(aState.mReflowState->ComputedLogicalPadding());
       pad.ApplySkipSides(GetLogicalSkipSides(aState.mReflowState));
       // 'gridOrigin' is the origin of the grid (the start of the first track),
       // with respect to the grid container's padding-box (CB).
       const LogicalPoint gridOrigin(wm, pad.IStart(wm), pad.BStart(wm));
       const LogicalRect gridCB(wm, 0, 0,
                                aContentArea.ISize(wm) + pad.IStartEnd(wm),
                                aContentArea.BSize(wm) + pad.BStartEnd(wm));
+      const nsSize gridCBPhysicalSize = gridCB.Size(wm).GetPhysicalSize(wm);
       size_t i = 0;
       for (nsFrameList::Enumerator e(children); !e.AtEnd(); e.Next(), ++i) {
         nsIFrame* child = e.get();
         MOZ_ASSERT(i < mAbsPosItems.Length());
         MOZ_ASSERT(mAbsPosItems[i].mFrame == child);
         GridArea& area = mAbsPosItems[i].mArea;
         LogicalRect itemCB =
           ContainingBlockForAbsPos(aState, area, gridOrigin, gridCB);
         // nsAbsoluteContainingBlock::Reflow uses physical coordinates.
         nsRect* cb = static_cast<nsRect*>(child->Properties().Get(
                        GridItemContainingBlockRect()));
         if (!cb) {
           cb = new nsRect;
           child->Properties().Set(GridItemContainingBlockRect(), cb);
         }
-        *cb = itemCB.GetPhysicalRect(wm, containerSize);
+        *cb = itemCB.GetPhysicalRect(wm, gridCBPhysicalSize);
       }
       // This rect isn't used at all for layout so we use it to optimize
       // away the virtual GetType() call in the callee in most cases.
       // @see nsAbsoluteContainingBlock::Reflow
       nsRect dummyRect(0, 0, VERY_LIKELY_A_GRID_CONTAINER, 0);
       GetAbsoluteContainingBlock()->Reflow(this, pc, *aState.mReflowState,
                                            aStatus, dummyRect, true,
                                            true, true, // XXX could be optimized