зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1364295. Simplify some code now that we don't create displayports during display list building. r=mstange
This commit is contained in:
Родитель
b6711be167
Коммит
3ca5249135
|
@ -3678,7 +3678,7 @@ nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame,
|
||||||
MOZ_ASSERT(rootScrollableFrame);
|
MOZ_ASSERT(rootScrollableFrame);
|
||||||
nsRect displayPortBase = aFrame->GetVisualOverflowRectRelativeToSelf();
|
nsRect displayPortBase = aFrame->GetVisualOverflowRectRelativeToSelf();
|
||||||
Unused << rootScrollableFrame->DecideScrollableLayer(&builder, &displayPortBase,
|
Unused << rootScrollableFrame->DecideScrollableLayer(&builder, &displayPortBase,
|
||||||
/* aAllowCreateDisplayPort = */ true);
|
/* aSetBase = */ true);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRegion visibleRegion;
|
nsRegion visibleRegion;
|
||||||
|
|
|
@ -3300,9 +3300,6 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// It's safe to get this value before the DecideScrollableLayer call below
|
|
||||||
// because that call cannot create a displayport for root scroll frames,
|
|
||||||
// and hence it cannot create an ignore scroll frame.
|
|
||||||
bool ignoringThisScrollFrame =
|
bool ignoringThisScrollFrame =
|
||||||
aBuilder->GetIgnoreScrollFrame() == mOuter || IsIgnoringViewportClipping();
|
aBuilder->GetIgnoreScrollFrame() == mOuter || IsIgnoringViewportClipping();
|
||||||
|
|
||||||
|
@ -3320,7 +3317,7 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||||
}
|
}
|
||||||
|
|
||||||
Unused << DecideScrollableLayer(aBuilder, &dirtyRect,
|
Unused << DecideScrollableLayer(aBuilder, &dirtyRect,
|
||||||
/* aAllowCreateDisplayPort = */ !mIsRoot);
|
/* aSetBase = */ !mIsRoot);
|
||||||
|
|
||||||
bool usingDisplayPort = aBuilder->IsPaintingToWindow() &&
|
bool usingDisplayPort = aBuilder->IsPaintingToWindow() &&
|
||||||
nsLayoutUtils::HasDisplayPort(mOuter->GetContent());
|
nsLayoutUtils::HasDisplayPort(mOuter->GetContent());
|
||||||
|
@ -3589,7 +3586,7 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||||
// It's too late to change the dirty rect so pass a copy.
|
// It's too late to change the dirty rect so pass a copy.
|
||||||
nsRect copyOfDirtyRect = dirtyRect;
|
nsRect copyOfDirtyRect = dirtyRect;
|
||||||
Unused << DecideScrollableLayer(aBuilder, ©OfDirtyRect,
|
Unused << DecideScrollableLayer(aBuilder, ©OfDirtyRect,
|
||||||
/* aAllowCreateDisplayPort = */ false);
|
/* aSetBase = */ false);
|
||||||
if (mWillBuildScrollableLayer) {
|
if (mWillBuildScrollableLayer) {
|
||||||
asrSetter.InsertScrollFrame(sf);
|
asrSetter.InsertScrollFrame(sf);
|
||||||
}
|
}
|
||||||
|
@ -3634,18 +3631,15 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||||
bool
|
bool
|
||||||
ScrollFrameHelper::DecideScrollableLayer(nsDisplayListBuilder* aBuilder,
|
ScrollFrameHelper::DecideScrollableLayer(nsDisplayListBuilder* aBuilder,
|
||||||
nsRect* aDirtyRect,
|
nsRect* aDirtyRect,
|
||||||
bool aAllowCreateDisplayPort)
|
bool aSetBase)
|
||||||
{
|
{
|
||||||
// Save and check if this changes so we can recompute the current agr.
|
// Save and check if this changes so we can recompute the current agr.
|
||||||
bool oldWillBuildScrollableLayer = mWillBuildScrollableLayer;
|
bool oldWillBuildScrollableLayer = mWillBuildScrollableLayer;
|
||||||
|
|
||||||
bool wasUsingDisplayPort = false;
|
|
||||||
bool usingDisplayPort = false;
|
|
||||||
nsIContent* content = mOuter->GetContent();
|
nsIContent* content = mOuter->GetContent();
|
||||||
|
bool usingDisplayPort = nsLayoutUtils::HasDisplayPort(content);
|
||||||
if (aBuilder->IsPaintingToWindow()) {
|
if (aBuilder->IsPaintingToWindow()) {
|
||||||
wasUsingDisplayPort = nsLayoutUtils::HasDisplayPort(content);
|
if (aSetBase) {
|
||||||
|
|
||||||
if (aAllowCreateDisplayPort) {
|
|
||||||
nsRect displayportBase = *aDirtyRect;
|
nsRect displayportBase = *aDirtyRect;
|
||||||
nsPresContext* pc = mOuter->PresContext();
|
nsPresContext* pc = mOuter->PresContext();
|
||||||
if (mIsRoot && (pc->IsRootContentDocument() || !pc->GetParentPresContext())) {
|
if (mIsRoot && (pc->IsRootContentDocument() || !pc->GetParentPresContext())) {
|
||||||
|
@ -3659,9 +3653,7 @@ ScrollFrameHelper::DecideScrollableLayer(nsDisplayListBuilder* aBuilder,
|
||||||
|
|
||||||
// Only restrict to the root composition bounds if necessary,
|
// Only restrict to the root composition bounds if necessary,
|
||||||
// as the required coordinate transformation is expensive.
|
// as the required coordinate transformation is expensive.
|
||||||
// Note that we call HasDisplayPort again instead of using
|
if (usingDisplayPort) {
|
||||||
// wasUsingDisplayPort because we might have just created a display port.
|
|
||||||
if (nsLayoutUtils::HasDisplayPort(content)) {
|
|
||||||
const nsPresContext* rootPresContext =
|
const nsPresContext* rootPresContext =
|
||||||
pc->GetToplevelContentDocumentPresContext();
|
pc->GetToplevelContentDocumentPresContext();
|
||||||
if (!rootPresContext) {
|
if (!rootPresContext) {
|
||||||
|
@ -3734,8 +3726,8 @@ ScrollFrameHelper::DecideScrollableLayer(nsDisplayListBuilder* aBuilder,
|
||||||
nsLayoutUtils::SetDisplayPortBase(mOuter->GetContent(), displayportBase);
|
nsLayoutUtils::SetDisplayPortBase(mOuter->GetContent(), displayportBase);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we don't have aAllowCreateDisplayPort == true then should have already
|
// If we don't have aSetBase == true then should have already
|
||||||
// been called with aAllowCreateDisplayPort == true which should have set a
|
// been called with aSetBase == true which should have set a
|
||||||
// displayport base.
|
// displayport base.
|
||||||
MOZ_ASSERT(content->GetProperty(nsGkAtoms::DisplayPortBase));
|
MOZ_ASSERT(content->GetProperty(nsGkAtoms::DisplayPortBase));
|
||||||
nsRect displayPort;
|
nsRect displayPort;
|
||||||
|
@ -3765,7 +3757,7 @@ ScrollFrameHelper::DecideScrollableLayer(nsDisplayListBuilder* aBuilder,
|
||||||
|
|
||||||
// The cached animated geometry root for the display builder is out of
|
// The cached animated geometry root for the display builder is out of
|
||||||
// date if we just introduced a new animated geometry root.
|
// date if we just introduced a new animated geometry root.
|
||||||
if ((oldWillBuildScrollableLayer != mWillBuildScrollableLayer) || (wasUsingDisplayPort != usingDisplayPort)) {
|
if (oldWillBuildScrollableLayer != mWillBuildScrollableLayer) {
|
||||||
aBuilder->RecomputeCurrentAnimatedGeometryRoot();
|
aBuilder->RecomputeCurrentAnimatedGeometryRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -410,7 +410,7 @@ public:
|
||||||
|
|
||||||
bool DecideScrollableLayer(nsDisplayListBuilder* aBuilder,
|
bool DecideScrollableLayer(nsDisplayListBuilder* aBuilder,
|
||||||
nsRect* aDirtyRect,
|
nsRect* aDirtyRect,
|
||||||
bool aAllowCreateDisplayPort);
|
bool aSetBase);
|
||||||
void NotifyApproximateFrameVisibilityUpdate(bool aIgnoreDisplayPort);
|
void NotifyApproximateFrameVisibilityUpdate(bool aIgnoreDisplayPort);
|
||||||
bool GetDisplayPortAtLastApproximateFrameVisibilityUpdate(nsRect* aDisplayPort);
|
bool GetDisplayPortAtLastApproximateFrameVisibilityUpdate(nsRect* aDisplayPort);
|
||||||
|
|
||||||
|
@ -948,8 +948,8 @@ public:
|
||||||
}
|
}
|
||||||
virtual bool DecideScrollableLayer(nsDisplayListBuilder* aBuilder,
|
virtual bool DecideScrollableLayer(nsDisplayListBuilder* aBuilder,
|
||||||
nsRect* aDirtyRect,
|
nsRect* aDirtyRect,
|
||||||
bool aAllowCreateDisplayPort) override {
|
bool aSetBase) override {
|
||||||
return mHelper.DecideScrollableLayer(aBuilder, aDirtyRect, aAllowCreateDisplayPort);
|
return mHelper.DecideScrollableLayer(aBuilder, aDirtyRect, aSetBase);
|
||||||
}
|
}
|
||||||
virtual void NotifyApproximateFrameVisibilityUpdate(bool aIgnoreDisplayPort) override {
|
virtual void NotifyApproximateFrameVisibilityUpdate(bool aIgnoreDisplayPort) override {
|
||||||
mHelper.NotifyApproximateFrameVisibilityUpdate(aIgnoreDisplayPort);
|
mHelper.NotifyApproximateFrameVisibilityUpdate(aIgnoreDisplayPort);
|
||||||
|
@ -1457,8 +1457,8 @@ public:
|
||||||
}
|
}
|
||||||
virtual bool DecideScrollableLayer(nsDisplayListBuilder* aBuilder,
|
virtual bool DecideScrollableLayer(nsDisplayListBuilder* aBuilder,
|
||||||
nsRect* aDirtyRect,
|
nsRect* aDirtyRect,
|
||||||
bool aAllowCreateDisplayPort) override {
|
bool aSetBase) override {
|
||||||
return mHelper.DecideScrollableLayer(aBuilder, aDirtyRect, aAllowCreateDisplayPort);
|
return mHelper.DecideScrollableLayer(aBuilder, aDirtyRect, aSetBase);
|
||||||
}
|
}
|
||||||
virtual void NotifyApproximateFrameVisibilityUpdate(bool aIgnoreDisplayPort) override {
|
virtual void NotifyApproximateFrameVisibilityUpdate(bool aIgnoreDisplayPort) override {
|
||||||
mHelper.NotifyApproximateFrameVisibilityUpdate(aIgnoreDisplayPort);
|
mHelper.NotifyApproximateFrameVisibilityUpdate(aIgnoreDisplayPort);
|
||||||
|
|
|
@ -442,13 +442,13 @@ public:
|
||||||
* return the result. It will also record this result on the scroll frame.
|
* return the result. It will also record this result on the scroll frame.
|
||||||
* Pass the dirty rect in aDirtyRect. On return it will be set to the
|
* Pass the dirty rect in aDirtyRect. On return it will be set to the
|
||||||
* displayport if there is one (ie the dirty rect that should be used).
|
* displayport if there is one (ie the dirty rect that should be used).
|
||||||
* This function may create a display port where one did not exist before if
|
* This function will set the display port base rect if aSetBase is true.
|
||||||
* aAllowCreateDisplayPort is true. It is only allowed to be false if there
|
* aSetBase is only allowed to be false if there has been a call with it
|
||||||
* has been a call with it set to true before on the same paint.
|
* set to true before on the same paint.
|
||||||
*/
|
*/
|
||||||
virtual bool DecideScrollableLayer(nsDisplayListBuilder* aBuilder,
|
virtual bool DecideScrollableLayer(nsDisplayListBuilder* aBuilder,
|
||||||
nsRect* aDirtyRect,
|
nsRect* aDirtyRect,
|
||||||
bool aAllowCreateDisplayPort) = 0;
|
bool aSetBase) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notification that this scroll frame is getting its frame visibility updated.
|
* Notification that this scroll frame is getting its frame visibility updated.
|
||||||
|
|
|
@ -404,7 +404,7 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||||
nsRect copyOfDirty = dirty;
|
nsRect copyOfDirty = dirty;
|
||||||
haveDisplayPort = rootScrollableFrame->DecideScrollableLayer(aBuilder,
|
haveDisplayPort = rootScrollableFrame->DecideScrollableLayer(aBuilder,
|
||||||
©OfDirty,
|
©OfDirty,
|
||||||
/* aAllowCreateDisplayPort = */ true);
|
/* aSetBase = */ true);
|
||||||
|
|
||||||
if (!gfxPrefs::LayoutUseContainersForRootFrames()) {
|
if (!gfxPrefs::LayoutUseContainersForRootFrames()) {
|
||||||
haveDisplayPort = false;
|
haveDisplayPort = false;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче