Bug 1298218 - Save and restore the combined clip for the "top layer". r=tnikkel

MozReview-Commit-ID: IRfB85gVyWB

--HG--
extra : rebase_source : 15cfdd7f2f09e3a3d09887ef9858f1e28b90c94f
This commit is contained in:
Markus Stange 2017-01-27 17:33:53 +01:00
Родитель 6efd7c73b1
Коммит 068d452b3e
3 изменённых файлов: 15 добавлений и 3 удалений

Просмотреть файл

@ -107,8 +107,15 @@ BuildDisplayListForTopLayerFrame(nsDisplayListBuilder* aBuilder,
savedOutOfFlowData = nsDisplayListBuilder::GetOutOfFlowData(aFrame);
if (savedOutOfFlowData) {
dirty = savedOutOfFlowData->mDirtyRect;
// This function is called after we've finished building display items for
// the root scroll frame. That means that the content clip from the root
// scroll frame is no longer on aBuilder. However, we need to make sure
// that the display items we build in this function have finite clipped
// bounds with respect to the root ASR, so we restore the *combined clip*
// that we saved earlier. The combined clip will include the clip from the
// root scroll frame.
clipState.SetClipChainForContainingBlockDescendants(
savedOutOfFlowData->mContainingBlockClipChain);
savedOutOfFlowData->mCombinedClipChain);
clipState.ClipContainingBlockDescendantsExtra(
dirty + aBuilder->ToReferenceFrame(aFrame), nullptr);
asrSetter.SetCurrentActiveScrolledRoot(

Просмотреть файл

@ -1051,8 +1051,9 @@ void nsDisplayListBuilder::MarkOutOfFlowFrameForDisplay(nsIFrame* aDirtyFrame,
// to objects on the stack, so we need to clone the chain.
const DisplayItemClipChain* clipChain =
CopyWholeChain(mClipState.GetClipChainForContainingBlockDescendants());
const DisplayItemClipChain* combinedClipChain = mClipState.GetCurrentCombinedClipChain(this);
const ActiveScrolledRoot* asr = mCurrentActiveScrolledRoot;
OutOfFlowDisplayData* data = new OutOfFlowDisplayData(clipChain, asr, dirty);
OutOfFlowDisplayData* data = new OutOfFlowDisplayData(clipChain, combinedClipChain, asr, dirty);
aFrame->Properties().Set(nsDisplayListBuilder::OutOfFlowDisplayDataProperty(), data);
MarkFrameForDisplay(aFrame, aDirtyFrame);
@ -1275,9 +1276,10 @@ nsDisplayListBuilder::MarkFramesForDisplayList(nsIFrame* aDirtyFrame,
const DisplayItemClipChain* clipChain =
CopyWholeChain(mClipState.GetClipChainForContainingBlockDescendants());
const DisplayItemClipChain* combinedClipChain = mClipState.GetCurrentCombinedClipChain(this);
const ActiveScrolledRoot* asr = mCurrentActiveScrolledRoot;
CurrentPresShellState()->mFixedBackgroundDisplayData.emplace(
clipChain, asr, aDirtyRect);
clipChain, combinedClipChain, asr, aDirtyRect);
}
}

Просмотреть файл

@ -1211,13 +1211,16 @@ public:
struct OutOfFlowDisplayData {
OutOfFlowDisplayData(const DisplayItemClipChain* aContainingBlockClipChain,
const DisplayItemClipChain* aCombinedClipChain,
const ActiveScrolledRoot* aContainingBlockActiveScrolledRoot,
const nsRect &aDirtyRect)
: mContainingBlockClipChain(aContainingBlockClipChain)
, mCombinedClipChain(aCombinedClipChain)
, mContainingBlockActiveScrolledRoot(aContainingBlockActiveScrolledRoot)
, mDirtyRect(aDirtyRect)
{}
const DisplayItemClipChain* mContainingBlockClipChain;
const DisplayItemClipChain* mCombinedClipChain; // only necessary for the special case of top layer
const ActiveScrolledRoot* mContainingBlockActiveScrolledRoot;
nsRect mDirtyRect;
};