mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 21:05:36 +00:00
Bug 598482 part 1 - Never force synchronous plugin geometry updates because it forces paints at bad times. r=roc
This commit is contained in:
parent
6254508462
commit
4aec0df173
@ -2615,35 +2615,6 @@ nsRootPresContext::UpdatePluginGeometry()
|
||||
DidApplyPluginGeometryUpdates();
|
||||
}
|
||||
|
||||
void
|
||||
nsRootPresContext::SynchronousPluginGeometryUpdate()
|
||||
{
|
||||
if (!mNeedsToUpdatePluginGeometry) {
|
||||
// Nothing to do
|
||||
return;
|
||||
}
|
||||
|
||||
// Force synchronous paint
|
||||
nsIPresShell* shell = GetPresShell();
|
||||
if (!shell)
|
||||
return;
|
||||
nsIFrame* rootFrame = shell->GetRootFrame();
|
||||
if (!rootFrame)
|
||||
return;
|
||||
nsCOMPtr<nsIWidget> widget = rootFrame->GetNearestWidget();
|
||||
if (!widget)
|
||||
return;
|
||||
// Force synchronous paint of a single pixel, just to force plugin
|
||||
// updates to be flushed. Doing plugin updates during paint is the best
|
||||
// way to ensure that plugin updates are in sync with our content.
|
||||
widget->Invalidate(nsIntRect(0,0,1,1), true);
|
||||
|
||||
// Update plugin geometry just in case that invalidate didn't work
|
||||
// (e.g. if none of the widget is visible, it might not have processed
|
||||
// a paint event). Normally this won't need to do anything.
|
||||
UpdatePluginGeometry();
|
||||
}
|
||||
|
||||
void
|
||||
nsRootPresContext::RequestUpdatePluginGeometry(nsIFrame* aFrame)
|
||||
{
|
||||
@ -2651,15 +2622,11 @@ nsRootPresContext::RequestUpdatePluginGeometry(nsIFrame* aFrame)
|
||||
return;
|
||||
|
||||
if (!mNeedsToUpdatePluginGeometry) {
|
||||
// We'll update the plugin geometry during the next paint in this
|
||||
// presContext (either from nsPresShell::WillPaint or from
|
||||
// nsPresShell::DidPaint, depending on the platform) or on the next
|
||||
// layout flush, whichever comes first.
|
||||
mNeedsToUpdatePluginGeometry = true;
|
||||
|
||||
// Dispatch a Gecko event to ensure plugin geometry gets updated
|
||||
// XXX this really should be done through the refresh driver, once
|
||||
// all painting happens in the refresh driver
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(this, &nsRootPresContext::SynchronousPluginGeometryUpdate);
|
||||
NS_DispatchToMainThread(event);
|
||||
|
||||
mUpdatePluginGeometryForFrame = aFrame;
|
||||
mUpdatePluginGeometryForFrame->PresContext()->
|
||||
SetContainsUpdatePluginGeometryFrame(true);
|
||||
|
@ -1269,14 +1269,6 @@ public:
|
||||
|
||||
virtual bool IsRoot() { return true; }
|
||||
|
||||
/**
|
||||
* This method is called off an event to force the plugin geometry to
|
||||
* be updated. First we try to paint, since updating plugin geometry
|
||||
* during paint is best for keeping plugins in sync with content.
|
||||
* But we also force geometry updates in case painting doesn't work.
|
||||
*/
|
||||
void SynchronousPluginGeometryUpdate();
|
||||
|
||||
/**
|
||||
* Call this after reflow and scrolling to ensure that the geometry
|
||||
* of any windowed plugins is updated. aFrame is the root of the
|
||||
|
Loading…
Reference in New Issue
Block a user