From 193b552c7ebe181adef00b5d45450ddba00c7915 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Thu, 6 Nov 2014 09:06:22 +0000 Subject: [PATCH] Bug 1093949 - Reverse scroll position for RTL content. r=mats --- layout/generic/nsGfxScrollFrame.cpp | 2 +- layout/xul/nsIScrollbarMediator.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 6ef75c4e747f..0c2e98ee6fb0 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -1132,7 +1132,7 @@ ScrollFrameHelper::ThumbMoved(nsScrollbarFrame* aScrollbar, nsPoint current = GetScrollPosition(); nsPoint dest = current; if (isHorizontal) { - dest.x = aNewPos; + dest.x = IsLTR() ? aNewPos : aNewPos - GetScrollRange().width; } else { dest.y = aNewPos; } diff --git a/layout/xul/nsIScrollbarMediator.h b/layout/xul/nsIScrollbarMediator.h index 4921cf7aaeb0..f6730081660f 100644 --- a/layout/xul/nsIScrollbarMediator.h +++ b/layout/xul/nsIScrollbarMediator.h @@ -41,6 +41,9 @@ public: virtual void RepeatButtonScroll(nsScrollbarFrame* aScrollbar) = 0; /** * aOldPos and aNewPos are scroll positions. + * The scroll positions start with zero at the left edge; implementors that want + * zero at the right edge for RTL content will need to adjust accordingly. + * (See ScrollFrameHelper::ThumbMoved in nsGfxScrollFrame.cpp.) * @note This method might destroy the frame, pres shell, and other objects. */ virtual void ThumbMoved(nsScrollbarFrame* aScrollbar,