mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 04:45:45 +00:00
Bug 642257. If there are no plugins in the display list skip a potentially expensive compute visibility pass with accurate visible regions to determine plugin geometry because it is not needed. r=roc
If there is a plugin in a background tab and a complex scene in a foreground tab the accurate visible regions can cause us to bog down, for no good reason.
This commit is contained in:
parent
a5b93cbcd8
commit
ca1ed04511
@ -448,7 +448,8 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame,
|
||||
mHasDisplayPort(false),
|
||||
mHasFixedItems(false),
|
||||
mIsInFixedPosition(false),
|
||||
mIsCompositingCheap(false)
|
||||
mIsCompositingCheap(false),
|
||||
mContainsPluginItem(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsDisplayListBuilder);
|
||||
PL_InitArenaPool(&mPool, "displayListArena", 1024,
|
||||
|
@ -582,6 +582,9 @@ public:
|
||||
return aItem == mGlassDisplayItem;
|
||||
}
|
||||
|
||||
void SetContainsPluginItem() { mContainsPluginItem = true; }
|
||||
bool ContainsPluginItem() { return mContainsPluginItem; }
|
||||
|
||||
private:
|
||||
void MarkOutOfFlowFrameForDisplay(nsIFrame* aDirtyFrame, nsIFrame* aFrame,
|
||||
const nsRect& aDirtyRect);
|
||||
@ -635,6 +638,7 @@ private:
|
||||
bool mHasFixedItems;
|
||||
bool mIsInFixedPosition;
|
||||
bool mIsCompositingCheap;
|
||||
bool mContainsPluginItem;
|
||||
};
|
||||
|
||||
class nsDisplayItem;
|
||||
|
@ -2544,20 +2544,19 @@ nsRootPresContext::ComputePluginGeometryUpdates(nsIFrame* aFrame,
|
||||
mRegisteredPlugins.EnumerateEntries(SetPluginHidden, aFrame);
|
||||
|
||||
nsIFrame* rootFrame = FrameManager()->GetRootFrame();
|
||||
if (!rootFrame) {
|
||||
return;
|
||||
}
|
||||
|
||||
aBuilder->SetForPluginGeometry();
|
||||
aBuilder->SetAccurateVisibleRegions();
|
||||
// Merging and flattening has already been done and we should not do it
|
||||
// again. nsDisplayScroll(Info)Layer doesn't support trying to flatten
|
||||
// again.
|
||||
aBuilder->SetAllowMergingAndFlattening(false);
|
||||
nsRegion region = rootFrame->GetVisualOverflowRectRelativeToSelf();
|
||||
// nsDisplayPlugin::ComputeVisibility will automatically set a non-hidden
|
||||
// widget configuration for the plugin, if it's visible.
|
||||
aList->ComputeVisibilityForRoot(aBuilder, ®ion);
|
||||
if (rootFrame && aBuilder->ContainsPluginItem()) {
|
||||
aBuilder->SetForPluginGeometry();
|
||||
aBuilder->SetAccurateVisibleRegions();
|
||||
// Merging and flattening has already been done and we should not do it
|
||||
// again. nsDisplayScroll(Info)Layer doesn't support trying to flatten
|
||||
// again.
|
||||
aBuilder->SetAllowMergingAndFlattening(false);
|
||||
nsRegion region = rootFrame->GetVisualOverflowRectRelativeToSelf();
|
||||
// nsDisplayPlugin::ComputeVisibility will automatically set a non-hidden
|
||||
// widget configuration for the plugin, if it's visible.
|
||||
aList->ComputeVisibilityForRoot(aBuilder, ®ion);
|
||||
}
|
||||
|
||||
InitApplyPluginGeometryTimer();
|
||||
}
|
||||
|
@ -299,6 +299,7 @@ public:
|
||||
: nsDisplayItem(aBuilder, aFrame)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsDisplayPlugin);
|
||||
aBuilder->SetContainsPluginItem();
|
||||
}
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
virtual ~nsDisplayPlugin() {
|
||||
|
Loading…
Reference in New Issue
Block a user