From 98c45828b164d9471f6173be35e9f77251bb672b Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Wed, 12 Mar 2014 15:27:44 -0400 Subject: [PATCH] Bug 981029 - Make ProcessUpdateFrame behave in less magical ways. r=botond Replace the always-true return value, with a FrameMetrics object that reflects the final metrics put in place. Also remove the side-effect of assigning mLastRootMetrics and put that in the call sites instead. --- dom/ipc/TabChild.cpp | 17 ++++++++--------- dom/ipc/TabChild.h | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index 5de42fef21f..02c9457b44a 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -661,7 +661,7 @@ TabChild::HandlePossibleViewportChange() // Force a repaint with these metrics. This, among other things, sets the // displayport, so we start with async painting. - ProcessUpdateFrame(metrics); + mLastRootMetrics = ProcessUpdateFrame(metrics); if (viewportInfo.IsZoomAllowed() && scrollIdentifiersValid) { // If the CSS viewport is narrower than the screen (i.e. width <= device-width) @@ -1477,7 +1477,8 @@ TabChild::RecvUpdateFrame(const FrameMetrics& aFrameMetrics) if (aFrameMetrics.mIsRoot) { nsCOMPtr utils(GetDOMWindowUtils()); if (APZCCallbackHelper::HasValidPresShellId(utils, aFrameMetrics)) { - return ProcessUpdateFrame(aFrameMetrics); + mLastRootMetrics = ProcessUpdateFrame(aFrameMetrics); + return true; } } else { // aFrameMetrics.mIsRoot is false, so we are trying to update a subframe. @@ -1494,7 +1495,8 @@ TabChild::RecvUpdateFrame(const FrameMetrics& aFrameMetrics) // We've recieved a message that is out of date and we want to ignore. // However we can't reply without painting so we reply by painting the // exact same thing as we did before. - return ProcessUpdateFrame(mLastRootMetrics); + mLastRootMetrics = ProcessUpdateFrame(mLastRootMetrics); + return true; } bool @@ -1505,11 +1507,11 @@ TabChild::RecvAcknowledgeScrollUpdate(const ViewID& aScrollId, return true; } -bool +FrameMetrics TabChild::ProcessUpdateFrame(const FrameMetrics& aFrameMetrics) { if (!mGlobal || !mTabChildGlobal) { - return true; + return aFrameMetrics; } nsCOMPtr utils(GetDOMWindowUtils()); @@ -1549,10 +1551,7 @@ TabChild::ProcessUpdateFrame(const FrameMetrics& aFrameMetrics) data.AppendLiteral(" }"); DispatchMessageManagerMessage(NS_LITERAL_STRING("Viewport:Change"), data); - - mLastRootMetrics = newMetrics; - - return true; + return newMetrics; } bool diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h index 45feab6039f..5e6ba0210fe 100644 --- a/dom/ipc/TabChild.h +++ b/dom/ipc/TabChild.h @@ -417,7 +417,7 @@ private: bool InitRenderingState(); void DestroyWindow(); void SetProcessNameToAppName(); - bool ProcessUpdateFrame(const mozilla::layers::FrameMetrics& aFrameMetrics); + FrameMetrics ProcessUpdateFrame(const FrameMetrics& aFrameMetrics); // Call RecvShow(nsIntSize(0, 0)) and block future calls to RecvShow(). void DoFakeShow();