- Revision
- 99616
- Author
- x...@chromium.org
- Date
- 2011-11-08 14:22:24 -0800 (Tue, 08 Nov 2011)
Log Message
REGRESSION: rtl horizontal scrollbar / resize bug - Body shifts on resize when scrolled all the way to the left
https://bugs.webkit.org/show_bug.cgi?id=70395
Reviewed by Tony Chang.
Source/WebCore:
Change the condition to perform immediate scolling inside ScrollView::updateScrollbars()
to be correct for RTL page as well, which is checking either the scroll position change or
the m_scrollOrigin changes (such as in window resize in which scroll position might remain the same).
And remove condition checking inside ScrollableArea::scrollToOffsetWithoutAnimation() since
the pass-in offset is adjusted within the current scroll range, it could be the same as
m_currentPos when m_currentPos is (0, 0) and current scroll range is smaller than old
scroll range, but scolling is still needed when page resize and scroll range changes.
Test: fast/dom/rtl-scroll-to-leftmost-and-resize.html
* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::scrollToOffsetWithoutAnimation): Remove condition checking.
* platform/ScrollView.cpp:
(WebCore::ScrollView::updateScrollbars): Change condition to perform immediate scrolling to be
correct for RTL pages as well.
* platform/ScrollableArea.cpp: Update m_scrollOriginChanged.
(WebCore::ScrollableArea::ScrollableArea):
(WebCore::ScrollableArea::setScrollOrigin):
(WebCore::ScrollableArea::setScrollOriginX):
(WebCore::ScrollableArea::setScrollOriginY):
* platform/ScrollableArea.h: Add m_scrollOriginChanged.
(WebCore::ScrollableArea::scrollOriginChanged):
(WebCore::ScrollableArea::resetScrollOriginChanged):
LayoutTests:
* fast/dom/rtl-scroll-to-leftmost-and-resize.html: Added.
* platform/chromium/test_expectations.txt:
* platform/mac-snowleopard/fast/dom/rtl-scroll-to-leftmost-and-resize-expected.png: Added.
* platform/mac-snowleopard/fast/dom/rtl-scroll-to-leftmost-and-resize-expected.txt: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (99615 => 99616)
--- trunk/LayoutTests/ChangeLog 2011-11-08 22:01:16 UTC (rev 99615)
+++ trunk/LayoutTests/ChangeLog 2011-11-08 22:22:24 UTC (rev 99616)
@@ -1,3 +1,15 @@
+2011-11-08 Xiaomei Ji <x...@chromium.org>
+
+ REGRESSION: rtl horizontal scrollbar / resize bug - Body shifts on resize when scrolled all the way to the left
+ https://bugs.webkit.org/show_bug.cgi?id=70395
+
+ Reviewed by Tony Chang.
+
+ * fast/dom/rtl-scroll-to-leftmost-and-resize.html: Added.
+ * platform/chromium/test_expectations.txt:
+ * platform/mac-snowleopard/fast/dom/rtl-scroll-to-leftmost-and-resize-expected.png: Added.
+ * platform/mac-snowleopard/fast/dom/rtl-scroll-to-leftmost-and-resize-expected.txt: Added.
+
2011-11-08 Dan Bernstein <m...@apple.com>
<rdar://problem/10262225> Allow RenderView to have columns
Added: trunk/LayoutTests/fast/dom/rtl-scroll-to-leftmost-and-resize.html (0 => 99616)
--- trunk/LayoutTests/fast/dom/rtl-scroll-to-leftmost-and-resize.html (rev 0)
+++ trunk/LayoutTests/fast/dom/rtl-scroll-to-leftmost-and-resize.html 2011-11-08 22:22:24 UTC (rev 99616)
@@ -0,0 +1,19 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+<head>
+<script type="text/_javascript_">
+_onload_ = function()
+{
+ window.resizeTo(250, window.innerHeight);
+ window.scrollTo(-100000, 0);
+ window.resizeTo(350, window.innerHeight);
+}
+</script>
+</head>
+ <body style="direction: rtl">
+ <div style="whitespace:nowrap; width: 1000px; height: 4000px; border: 1px solid red;">
+ BEGINddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddEND
+ </div>
+ </body>
+</html>
+
Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (99615 => 99616)
--- trunk/LayoutTests/platform/chromium/test_expectations.txt 2011-11-08 22:01:16 UTC (rev 99615)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt 2011-11-08 22:22:24 UTC (rev 99616)
@@ -3939,3 +3939,6 @@
BUGRICOW : fast/js/toString-overrides.html = TEXT
BUGRICOW : fast/js/toString-recursion.html = TEXT
BUGRICOW : http/tests/security/xss-eval.html = TEXT
+
+// Need rebaseline.
+BUGXJI WIN LINUX : fast/dom/rtl-scroll-to-leftmost-and-resize.html = IMAGE+TEXT
Added: trunk/LayoutTests/platform/mac-snowleopard/fast/dom/rtl-scroll-to-leftmost-and-resize-expected.png
(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac-snowleopard/fast/dom/rtl-scroll-to-leftmost-and-resize-expected.png
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/platform/mac-snowleopard/fast/dom/rtl-scroll-to-leftmost-and-resize-expected.txt (0 => 99616)
--- trunk/LayoutTests/platform/mac-snowleopard/fast/dom/rtl-scroll-to-leftmost-and-resize-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac-snowleopard/fast/dom/rtl-scroll-to-leftmost-and-resize-expected.txt 2011-11-08 22:22:24 UTC (rev 99616)
@@ -0,0 +1,9 @@
+layer at (0,0) size 785x4018
+ RenderView at (0,0) size 785x585
+layer at (0,0) size 785x4018
+ RenderBlock {HTML} at (0,0) size 785x4018
+ RenderBody {BODY} at (8,8) size 769x4002
+ RenderBlock {DIV} at (-233,0) size 1002x4002 [border: (1px solid #FF0000)]
+ RenderText {#text} at (-491,1) size 1492x18
+ text run at (-491,1) width 1492: "BEGINddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddEND"
+scrolled to -716,0
Modified: trunk/Source/WebCore/ChangeLog (99615 => 99616)
--- trunk/Source/WebCore/ChangeLog 2011-11-08 22:01:16 UTC (rev 99615)
+++ trunk/Source/WebCore/ChangeLog 2011-11-08 22:22:24 UTC (rev 99616)
@@ -1,3 +1,35 @@
+2011-11-08 Xiaomei Ji <x...@chromium.org>
+
+ REGRESSION: rtl horizontal scrollbar / resize bug - Body shifts on resize when scrolled all the way to the left
+ https://bugs.webkit.org/show_bug.cgi?id=70395
+
+ Reviewed by Tony Chang.
+
+ Change the condition to perform immediate scolling inside ScrollView::updateScrollbars()
+ to be correct for RTL page as well, which is checking either the scroll position change or
+ the m_scrollOrigin changes (such as in window resize in which scroll position might remain the same).
+
+ And remove condition checking inside ScrollableArea::scrollToOffsetWithoutAnimation() since
+ the pass-in offset is adjusted within the current scroll range, it could be the same as
+ m_currentPos when m_currentPos is (0, 0) and current scroll range is smaller than old
+ scroll range, but scolling is still needed when page resize and scroll range changes.
+
+ Test: fast/dom/rtl-scroll-to-leftmost-and-resize.html
+
+ * platform/ScrollAnimator.cpp:
+ (WebCore::ScrollAnimator::scrollToOffsetWithoutAnimation): Remove condition checking.
+ * platform/ScrollView.cpp:
+ (WebCore::ScrollView::updateScrollbars): Change condition to perform immediate scrolling to be
+ correct for RTL pages as well.
+ * platform/ScrollableArea.cpp: Update m_scrollOriginChanged.
+ (WebCore::ScrollableArea::ScrollableArea):
+ (WebCore::ScrollableArea::setScrollOrigin):
+ (WebCore::ScrollableArea::setScrollOriginX):
+ (WebCore::ScrollableArea::setScrollOriginY):
+ * platform/ScrollableArea.h: Add m_scrollOriginChanged.
+ (WebCore::ScrollableArea::scrollOriginChanged):
+ (WebCore::ScrollableArea::resetScrollOriginChanged):
+
2011-11-08 Dan Bernstein <m...@apple.com>
<rdar://problem/10262225> Allow RenderView to have columns
Modified: trunk/Source/WebCore/platform/ScrollAnimator.cpp (99615 => 99616)
--- trunk/Source/WebCore/platform/ScrollAnimator.cpp 2011-11-08 22:01:16 UTC (rev 99615)
+++ trunk/Source/WebCore/platform/ScrollAnimator.cpp 2011-11-08 22:22:24 UTC (rev 99616)
@@ -77,11 +77,9 @@
void ScrollAnimator::scrollToOffsetWithoutAnimation(const FloatPoint& offset)
{
- if (m_currentPosX != offset.x() || m_currentPosY != offset.y()) {
- m_currentPosX = offset.x();
- m_currentPosY = offset.y();
- notifyPositionChanged();
- }
+ m_currentPosX = offset.x();
+ m_currentPosY = offset.y();
+ notifyPositionChanged();
}
bool ScrollAnimator::handleWheelEvent(const PlatformWheelEvent& e)
Modified: trunk/Source/WebCore/platform/ScrollView.cpp (99615 => 99616)
--- trunk/Source/WebCore/platform/ScrollView.cpp 2011-11-08 22:01:16 UTC (rev 99615)
+++ trunk/Source/WebCore/platform/ScrollView.cpp 2011-11-08 22:22:24 UTC (rev 99616)
@@ -584,9 +584,11 @@
invalidateScrollCornerRect(oldScrollCornerRect);
}
- IntPoint scrollPoint = adjustScrollPositionWithinRange(IntPoint(desiredOffset)) + IntSize(scrollOrigin().x(), scrollOrigin().y());
- if (scrollPoint != scrollPosition())
- ScrollableArea::scrollToOffsetWithoutAnimation(scrollPoint);
+ IntPoint adjustedScrollPosition = adjustScrollPositionWithinRange(IntPoint(desiredOffset));
+ if (adjustedScrollPosition != scrollPosition() || scrollOriginChanged()) {
+ resetScrollOriginChanged();
+ ScrollableArea::scrollToOffsetWithoutAnimation(adjustedScrollPosition + IntSize(scrollOrigin().x(), scrollOrigin().y()));
+ }
// Make sure the scrollbar offsets are up to date.
if (m_horizontalScrollbar)
Modified: trunk/Source/WebCore/platform/ScrollableArea.cpp (99615 => 99616)
--- trunk/Source/WebCore/platform/ScrollableArea.cpp 2011-11-08 22:01:16 UTC (rev 99615)
+++ trunk/Source/WebCore/platform/ScrollableArea.cpp 2011-11-08 22:22:24 UTC (rev 99616)
@@ -48,6 +48,7 @@
, m_verticalScrollElasticity(ScrollElasticityNone)
, m_horizontalScrollElasticity(ScrollElasticityNone)
, m_scrollbarOverlayStyle(ScrollbarOverlayStyleDefault)
+ , m_scrollOriginChanged(false)
{
}
@@ -62,7 +63,31 @@
return m_scrollAnimator.get();
}
+
+void ScrollableArea::setScrollOrigin(const IntPoint& origin)
+{
+ if (m_scrollOrigin != origin) {
+ m_scrollOrigin = origin;
+ m_scrollOriginChanged = true;
+ }
+}
+void ScrollableArea::setScrollOriginX(int x)
+{
+ if (m_scrollOrigin.x() != x) {
+ m_scrollOrigin.setX(x);
+ m_scrollOriginChanged = true;
+ }
+}
+
+void ScrollableArea::setScrollOriginY(int y)
+{
+ if (m_scrollOrigin.y() != y) {
+ m_scrollOrigin.setY(y);
+ m_scrollOriginChanged = true;
+ }
+}
+
bool ScrollableArea::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier)
{
ScrollbarOrientation orientation;
Modified: trunk/Source/WebCore/platform/ScrollableArea.h (99615 => 99616)
--- trunk/Source/WebCore/platform/ScrollableArea.h 2011-11-08 22:01:16 UTC (rev 99615)
+++ trunk/Source/WebCore/platform/ScrollableArea.h 2011-11-08 22:22:24 UTC (rev 99616)
@@ -85,6 +85,7 @@
ScrollAnimator* scrollAnimator() const;
const IntPoint& scrollOrigin() const { return m_scrollOrigin; }
+ bool scrollOriginChanged() const { return m_scrollOriginChanged; }
virtual bool isActive() const = 0;
virtual int scrollSize(ScrollbarOrientation) const = 0;
@@ -165,9 +166,10 @@
void setScrollOffsetFromInternals(const IntPoint&);
protected:
- void setScrollOrigin(const IntPoint& origin) { m_scrollOrigin = origin; }
- void setScrollOriginX(int x) { m_scrollOrigin.setX(x); }
- void setScrollOriginY(int y) { m_scrollOrigin.setY(y); }
+ void setScrollOrigin(const IntPoint&);
+ void setScrollOriginX(int);
+ void setScrollOriginY(int);
+ void resetScrollOriginChanged() { m_scrollOriginChanged = false; }
virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) = 0;
virtual void invalidateScrollCornerRect(const IntRect&) = 0;
@@ -211,6 +213,8 @@
// vertical-rl / ltr YES NO
// vertical-rl / rtl YES YES
IntPoint m_scrollOrigin;
+
+ bool m_scrollOriginChanged;
};
} // namespace WebCore