diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 1830b5de2042..5b47f8f1bb9d 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -1395,7 +1395,8 @@ nsDOMWindowUtils::GetScrollXYFloat(bool aFlushLayout, float* aScrollX, } NS_IMETHODIMP -nsDOMWindowUtils::ScrollToVisual(float aOffsetX, float aOffsetY) { +nsDOMWindowUtils::ScrollToVisual(float aOffsetX, float aOffsetY, + int32_t aUpdateType) { nsCOMPtr doc = GetDocument(); NS_ENSURE_STATE(doc); @@ -1405,12 +1406,20 @@ nsDOMWindowUtils::ScrollToVisual(float aOffsetX, float aOffsetY) { // This should only be called on the root content document. NS_ENSURE_TRUE(presContext->IsRootContentDocument(), NS_ERROR_INVALID_ARG); - // Use |eRestore| as the priority for now, as it's the conservative choice. - // If a JS call site needs higher priority, we can expose the update type - // as a parameter. + FrameMetrics::ScrollOffsetUpdateType updateType; + switch (aUpdateType) { + case UPDATE_TYPE_RESTORE: + updateType = FrameMetrics::eRestore; + break; + case UPDATE_TYPE_MAIN_THREAD: + updateType = FrameMetrics::eMainThread; + break; + default: + return NS_ERROR_INVALID_ARG; + } + presContext->PresShell()->SetPendingVisualScrollUpdate( - CSSPoint::ToAppUnits(CSSPoint(aOffsetX, aOffsetY)), - FrameMetrics::eRestore); + CSSPoint::ToAppUnits(CSSPoint(aOffsetX, aOffsetY)), updateType); return NS_OK; } diff --git a/dom/interfaces/base/nsIDOMWindowUtils.idl b/dom/interfaces/base/nsIDOMWindowUtils.idl index 42daa0c11367..d21d42f75b59 100644 --- a/dom/interfaces/base/nsIDOMWindowUtils.idl +++ b/dom/interfaces/base/nsIDOMWindowUtils.idl @@ -839,8 +839,10 @@ interface nsIDOMWindowUtils : nsISupports { * SetPendingVisualViewportOffset(), and request APZ review if adding a new * call to this. */ - void scrollToVisual(in float aOffsetX, in float aOffsetY); - + const long UPDATE_TYPE_RESTORE = 0; + const long UPDATE_TYPE_MAIN_THREAD = 1; + void scrollToVisual(in float aOffsetX, in float aOffsetY, in long aUpdateType); + /** * Returns the offset of the window's visual viewport relative to the * layout viewport. diff --git a/gfx/layers/apz/test/mochitest/helper_fullscreen.html b/gfx/layers/apz/test/mochitest/helper_fullscreen.html index 30ecafb52d3d..7e00b0fec707 100644 --- a/gfx/layers/apz/test/mochitest/helper_fullscreen.html +++ b/gfx/layers/apz/test/mochitest/helper_fullscreen.html @@ -19,6 +19,8 @@
overflowed element