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.
This commit is contained in:
Kartikaya Gupta 2014-03-12 15:27:44 -04:00
parent 3e77e23c46
commit 98c45828b1
2 changed files with 9 additions and 10 deletions

View File

@ -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<nsIDOMWindowUtils> 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<nsIDOMWindowUtils> 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

View File

@ -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();