Bug 1452225 - Rebuild the whole subdoc when the caret changes, but don't invalidate the nsDisplaySubdocument. r=miko

MozReview-Commit-ID: K0KLXTo4GG

--HG--
extra : rebase_source : 54fc03744cb9df58497ba843fb6786c4db98fb64
This commit is contained in:
Matt Woodrow 2018-04-13 15:32:48 +12:00
parent 405ab44135
commit e9a5b8eda1
3 changed files with 14 additions and 14 deletions

View File

@ -447,18 +447,6 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
}
if (aBuilder->IsRetainingDisplayList()) {
// The value of needsOwnLayer can change between builds without
// an invalidation recorded for this frame (like if the root
// scrollframe becomes active). If this happens,
// then we need to notify the builder so that merging can
// happen correctly.
if (!mPreviouslyNeededLayer ||
mPreviouslyNeededLayer.value() != needsOwnLayer) {
dirty = visible;
aBuilder->MarkCurrentFrameModifiedDuringBuilding();
}
mPreviouslyNeededLayer = Some(needsOwnLayer);
// Caret frame changed, rebuild the entire subdoc.
// We could just invalidate the old and new frame
// areas and save some work here. RetainedDisplayListBuilder
@ -466,7 +454,14 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// subdocs in advance.
if (mPreviousCaret != aBuilder->GetCaretFrame()) {
dirty = visible;
aBuilder->MarkCurrentFrameModifiedDuringBuilding();
aBuilder->RebuildAllItemsInCurrentSubtree();
// Mark the old caret frame as invalid so that we remove the
// old nsDisplayCaret. We don't mark the current frame as invalid
// since we want the nsDisplaySubdocument to retain it's place
// in the retained display list.
if (mPreviousCaret) {
aBuilder->MarkFrameModifiedDuringBuilding(mPreviousCaret);
}
}
mPreviousCaret = aBuilder->GetCaretFrame();
}

View File

@ -168,7 +168,6 @@ protected:
RefPtr<nsFrameLoader> mFrameLoader;
nsView* mOuterView;
nsView* mInnerView;
Maybe<bool> mPreviouslyNeededLayer;
bool mIsInline;
bool mPostedReflowCallback;
bool mDidCreateDoc;

View File

@ -1747,6 +1747,12 @@ public:
return false;
}
void RebuildAllItemsInCurrentSubtree()
{
mInInvalidSubtree = true;
mDirtyRect = mVisibleRect;
}
/**
* This is a convenience function to ease the transition until AGRs and ASRs
* are unified.