Backout changeset ba840bf34511 (bug 539356) because of performance and correctness regressions

This commit is contained in:
Ehsan Akhgari 2012-07-03 20:20:24 -04:00
parent 881434cf7b
commit e18c7644cd
6 changed files with 16 additions and 69 deletions

View File

@ -1229,16 +1229,7 @@ public:
* root pres shell.
*/
virtual void DidPaint() = 0;
/**
* Ensures that the refresh driver is running, and schedules a view
* manager flush on the next tick.
*
* @param aFlags nsIFrame::PAINT_COMPOSITE_ONLY : No changes have
* been made that require a layer tree update, so only schedule a
* layer tree composite.
*/
virtual void ScheduleViewManagerFlush(PRUint32 aFlags = 0) = 0;
virtual void ScheduleViewManagerFlush() = 0;
virtual void ClearMouseCaptureOnView(nsIView* aView) = 0;
virtual bool IsVisible() = 0;
virtual void DispatchSynthMouseMove(nsGUIEvent *aEvent, bool aFlushOnHoverChange) = 0;

View File

@ -170,7 +170,6 @@
#include "sampler.h"
#include "Layers.h"
#include "LayerTreeInvalidation.h"
#include "nsAsyncDOMEvent.h"
#ifdef NS_FUNCTION_TIMER
@ -3375,14 +3374,11 @@ PresShell::GetRectVisibility(nsIFrame* aFrame,
}
void
PresShell::ScheduleViewManagerFlush(PRUint32 aFlags)
PresShell::ScheduleViewManagerFlush()
{
nsPresContext* presContext = GetPresContext();
if (presContext) {
presContext->RefreshDriver()->ScheduleViewManagerFlush();
if (!(aFlags & nsIFrame::PAINT_COMPOSITE_ONLY)) {
mPaintRequired = true;
}
}
if (mDocument) {
mDocument->SetNeedLayoutFlush();
@ -5242,7 +5238,7 @@ PresShell::Paint(nsIView* aViewToPaint,
// need to be updated. Do not try to do an empty transaction on
// a non-retained layer manager (like the BasicLayerManager that
// draws the window title bar on Mac), because a) it won't work
// and b) below we don't want to clear mPaintRequired,
// and b) below we don't want to clear NS_FRAME_UPDATE_LAYER_TREE,
// that will cause us to forget to update the real layer manager!
if (aType == PaintType_Composite) {
if (layerManager->HasShadowManager()) {
@ -5257,40 +5253,7 @@ PresShell::Paint(nsIView* aViewToPaint,
layerManager->BeginTransaction();
}
if (!mPaintRequired) {
NotifySubDocInvalidationFunc computeInvalidFunc =
presContext->MayHavePaintEventListenerInSubDocument() ? nsPresContext::NotifySubDocInvalidation : 0;
bool computeInvalidRect = computeInvalidFunc ||
(layerManager->GetBackendType() == LayerManager::LAYERS_BASIC);
nsAutoPtr<LayerProperties> props(computeInvalidRect ?
LayerProperties::CloneFrom(layerManager->GetRoot()) :
nsnull);
if (layerManager->EndEmptyTransaction()) {
nsIntRect invalid;
if (props) {
invalid = props->ComputeDifferences(layerManager->GetRoot(), computeInvalidFunc);
}
if (!invalid.IsEmpty()) {
if (props) {
nsRect rect(presContext->DevPixelsToAppUnits(invalid.x),
presContext->DevPixelsToAppUnits(invalid.y),
presContext->DevPixelsToAppUnits(invalid.width),
presContext->DevPixelsToAppUnits(invalid.height));
aViewToPaint->GetViewManager()->InvalidateViewNoSuppression(aViewToPaint, rect);
presContext->NotifyInvalidation(invalid, 0);
} else {
aViewToPaint->GetViewManager()->InvalidateView(aViewToPaint);
}
}
frame->UpdatePaintCountForPaintedPresShells();
presContext->NotifyDidPaintForSubtree();
return;
}
}
mPaintRequired = false;
frame->RemoveStateBits(NS_FRAME_UPDATE_LAYER_TREE);
} else {
layerManager->BeginTransaction();
}

View File

@ -199,7 +199,7 @@ public:
virtual bool ShouldIgnoreInvalidation();
virtual void WillPaint(bool aWillSendDidPaint);
virtual void DidPaint();
virtual void ScheduleViewManagerFlush(PRUint32 aFlags = 0);
virtual void ScheduleViewManagerFlush();
virtual void DispatchSynthMouseMove(nsGUIEvent *aEvent, bool aFlushOnHoverChange);
virtual void ClearMouseCaptureOnView(nsIView* aView);
virtual bool IsVisible();
@ -768,12 +768,6 @@ protected:
bool mNoDelayedMouseEvents : 1;
bool mNoDelayedKeyEvents : 1;
// False if calls to Paint with the retaining manager can be handled
// with an empty transaction, True if we require painting and a layer
// tree update.
bool mPaintRequired : 1;
// We've been disconnected from the document. We will refuse to paint the
// document until either our timer fires or all frames are constructed.
bool mIsDocumentGone : 1;

View File

@ -4651,7 +4651,7 @@ nsIFrame::IsInvalid()
}
void
nsIFrame::SchedulePaint(PRUint32 aFlags)
nsIFrame::SchedulePaint()
{
nsPresContext *pres = PresContext()->GetRootPresContext();
if (HasAnyStateBits(NS_FRAME_IN_POPUP) || !pres) {
@ -4662,7 +4662,7 @@ nsIFrame::SchedulePaint(PRUint32 aFlags)
}
pres = displayRoot->PresContext();
}
pres->PresShell()->ScheduleViewManagerFlush(aFlags);
pres->PresShell()->ScheduleViewManagerFlush();
}
Layer*
@ -4686,7 +4686,7 @@ nsIFrame::InvalidateLayer(PRUint32 aDisplayItemKey, const nsIntRect* aDamageRect
layer->SetInvalidRectToVisibleRegion();
}
SchedulePaint(PAINT_COMPOSITE_ONLY);
SchedulePaint();
return layer;
}

View File

@ -242,6 +242,12 @@ typedef PRUint64 nsFrameState;
// Frame's overflow area was clipped by the 'clip' property.
#define NS_FRAME_HAS_CLIP NS_FRAME_STATE_BIT(35)
// Frame is a display root and the retained layer tree needs to be updated
// at the next paint via display list construction.
// Only meaningful for display roots, so we don't really need a global state
// bit; we could free up this bit with a little extra complexity.
#define NS_FRAME_UPDATE_LAYER_TREE NS_FRAME_STATE_BIT(36)
// Frame can accept absolutely positioned children.
#define NS_FRAME_HAS_ABSPOS_CHILDREN NS_FRAME_STATE_BIT(37)
@ -2153,15 +2159,8 @@ public:
* The view manager flush will update the layer tree, repaint any
* invalid areas in the layer tree and schedule a layer tree
* composite operation to display the layer tree.
*
* @param aFlags PAINT_COMPOSITE_ONLY : No changes have been made
* that require a layer tree update, so only schedule a layer
* tree composite.
*/
enum {
PAINT_COMPOSITE_ONLY
};
void SchedulePaint(PRUint32 aFlags = 0);
void SchedulePaint();
/**
* Checks if the layer tree includes a dedicated layer for this

View File

@ -431,7 +431,7 @@ nsViewManager::PostPendingUpdate()
nsViewManager* rootVM = RootViewManager();
rootVM->mHasPendingWidgetGeometryChanges = true;
if (rootVM->mPresShell) {
rootVM->mPresShell->ScheduleViewManagerFlush(nsIFrame::PAINT_COMPOSITE_ONLY);
rootVM->mPresShell->ScheduleViewManagerFlush();
}
}