Bug 812517. Part 2: Call ScrollToCSSPixelsApproximate when TabChild scrolls. r=mats

--HG--
extra : rebase_source : e4c9db69125d21a84400a062630a0c62c3f450d8
This commit is contained in:
Robert O'Callahan 2012-11-23 14:25:28 +13:00
Родитель 1b93616df8
Коммит 8e2f98a952
2 изменённых файлов: 17 добавлений и 5 удалений

Просмотреть файл

@ -511,6 +511,10 @@ public:
return mIsChrome;
}
// GetScrollFrame does not flush. Callers should do it themselves as needed,
// depending on which info they actually want off the scrollable frame.
nsIScrollableFrame *GetScrollFrame();
nsresult Observe(nsISupports* aSubject, const char* aTopic,
const PRUnichar* aData);
@ -793,9 +797,6 @@ protected:
nsresult GetTreeOwner(nsIDocShellTreeOwner** aTreeOwner);
nsresult GetTreeOwner(nsIBaseWindow** aTreeOwner);
nsresult GetWebBrowserChrome(nsIWebBrowserChrome** aBrowserChrome);
// GetScrollFrame does not flush. Callers should do it themselves as needed,
// depending on which info they actually want off the scrollable frame.
nsIScrollableFrame *GetScrollFrame();
nsresult SecurityCheckURL(const char *aURL);
nsresult BuildURIfromBase(const char *aURL,
nsIURI **aBuiltURI,

Просмотреть файл

@ -64,6 +64,7 @@
#include "nsInterfaceHashtable.h"
#include "nsPIDOMWindow.h"
#include "nsPIWindowRoot.h"
#include "nsGlobalWindow.h"
#include "nsPresContext.h"
#include "nsPrintfCString.h"
#include "nsScriptLoader.h"
@ -1154,6 +1155,17 @@ TabChild::DispatchMessageManagerMessage(const nsAString& aMessageName,
aMessageName, false, &cloneData, nullptr, nullptr);
}
static void
ScrollWindowTo(nsIDOMWindow* aWindow, const mozilla::gfx::Point& aPoint)
{
nsGlobalWindow* window = static_cast<nsGlobalWindow*>(aWindow);
nsIScrollableFrame* sf = window->GetScrollFrame();
if (sf) {
sf->ScrollToCSSPixelsApproximate(aPoint);
}
}
bool
TabChild::RecvUpdateFrame(const FrameMetrics& aFrameMetrics)
{
@ -1199,8 +1211,7 @@ TabChild::RecvUpdateFrame(const FrameMetrics& aFrameMetrics)
AsyncPanZoomController::CalculateCompositedRectInCssPixels(aFrameMetrics);
utils->SetScrollPositionClampingScrollPortSize(
cssCompositedRect.width, cssCompositedRect.height);
window->ScrollTo(aFrameMetrics.mScrollOffset.x,
aFrameMetrics.mScrollOffset.y);
ScrollWindowTo(window, aFrameMetrics.mScrollOffset);
gfxSize resolution = AsyncPanZoomController::CalculateResolution(
aFrameMetrics);
utils->SetResolution(resolution.width, resolution.height);