From 45428037296508022709b591bf9de8f5a6c56d77 Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Mon, 1 Jun 2015 13:03:30 +0200 Subject: [PATCH] Backed out changeset 99011d150a1d (bug 1163572) for b2g ics debug bustage on a CLOSED TREE --- dom/ipc/TabChild.cpp | 5 +-- gfx/layers/apz/util/APZCCallbackHelper.cpp | 38 +++++++++---------- gfx/layers/apz/util/APZCCallbackHelper.h | 2 +- .../apz/util/ChromeProcessController.cpp | 14 ++----- 4 files changed, 24 insertions(+), 35 deletions(-) diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index ae9ab7e7fede..5a8bd28b1105 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -575,9 +575,8 @@ TabChildBase::ProcessUpdateFrame(const FrameMetrics& aFrameMetrics) } FrameMetrics newMetrics = aFrameMetrics; - nsCOMPtr target = nsLayoutUtils::FindContentFor(aFrameMetrics.GetScrollId()); - if (target) { - APZCCallbackHelper::UpdateRootFrame(target, newMetrics); + if (nsCOMPtr presShell = GetPresShell()) { + APZCCallbackHelper::UpdateRootFrame(presShell, newMetrics); } CSSSize cssCompositedSize = newMetrics.CalculateCompositedSizeInCssPixels(); diff --git a/gfx/layers/apz/util/APZCCallbackHelper.cpp b/gfx/layers/apz/util/APZCCallbackHelper.cpp index ce9302f9e125..4db76d7f03df 100644 --- a/gfx/layers/apz/util/APZCCallbackHelper.cpp +++ b/gfx/layers/apz/util/APZCCallbackHelper.cpp @@ -163,31 +163,18 @@ SetDisplayPortMargins(nsIPresShell* aPresShell, nsLayoutUtils::SetDisplayPortBaseIfNotSet(aContent, base); } -static already_AddRefed -GetPresShell(const nsIContent* aContent) -{ - nsCOMPtr result; - if (nsIDocument* doc = aContent->GetComposedDoc()) { - result = doc->GetShell(); - } - return result.forget(); -} - void -APZCCallbackHelper::UpdateRootFrame(nsIContent* aContent, +APZCCallbackHelper::UpdateRootFrame(nsIPresShell* aPresShell, FrameMetrics& aMetrics) { // Precondition checks - MOZ_ASSERT(aContent); + MOZ_ASSERT(aPresShell); MOZ_ASSERT(aMetrics.GetUseDisplayPortMargins()); - nsCOMPtr shell = GetPresShell(aContent); - MOZ_ASSERT(shell); - if (aMetrics.GetScrollId() == FrameMetrics::NULL_SCROLL_ID) { return; } - float presShellResolution = nsLayoutUtils::GetResolution(shell); + float presShellResolution = nsLayoutUtils::GetResolution(aPresShell); // If the pres shell resolution has changed on the content side side // the time this repaint request was fired, consider this request out of date @@ -207,19 +194,30 @@ APZCCallbackHelper::UpdateRootFrame(nsIContent* aContent, // Note that this needs to happen before scrolling the frame (in UpdateFrameCommon), // otherwise the scroll position may get clamped incorrectly. CSSSize scrollPort = aMetrics.CalculateCompositedSizeInCssPixels(); - nsLayoutUtils::SetScrollPositionClampingScrollPortSize(shell, scrollPort); + nsLayoutUtils::SetScrollPositionClampingScrollPortSize(aPresShell, scrollPort); // The pres shell resolution is updated by the the async zoom since the // last paint. presShellResolution = aMetrics.GetPresShellResolution() * aMetrics.GetAsyncZoom().scale; - nsLayoutUtils::SetResolutionAndScaleTo(shell, presShellResolution); + nsLayoutUtils::SetResolutionAndScaleTo(aPresShell, presShellResolution); // Do this as late as possible since scrolling can flush layout. It also // adjusts the display port margins, so do it before we set those. - ScrollFrame(aContent, aMetrics); + nsIContent* content = nsLayoutUtils::FindContentFor(aMetrics.GetScrollId()); + ScrollFrame(content, aMetrics); - SetDisplayPortMargins(shell, aContent, aMetrics); + SetDisplayPortMargins(aPresShell, content, aMetrics); +} + +static already_AddRefed +GetPresShell(const nsIContent* aContent) +{ + nsCOMPtr result; + if (nsIDocument* doc = aContent->GetComposedDoc()) { + result = doc->GetShell(); + } + return result.forget(); } void diff --git a/gfx/layers/apz/util/APZCCallbackHelper.h b/gfx/layers/apz/util/APZCCallbackHelper.h index 2fd4737f274e..396d28f3ee2d 100644 --- a/gfx/layers/apz/util/APZCCallbackHelper.h +++ b/gfx/layers/apz/util/APZCCallbackHelper.h @@ -47,7 +47,7 @@ public: Setting the scroll position can cause some small adjustments to be made to the actual scroll position. aMetrics' display port and scroll position will be updated with any modifications made. */ - static void UpdateRootFrame(nsIContent* aPresShell, + static void UpdateRootFrame(nsIPresShell* aPresShell, FrameMetrics& aMetrics); /* Applies the scroll parameters from the given FrameMetrics object to the subframe diff --git a/gfx/layers/apz/util/ChromeProcessController.cpp b/gfx/layers/apz/util/ChromeProcessController.cpp index ee4c0c5dca31..f60cae1f30a7 100644 --- a/gfx/layers/apz/util/ChromeProcessController.cpp +++ b/gfx/layers/apz/util/ChromeProcessController.cpp @@ -76,17 +76,9 @@ ChromeProcessController::RequestContentRepaint(const FrameMetrics& aFrameMetrics } nsCOMPtr targetContent = nsLayoutUtils::FindContentFor(aFrameMetrics.GetScrollId()); - FrameMetrics metrics = aFrameMetrics; - if (aFrameMetrics.GetIsRoot()) { - nsCOMPtr doc = targetContent->GetComposedDoc(); - nsCOMPtr shell = doc ? doc->GetShell() : nullptr; - if (shell && aFrameMetrics.GetPresShellId() == shell->GetPresShellId()) { - APZCCallbackHelper::UpdateRootFrame(targetContent, metrics); - } - } else { - if (targetContent) { - APZCCallbackHelper::UpdateSubFrame(targetContent, metrics); - } + if (targetContent) { + FrameMetrics metrics = aFrameMetrics; + APZCCallbackHelper::UpdateSubFrame(targetContent, metrics); } }