Bug 914847. Use a mini-flush instead of a full style flush. r=dbaron

This commit is contained in:
Nicholas Cameron 2013-10-22 14:13:26 +02:00
parent cdb5d5c27b
commit c22d18150e

View File

@ -6203,6 +6203,20 @@ nsIFrame* GetNearestFrameContainingPresShell(nsIPresShell* aPresShell)
return frame;
}
static bool
FlushThrottledStyles(nsIDocument *aDocument, void *aData)
{
nsIPresShell* shell = aDocument->GetShell();
if (shell && shell->IsVisible()) {
nsPresContext* presContext = shell->GetPresContext();
if (presContext) {
presContext->TransitionManager()->UpdateAllThrottledStyles();
}
}
return true;
}
nsresult
PresShell::HandleEvent(nsIFrame* aFrame,
WidgetGUIEvent* aEvent,
@ -6299,14 +6313,21 @@ PresShell::HandleEvent(nsIFrame* aFrame,
nsIFrame* frame = aFrame;
if (aEvent->eventStructType == NS_TOUCH_EVENT) {
nsIDocument::UnlockPointer();
FlushPendingNotifications(Flush_Layout);
frame = GetNearestFrameContainingPresShell(this);
}
bool dispatchUsingCoordinates = aEvent->IsUsingCoordinates();
if (dispatchUsingCoordinates) {
if (nsLayoutUtils::AreAsyncAnimationsEnabled() && mDocument) {
if (aEvent->eventStructType == NS_TOUCH_EVENT) {
nsIDocument::UnlockPointer();
}
{ // scope for scriptBlocker.
nsAutoScriptBlocker scriptBlocker;
GetRootPresShell()->GetDocument()->
EnumerateSubDocuments(FlushThrottledStyles, nullptr);
}
frame = GetNearestFrameContainingPresShell(this);
}
NS_WARN_IF_FALSE(frame, "Nothing to handle this event!");
if (!frame)
return NS_OK;