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

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

Issue 1755773002: Pass the physical scroll delta through the scroll customization path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@removeOneDimensionalScrolls
Patch Set: Updated LayoutTest Created 4 years, 10 months 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/TopControls.cpp
diff --git a/third_party/WebKit/Source/core/frame/TopControls.cpp b/third_party/WebKit/Source/core/frame/TopControls.cpp
index f11dbe4b4d579ce1234d42f93cc8523ccfd5251f..bfe1f85e9927f951be0c9855c2f92c04f34ed9a7 100644
--- a/third_party/WebKit/Source/core/frame/TopControls.cpp
+++ b/third_party/WebKit/Source/core/frame/TopControls.cpp
@@ -38,7 +38,7 @@ void TopControls::scrollBegin()
FloatSize TopControls::scrollBy(FloatSize pendingDelta)
{
- if ((m_permittedState == WebTopControlsShown && pendingDelta.height() < 0) || (m_permittedState == WebTopControlsHidden && pendingDelta.height() > 0))
+ if ((m_permittedState == WebTopControlsShown && pendingDelta.height() > 0) || (m_permittedState == WebTopControlsHidden && pendingDelta.height() < 0))
return pendingDelta;
if (m_height == 0)
@@ -51,7 +51,7 @@ FloatSize TopControls::scrollBy(FloatSize pendingDelta)
// Compute scroll delta in viewport space by applying page scale
m_accumulatedScrollDelta += pendingDelta.height() * pageScale;
- float newContentOffset = m_baselineContentOffset + m_accumulatedScrollDelta;
+ float newContentOffset = m_baselineContentOffset - m_accumulatedScrollDelta;
setShownRatio(newContentOffset / m_height);
@@ -64,7 +64,9 @@ FloatSize TopControls::scrollBy(FloatSize pendingDelta)
newContentOffset = std::min(newContentOffset, m_height);
newContentOffset = std::max(newContentOffset, 0.f);
- FloatSize appliedDelta(0, (newContentOffset - oldOffset) / pageScale);
+ // We negate the difference because scrolling down (positive delta) causes
+ // top controls to hide (negative offset difference).
+ FloatSize appliedDelta(0, (oldOffset - newContentOffset) / pageScale);
return pendingDelta - appliedDelta;
}
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalFrame.cpp ('k') | third_party/WebKit/Source/core/input/EventHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698