author | Mats Palmgren <mats@mozilla.com> |
Tue, 22 Dec 2015 23:03:16 +0100 | |
changeset 277424 | a296d149c69e229d6c633da0d2f91ec3d4e5f1de |
parent 277423 | 0937bbc778f348a0ad6e55cfca523688ee7667b3 |
child 277425 | 0f8a939a121316f73be4518cfe156827afd1df04 |
push id | 29822 |
push user | cbook@mozilla.com |
push date | Wed, 23 Dec 2015 11:00:24 +0000 |
treeherder | mozilla-central@35b211eaad1f [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | dholbert |
bugs | 1151243 |
milestone | 46.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
|
--- a/layout/generic/nsAbsoluteContainingBlock.cpp +++ b/layout/generic/nsAbsoluteContainingBlock.cpp @@ -113,26 +113,18 @@ nsAbsoluteContainingBlock::Reflow(nsCont const nsHTMLReflowState& aReflowState, nsReflowStatus& aReflowStatus, const nsRect& aContainingBlock, AbsPosReflowFlags aFlags, nsOverflowAreas* aOverflowAreas) { nsReflowStatus reflowStatus = NS_FRAME_COMPLETE; - bool reflowAll = aReflowState.ShouldReflowAllKids(); - - // The 'width' check below is an optimization to avoid the virtual GetType() - // call in most cases. 'aContainingBlock' isn't used for grid items, - // each item has its own CB on a frame property instead. - // @see nsGridContainerFrame::ReflowChildren - const bool isGrid = - aContainingBlock.width == nsGridContainerFrame::VERY_LIKELY_A_GRID_CONTAINER && - aDelegatingFrame->GetType() == nsGkAtoms::gridContainerFrame; - + const bool reflowAll = aReflowState.ShouldReflowAllKids(); + const bool isGrid = !!(aFlags & AbsPosReflowFlags::eIsGridContainerCB); nsIFrame* kidFrame; nsOverflowContinuationTracker tracker(aDelegatingFrame, true); for (kidFrame = mAbsoluteFrames.FirstChild(); kidFrame; kidFrame = kidFrame->GetNextSibling()) { bool kidNeedsReflow = reflowAll || NS_SUBTREE_DIRTY(kidFrame) || FrameDependsOnContainer(kidFrame, !!(aFlags & AbsPosReflowFlags::eCBWidthChanged), !!(aFlags & AbsPosReflowFlags::eCBHeightChanged)); if (kidNeedsReflow && !aPresContext->HasPendingInterrupt()) {
--- a/layout/generic/nsAbsoluteContainingBlock.h +++ b/layout/generic/nsAbsoluteContainingBlock.h @@ -65,20 +65,21 @@ public: ChildListID aListID, nsIFrame* aPrevFrame, nsFrameList& aFrameList); void RemoveFrame(nsIFrame* aDelegatingFrame, ChildListID aListID, nsIFrame* aOldFrame); enum class AbsPosReflowFlags { - eConstrainHeight = 0x1, - eCBWidthChanged = 0x2, - eCBHeightChanged = 0x4, + eConstrainHeight = 0x1, + eCBWidthChanged = 0x2, + eCBHeightChanged = 0x4, eCBWidthAndHeightChanged = eCBWidthChanged | eCBHeightChanged, + eIsGridContainerCB = 0x8, }; /** * Called by the delegating frame after it has done its reflow first. This * function will reflow any absolutely positioned child frames that need to * be reflowed, e.g., because the absolutely positioned child frame has * 'auto' for an offset, or a percentage based width or height. *
--- a/layout/generic/nsGridContainerFrame.cpp +++ b/layout/generic/nsGridContainerFrame.cpp @@ -3239,23 +3239,24 @@ nsGridContainerFrame::ReflowChildren(Gri nsRect* cb = static_cast<nsRect*>(child->Properties().Get( GridItemContainingBlockRect())); if (!cb) { cb = new nsRect; child->Properties().Set(GridItemContainingBlockRect(), cb); } *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); + // We pass a dummy rect as CB because each child has its own CB rect. + // The eIsGridContainerCB flag tells nsAbsoluteContainingBlock::Reflow to + // use those instead. + nsRect dummyRect; AbsPosReflowFlags flags = AbsPosReflowFlags::eCBWidthAndHeightChanged; // XXX could be optimized flags |= AbsPosReflowFlags::eConstrainHeight; + flags |= AbsPosReflowFlags::eIsGridContainerCB; GetAbsoluteContainingBlock()->Reflow(this, pc, *aState.mReflowState, aStatus, dummyRect, flags, &aDesiredSize.mOverflowAreas); } } } void
--- a/layout/generic/nsGridContainerFrame.h +++ b/layout/generic/nsGridContainerFrame.h @@ -81,19 +81,16 @@ public: }; nscoord mBase; nscoord mLimit; nscoord mPosition; // zero until we apply 'align/justify-content' StateBits mState; }; - // @see nsAbsoluteContainingBlock::Reflow about this magic number - static const nscoord VERY_LIKELY_A_GRID_CONTAINER = -123456789; - NS_DECLARE_FRAME_PROPERTY(GridItemContainingBlockRect, DeleteValue<nsRect>) NS_DECLARE_FRAME_PROPERTY(GridColTrackSizes, DeleteValue<nsTArray<nscoord>>) const nsTArray<nscoord>* GetComputedTemplateColumns() { return static_cast<nsTArray<nscoord>*>(Properties().Get(GridColTrackSizes())); }