Bug 1507279 - Expose the visual scrolling mechanism to internal JS users. r=kats
Differential Revision: https://phabricator.services.mozilla.com/D16142
This commit is contained in:
@@ -1396,6 +1396,23 @@ nsDOMWindowUtils::GetScrollXYFloat(bool aFlushLayout, float* aScrollX,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::ScrollToVisual(float aOffsetX, float aOffsetY) {
|
||||
nsCOMPtr<Document> doc = GetDocument();
|
||||
NS_ENSURE_STATE(doc);
|
||||
|
||||
nsPresContext* presContext = doc->GetPresContext();
|
||||
NS_ENSURE_TRUE(presContext, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
// This should only be called on the root content document.
|
||||
NS_ENSURE_TRUE(presContext->IsRootContentDocument(), NS_ERROR_INVALID_ARG);
|
||||
|
||||
presContext->PresShell()->SetPendingVisualViewportOffset(
|
||||
Some(CSSPoint::ToAppUnits(CSSPoint(aOffsetX, aOffsetY))));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::GetVisualViewportOffsetRelativeToLayoutViewport(
|
||||
float* aOffsetX, float* aOffsetY) {
|
||||
|
||||
Reference in New Issue
Block a user