Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(452)

Unified Diff: third_party/WebKit/Source/core/frame/RootFrameViewport.cpp

Issue 1509783002: Revert of Remove invert viewport scroll order setting from Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/frame/RootFrameViewport.cpp
diff --git a/third_party/WebKit/Source/core/frame/RootFrameViewport.cpp b/third_party/WebKit/Source/core/frame/RootFrameViewport.cpp
index 194af5574d30cd53575ff8ff06eaa863f27ae660..6bc56742629f03c8eac56ce52cf05704c2ab6741 100644
--- a/third_party/WebKit/Source/core/frame/RootFrameViewport.cpp
+++ b/third_party/WebKit/Source/core/frame/RootFrameViewport.cpp
@@ -13,9 +13,10 @@
namespace blink {
-RootFrameViewport::RootFrameViewport(ScrollableArea& visualViewport, ScrollableArea& layoutViewport)
+RootFrameViewport::RootFrameViewport(ScrollableArea& visualViewport, ScrollableArea& layoutViewport, bool invertScrollOrder)
: m_visualViewport(visualViewport)
, m_layoutViewport(layoutViewport)
+ , m_invertScrollOrder(invertScrollOrder)
{
}
@@ -140,22 +141,23 @@
if (delta.isZero())
return;
- DoublePoint targetPosition = visualViewport().clampScrollPosition(
- visualViewport().scrollAnimator()->currentPosition() + delta);
-
- visualViewport().setScrollPosition(targetPosition, scrollType, behavior);
-
- // Scroll the layout viewport if all of the scroll was not applied to the
- // visual viewport.
- DoublePoint updatedPosition = layoutViewport().scrollAnimator()->currentPosition() + FloatPoint(targetPosition);
+ ScrollableArea& primary = !m_invertScrollOrder ? layoutViewport() : visualViewport();
+ ScrollableArea& secondary = !m_invertScrollOrder ? visualViewport() : layoutViewport();
+
+ DoublePoint targetPosition = primary.clampScrollPosition(primary.scrollAnimator()->currentPosition() + delta);
+ primary.setScrollPosition(targetPosition, scrollType, behavior);
+
+ // Scroll the secondary viewport if all of the scroll was not applied to the
+ // primary viewport.
+ DoublePoint updatedPosition = secondary.scrollAnimator()->currentPosition() + FloatPoint(targetPosition);
DoubleSize applied = updatedPosition - oldPosition;
delta -= applied;
if (delta.isZero())
return;
- targetPosition = layoutViewport().clampScrollPosition(layoutViewport().scrollAnimator()->currentPosition() + delta);
- layoutViewport().setScrollPosition(targetPosition, scrollType, behavior);
+ targetPosition = secondary.clampScrollPosition(secondary.scrollAnimator()->currentPosition() + delta);
+ secondary.setScrollPosition(targetPosition, scrollType, behavior);
}
IntPoint RootFrameViewport::scrollPosition() const

Powered by Google App Engine
This is Rietveld 408576698