Bug 1526972 - P8: Reset InInvalidSubtree when processing unrelated frames. r=mattwoodrow

Differential Revision: https://phabricator.services.mozilla.com/D26141

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Dan Glastonbury 2019-04-18 02:41:33 +00:00
Родитель 4c428d9c74
Коммит ea351adb8a
4 изменённых файлов: 45 добавлений и 4 удалений

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

@ -3746,6 +3746,9 @@ void ScrollFrameHelper::MaybeAddTopLayerItems(nsDisplayListBuilder* aBuilder,
nsDisplayList topLayerList;
viewportFrame->BuildDisplayListForTopLayer(aBuilder, &topLayerList);
if (!topLayerList.IsEmpty()) {
nsDisplayListBuilder::AutoBuildingDisplayList buildingDisplayList(
aBuilder, viewportFrame);
// Wrap the whole top layer in a single item with maximum z-index,
// and append it at the very end, so that it stays at the topmost.
nsDisplayWrapList* wrapList = MakeDisplayItem<nsDisplayWrapList>(

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

@ -214,8 +214,8 @@ void RetainedDisplayListBuilder::IncrementSubDocPresShellPaintCount(
}
bool AnyContentAncestorModified(nsIFrame* aFrame, nsIFrame* aStopAtFrame) {
for (nsIFrame* f = aFrame; f;
f = nsLayoutUtils::GetParentOrPlaceholderForCrossDoc(f)) {
nsIFrame* f = aFrame;
while (f) {
if (f->IsFrameModified()) {
return true;
}
@ -223,6 +223,12 @@ bool AnyContentAncestorModified(nsIFrame* aFrame, nsIFrame* aStopAtFrame) {
if (aStopAtFrame && f == aStopAtFrame) {
break;
}
if (f->GetStateBits() & NS_FRAME_IS_PUSHED_FLOAT) {
f = f->GetParent();
} else {
f = nsLayoutUtils::GetParentOrPlaceholderForCrossDoc(f);
}
}
return false;

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

@ -10290,6 +10290,25 @@ PaintTelemetry::AutoRecord::~AutoRecord() {
} // namespace mozilla
static nsIFrame* GetSelfOrPlaceholderFor(nsIFrame* aFrame) {
if (aFrame->GetStateBits() & NS_FRAME_IS_PUSHED_FLOAT) {
return aFrame;
}
if ((aFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) &&
!aFrame->GetPrevInFlow()) {
return aFrame->GetPlaceholderFrame();
}
return aFrame;
}
static nsIFrame* GetAncestorFor(nsIFrame* aFrame) {
nsIFrame* f = GetSelfOrPlaceholderFor(aFrame);
MOZ_ASSERT(f);
return nsLayoutUtils::GetCrossDocParentFrame(f);
}
nsDisplayListBuilder::AutoBuildingDisplayList::AutoBuildingDisplayList(
nsDisplayListBuilder* aBuilder, nsIFrame* aForChild,
const nsRect& aVisibleRect, const nsRect& aDirtyRect,
@ -10331,8 +10350,16 @@ nsDisplayListBuilder::AutoBuildingDisplayList::AutoBuildingDisplayList(
MOZ_ASSERT(nsLayoutUtils::IsAncestorFrameCrossDoc(
aBuilder->RootReferenceFrame(), *aBuilder->mCurrentAGR));
aBuilder->mInInvalidSubtree =
aBuilder->mInInvalidSubtree || aForChild->IsFrameModified();
// If aForChild is being visited from a frame other than it's ancestor frame,
// mInInvalidSubtree will need to be recalculated the slow way.
if (aForChild == mPrevFrame || GetAncestorFor(aForChild) == mPrevFrame) {
aBuilder->mInInvalidSubtree =
aBuilder->mInInvalidSubtree || aForChild->IsFrameModified();
} else {
aBuilder->mInInvalidSubtree = AnyContentAncestorModified(aForChild);
}
aBuilder->mCurrentFrame = aForChild;
aBuilder->mVisibleRect = aVisibleRect;
aBuilder->mDirtyRect =

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

@ -1132,6 +1132,11 @@ class nsDisplayListBuilder {
*/
class AutoBuildingDisplayList {
public:
AutoBuildingDisplayList(nsDisplayListBuilder* aBuilder, nsIFrame* aForChild)
: AutoBuildingDisplayList(
aBuilder, aForChild, aBuilder->GetVisibleRect(),
aBuilder->GetDirtyRect(), aForChild->IsTransformed()) {}
AutoBuildingDisplayList(nsDisplayListBuilder* aBuilder, nsIFrame* aForChild,
const nsRect& aVisibleRect,
const nsRect& aDirtyRect)