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

Unified Diff: third_party/WebKit/Source/core/page/scrolling/ScrollState.cpp

Issue 1646663002: Refactor Scroll Customization to share cc::ScrollStateData with blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix linking more. 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/page/scrolling/ScrollState.cpp
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollState.cpp b/third_party/WebKit/Source/core/page/scrolling/ScrollState.cpp
index b462fd9bc49e1df3980ad7317b57ef0f8d82cf44..2ce36362481c2d7082f1c2029091e36d1c475fd8 100644
--- a/third_party/WebKit/Source/core/page/scrolling/ScrollState.cpp
+++ b/third_party/WebKit/Source/core/page/scrolling/ScrollState.cpp
@@ -25,36 +25,35 @@ Element* elementForId(int elementId)
} // namespace
PassRefPtrWillBeRawPtr<ScrollState> ScrollState::create(
- double deltaX, double deltaY, double deltaGranularity, double velocityX,
- double velocityY, bool inInertialPhase,
- bool isBeginning, bool isEnding,
- bool fromUserInput, bool shouldPropagate,
- bool deltaConsumedForScrollSequence)
+ double deltaX, double deltaY, int startPositionX, int startPositionY, double velocityX,
+ double velocityY, bool isBeginning, bool inInertialPhase, bool isEnding,
+ bool shouldPropagate, bool fromUserInput, bool isDirectManipulation,
+ double deltaGranularity, bool deltaConsumedForScrollSequence)
{
- OwnPtr<WebScrollStateData> data(adoptPtr(new WebScrollStateData(deltaX, deltaY, deltaGranularity, velocityX, velocityY,
- inInertialPhase, isBeginning, isEnding, fromUserInput, shouldPropagate,
- deltaConsumedForScrollSequence)));
+ OwnPtr<ScrollStateData> data(adoptPtr(new ScrollStateData(deltaX, deltaY, startPositionX, startPositionY, velocityX, velocityY,
+ isBeginning, inInertialPhase, isEnding, shouldPropagate, fromUserInput,
+ isDirectManipulation, deltaGranularity, deltaConsumedForScrollSequence)));
return adoptRefWillBeNoop(new ScrollState(data.release()));
}
-PassRefPtrWillBeRawPtr<ScrollState> ScrollState::create(PassOwnPtr<WebScrollStateData> data)
+PassRefPtrWillBeRawPtr<ScrollState> ScrollState::create(PassOwnPtr<ScrollStateData> data)
{
ScrollState* scrollState = new ScrollState(data);
return adoptRefWillBeNoop(scrollState);
}
-ScrollState::ScrollState(PassOwnPtr<WebScrollStateData> data)
+ScrollState::ScrollState(PassOwnPtr<ScrollStateData> data)
: m_data(data)
{
}
void ScrollState::consumeDelta(double x, double y, ExceptionState& exceptionState)
{
- if ((m_data->deltaX > 0 && 0 > x) || (m_data->deltaX < 0 && 0 < x) || (m_data->deltaY > 0 && 0 > y) || (m_data->deltaY < 0 && 0 < y)) {
+ if ((m_data->delta_x > 0 && 0 > x) || (m_data->delta_x < 0 && 0 < x) || (m_data->delta_y > 0 && 0 > y) || (m_data->delta_y < 0 && 0 < y)) {
exceptionState.throwDOMException(InvalidModificationError, "Can't increase delta using consumeDelta");
return;
}
- if (fabs(x) > fabs(m_data->deltaX) || fabs(y) > fabs(m_data->deltaY)) {
+ if (fabs(x) > fabs(m_data->delta_x) || fabs(y) > fabs(m_data->delta_y)) {
exceptionState.throwDOMException(InvalidModificationError, "Can't change direction of delta using consumeDelta");
return;
}
@@ -72,33 +71,33 @@ void ScrollState::distributeToScrollChainDescendant()
void ScrollState::consumeDeltaNative(double x, double y)
{
- m_data->deltaX -= x;
- m_data->deltaY -= y;
+ m_data->delta_x -= x;
+ m_data->delta_y -= y;
+ if (x)
+ m_data->caused_scroll_x = true;
+ if (y)
+ m_data->caused_scroll_y = true;
if (x || y)
- m_data->deltaConsumedForScrollSequence = true;
+ m_data->delta_consumed_for_scroll_sequence = true;
}
Element* ScrollState::currentNativeScrollingElement() const
{
- if (m_data->currentNativeScrollingElement == 0)
+ uint64_t elementId = m_data->current_native_scrolling_element();
+ if (elementId == 0)
return nullptr;
- return elementForId(m_data->currentNativeScrollingElement);
+ return elementForId(elementId);
}
void ScrollState::setCurrentNativeScrollingElement(Element* element)
{
- m_data->currentNativeScrollingElement = DOMNodeIds::idForNode(element);
-}
-
-int ScrollState::currentNativeScrollingElementId() const
-{
- return m_data->currentNativeScrollingElement;
+ m_data->set_current_native_scrolling_element(DOMNodeIds::idForNode(element));
}
void ScrollState::setCurrentNativeScrollingElementById(int elementId)
{
- m_data->currentNativeScrollingElement = elementId;
+ m_data->set_current_native_scrolling_element(elementId);
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698