Bug 873944 - When we have OMTC, don't invalidate and wait for the widget paint event, just call DidPaint immediately. If we do get a widget paint event (from an OS initiated resize or similar), then block until the compositor has drawn the frame. r=roc

This commit is contained in:
Matt Woodrow 2013-06-18 19:59:29 +12:00
parent 5dcae950c4
commit 6d01a3cdf3
6 changed files with 37 additions and 13 deletions

View File

@ -475,6 +475,12 @@ public:
*/
virtual void FlushRendering() { }
/**
* Checks if we need to invalidate the OS widget to trigger
* painting when updating this layer manager.
*/
virtual bool NeedsWidgetInvalidation() { return true; }
// We always declare the following logging symbols, because it's
// extremely tricky to conditionally declare them. However, for
// ifndef MOZ_LAYERS_HAVE_LOG builds, they only have trivial

View File

@ -55,6 +55,8 @@ public:
virtual void FlushRendering() MOZ_OVERRIDE;
virtual bool NeedsWidgetInvalidation() MOZ_OVERRIDE { return Compositor::GetBackend() == LAYERS_BASIC; }
ShadowableLayer* Hold(Layer* aLayer);
bool HasShadowManager() const { return ShadowLayerForwarder::HasShadowManager(); }

View File

@ -1199,6 +1199,7 @@ void nsDisplayList::PaintForFrame(nsDisplayListBuilder* aBuilder,
LayerProperties::ClearInvalidations(root);
}
bool shouldInvalidate = layerManager->NeedsWidgetInvalidation();
if (view) {
if (props) {
if (!invalid.IsEmpty()) {
@ -1207,10 +1208,12 @@ void nsDisplayList::PaintForFrame(nsDisplayListBuilder* aBuilder,
presContext->DevPixelsToAppUnits(bounds.y),
presContext->DevPixelsToAppUnits(bounds.width),
presContext->DevPixelsToAppUnits(bounds.height));
view->GetViewManager()->InvalidateViewNoSuppression(view, rect);
if (shouldInvalidate) {
view->GetViewManager()->InvalidateViewNoSuppression(view, rect);
}
presContext->NotifyInvalidation(bounds, 0);
}
} else {
} else if (shouldInvalidate) {
view->GetViewManager()->InvalidateView(view);
}
}

View File

@ -5489,8 +5489,6 @@ PresShell::Paint(nsView* aViewToPaint,
return;
}
nsAutoNotifyDidPaint notifyDidPaint(this, aFlags);
nsPresContext* presContext = GetPresContext();
AUTO_LAYOUT_PHASE_ENTRY_POINT(presContext, Paint);
@ -5500,6 +5498,13 @@ PresShell::Paint(nsView* aViewToPaint,
LayerManager* layerManager =
aViewToPaint->GetWidget()->GetLayerManager(&isRetainingManager);
NS_ASSERTION(layerManager, "Must be in paint event");
bool shouldInvalidate = layerManager->NeedsWidgetInvalidation();
uint32_t didPaintFlags = aFlags;
if (!shouldInvalidate) {
didPaintFlags |= PAINT_COMPOSITE;
}
nsAutoNotifyDidPaint notifyDidPaint(this, didPaintFlags);
// Whether or not we should set first paint when painting is
// suppressed is debatable. For now we'll do it because
@ -5519,9 +5524,6 @@ PresShell::Paint(nsView* aViewToPaint,
// 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 (!(aFlags & PAINT_LAYERS)) {
if (layerManager->HasShadowManager() && Compositor::GetBackend() != LAYERS_BASIC) {
return;
}
layerManager->BeginTransaction();
if (layerManager->EndEmptyTransaction()) {
return;
@ -5556,10 +5558,12 @@ PresShell::Paint(nsView* aViewToPaint,
presContext->DevPixelsToAppUnits(bounds.y),
presContext->DevPixelsToAppUnits(bounds.width),
presContext->DevPixelsToAppUnits(bounds.height));
aViewToPaint->GetViewManager()->InvalidateViewNoSuppression(aViewToPaint, rect);
if (shouldInvalidate) {
aViewToPaint->GetViewManager()->InvalidateViewNoSuppression(aViewToPaint, rect);
}
presContext->NotifyInvalidation(bounds, 0);
}
} else {
} else if (shouldInvalidate) {
aViewToPaint->GetViewManager()->InvalidateView(aViewToPaint);
}

View File

@ -21,8 +21,8 @@ default-preferences pref(dom.experimental_forms_range,true)
== input-valueAsNumber-prop.html input-75pct-common-ref.html
fails-if(B2G) == input-stepDown-unthemed.html input-75pct-unthemed-common-ref.html
fails-if(B2G) == input-stepDown.html input-75pct-common-ref.html
fails-if(B2G) == input-stepUp-unthemed.html input-75pct-unthemed-common-ref.html
fails-if(B2G) == input-stepUp.html input-75pct-common-ref.html
== input-stepUp-unthemed.html input-75pct-unthemed-common-ref.html
== input-stepUp.html input-75pct-common-ref.html
# 'direction' property:
== input-range-direction-unthemed-1.html input-range-direction-unthemed-1-ref.html

View File

@ -25,6 +25,7 @@
#include "mozilla/Preferences.h"
#include "nsContentUtils.h"
#include "nsLayoutUtils.h"
#include "mozilla/layers/Compositor.h"
/**
XXX TODO XXX
@ -42,6 +43,8 @@
we ask for a specific z-order, we don't assume that widget z-ordering actually works.
*/
using namespace mozilla::layers;
#define NSCOORD_NONE INT32_MIN
#undef DEBUG_MOUSE_LOCATION
@ -330,8 +333,14 @@ void nsViewManager::Refresh(nsView *aView, const nsIntRegion& aRegion)
printf("--COMPOSITE-- %p\n", mPresShell);
}
#endif
mPresShell->Paint(aView, damageRegion,
nsIPresShell::PAINT_COMPOSITE);
uint32_t paintFlags = nsIPresShell::PAINT_COMPOSITE;
LayerManager *manager = widget->GetLayerManager();
if (!manager->NeedsWidgetInvalidation()) {
manager->FlushRendering();
} else {
mPresShell->Paint(aView, damageRegion,
paintFlags);
}
#ifdef MOZ_DUMP_PAINTING
if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
printf("--ENDCOMPOSITE--\n");