Bug 1151421 Part 1: Change Window scroll and offset properties to be doubles instead of ints.
MozReview-Commit-ID: KeTokCIO5D9
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -6332,17 +6332,17 @@ nsGlobalWindow::GetScrollMaxX(ErrorResul
int32_t
nsGlobalWindow::GetScrollMaxY(ErrorResult& aError)
{
MOZ_ASSERT(IsInnerWindow());
FORWARD_TO_OUTER_OR_THROW(GetScrollBoundaryOuter, (eSideBottom), aError, 0);
}
-CSSIntPoint
+CSSPoint
nsGlobalWindow::GetScrollXY(bool aDoFlush)
{
MOZ_ASSERT(IsOuterWindow());
if (aDoFlush) {
FlushPendingNotifications(FlushType::Layout);
} else {
EnsureSizeUpToDate();
@@ -6356,40 +6356,40 @@ nsGlobalWindow::GetScrollXY(bool aDoFlus
nsPoint scrollPos = sf->GetScrollPosition();
if (scrollPos != nsPoint(0,0) && !aDoFlush) {
// Oh, well. This is the expensive case -- the window is scrolled and we
// didn't actually flush yet. Repeat, but with a flush, since the content
// may get shorter and hence our scroll position may decrease.
return GetScrollXY(true);
}
- return sf->GetScrollPositionCSSPixels();
-}
-
-int32_t
+ return CSSPoint::FromAppUnits(scrollPos);
+}
+
+double
nsGlobalWindow::GetScrollXOuter()
{
MOZ_RELEASE_ASSERT(IsOuterWindow());
return GetScrollXY(false).x;
}
-int32_t
+double
nsGlobalWindow::GetScrollX(ErrorResult& aError)
{
FORWARD_TO_OUTER_OR_THROW(GetScrollXOuter, (), aError, 0);
}
-int32_t
+double
nsGlobalWindow::GetScrollYOuter()
{
MOZ_RELEASE_ASSERT(IsOuterWindow());
return GetScrollXY(false).y;
}
-int32_t
+double
nsGlobalWindow::GetScrollY(ErrorResult& aError)
{
FORWARD_TO_OUTER_OR_THROW(GetScrollYOuter, (), aError, 0);
}
uint32_t
nsGlobalWindow::Length()
{
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -1085,25 +1085,25 @@ public:
mozilla::dom::CallerType aCallerType,
mozilla::ErrorResult& aError);
void GetInnerHeight(JSContext* aCx, JS::MutableHandle<JS::Value> aValue,
mozilla::dom::CallerType aCallerType,
mozilla::ErrorResult& aError);
void SetInnerHeight(JSContext* aCx, JS::Handle<JS::Value> aValue,
mozilla::dom::CallerType aCallerType,
mozilla::ErrorResult& aError);
- int32_t GetScrollXOuter();
- int32_t GetScrollX(mozilla::ErrorResult& aError);
- int32_t GetPageXOffset(mozilla::ErrorResult& aError)
+ double GetScrollXOuter();
+ double GetScrollX(mozilla::ErrorResult& aError);
+ double GetPageXOffset(mozilla::ErrorResult& aError)
{
return GetScrollX(aError);
}
- int32_t GetScrollYOuter();
- int32_t GetScrollY(mozilla::ErrorResult& aError);
- int32_t GetPageYOffset(mozilla::ErrorResult& aError)
+ double GetScrollYOuter();
+ double GetScrollY(mozilla::ErrorResult& aError);
+ double GetPageYOffset(mozilla::ErrorResult& aError)
{
return GetScrollY(aError);
}
void GetScreenX(JSContext* aCx, JS::MutableHandle<JS::Value> aValue,
mozilla::dom::CallerType aCallerType,
mozilla::ErrorResult& aError);
void SetScreenX(JSContext* aCx, JS::Handle<JS::Value> aValue,
mozilla::dom::CallerType aCallerType,
@@ -1630,17 +1630,17 @@ public:
nsIPrincipal* aSubjectPrincipal);
// Outer windows only.
bool CanMoveResizeWindows(mozilla::dom::CallerType aCallerType);
// If aDoFlush is true, we'll flush our own layout; otherwise we'll try to
// just flush our parent and only flush ourselves if we think we need to.
// Outer windows only.
- mozilla::CSSIntPoint GetScrollXY(bool aDoFlush);
+ mozilla::CSSPoint GetScrollXY(bool aDoFlush);
int32_t GetScrollBoundaryOuter(mozilla::Side aSide);
// Outer windows only.
nsresult GetInnerSize(mozilla::CSSIntSize& aSize);
nsIntSize GetOuterSize(mozilla::dom::CallerType aCallerType,
mozilla::ErrorResult& aError);
void SetOuterSize(int32_t aLengthCSSPixels, bool aIsWidth,
--- a/dom/webidl/Window.webidl
+++ b/dom/webidl/Window.webidl
@@ -178,24 +178,20 @@ partial interface Window {
void scrollBy(optional ScrollToOptions options);
// mozScrollSnap is used by chrome to perform scroll snapping after the
// user performs actions that may affect scroll position
// mozScrollSnap is deprecated, to be replaced by a web accessible API, such
// as an extension to the ScrollOptions dictionary. See bug 1137937.
[ChromeOnly] void mozScrollSnap();
// The four properties below are double per spec at the moment, but whether
// that will continue is unclear.
- //[Replaceable, Throws] readonly attribute double scrollX;
- //[Replaceable, Throws] readonly attribute double pageXOffset;
- //[Replaceable, Throws] readonly attribute double scrollY;
- //[Replaceable, Throws] readonly attribute double pageYOffset;
- [Replaceable, Throws] readonly attribute long scrollX;
- [Replaceable, Throws] readonly attribute long pageXOffset;
- [Replaceable, Throws] readonly attribute long scrollY;
- [Replaceable, Throws] readonly attribute long pageYOffset;
+ [Replaceable, Throws] readonly attribute double scrollX;
+ [Replaceable, Throws] readonly attribute double pageXOffset;
+ [Replaceable, Throws] readonly attribute double scrollY;
+ [Replaceable, Throws] readonly attribute double pageYOffset;
// client
// These are writable because we allow chrome to write them. And they need
// to use 'any' as the type, because non-chrome writing them needs to act
// like a [Replaceable] attribute would, which needs the original JS value.
//[Replaceable, Throws] readonly attribute double screenX;
//[Replaceable, Throws] readonly attribute double screenY;
//[Replaceable, Throws] readonly attribute double outerWidth;