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

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

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. 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.h
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollState.h b/third_party/WebKit/Source/core/page/scrolling/ScrollState.h
index 78425dd0dc05bce6e2b61a85feee45d10f0df96a..d38e3cf9e813e04f0eebe76fbc00c5bb4329c111 100644
--- a/third_party/WebKit/Source/core/page/scrolling/ScrollState.h
+++ b/third_party/WebKit/Source/core/page/scrolling/ScrollState.h
@@ -9,7 +9,9 @@
#include "bindings/core/v8/ScriptWrappable.h"
#include "core/CoreExport.h"
#include "core/dom/Element.h"
-#include "public/platform/WebScrollStateData.h"
+#include "core/page/scrolling/ScrollStateInit.h"
+#include "platform/scroll/ScrollStateData.h"
+#include <deque>
namespace blink {
@@ -17,14 +19,8 @@ class CORE_EXPORT ScrollState final : public RefCountedWillBeGarbageCollectedFin
DEFINE_WRAPPERTYPEINFO();
public:
- static PassRefPtrWillBeRawPtr<ScrollState> create(
- double deltaX, double deltaY, double deltaGranularity, double velocityX,
- double velocityY, bool inInertialPhase,
- bool isBeginning = false, bool isEnding = false,
- bool fromUserInput = false, bool shouldPropagate = true,
- bool deltaConsumedForScrollSequence = false);
-
- static PassRefPtrWillBeRawPtr<ScrollState> create(PassOwnPtr<WebScrollStateData>);
+ static PassRefPtrWillBeRawPtr<ScrollState> create(ScrollStateInit);
+ static PassRefPtrWillBeRawPtr<ScrollState> create(PassOwnPtr<ScrollStateData>);
~ScrollState()
{
@@ -36,26 +32,31 @@ public:
void consumeDelta(double x, double y, ExceptionState&);
// Pops the first element off of |m_scrollChain| and calls |distributeScroll| on it.
void distributeToScrollChainDescendant();
+ int startPositionX() { return m_data->start_position_x; };
+ int startPositionY() { return m_data->start_position_y; };
// Positive when scrolling left.
- double deltaX() const { return m_data->deltaX; };
+ double deltaX() const { return m_data->delta_x; };
// Positive when scrolling up.
- double deltaY() const { return m_data->deltaY; };
+ double deltaY() const { return m_data->delta_y; };
// Indicates the smallest delta the input device can produce. 0 for unquantized inputs.
- double deltaGranularity() const { return m_data->deltaGranularity; };
+ double deltaGranularity() const { return m_data->delta_granularity; };
// Positive if moving right.
- double velocityX() const { return m_data->velocityX; };
+ double velocityX() const { return m_data->velocity_x; };
// Positive if moving down.
- double velocityY() const { return m_data->velocityY; };
+ double velocityY() const { return m_data->velocity_y; };
// True for events dispatched after the users's gesture has finished.
- bool inInertialPhase() const { return m_data->inInertialPhase; };
+ bool inInertialPhase() const { return m_data->is_in_inertial_phase; };
// True if this is the first event for this scroll.
- bool isBeginning() const { return m_data->isBeginning; };
+ bool isBeginning() const { return m_data->is_beginning; };
// True if this is the last event for this scroll.
- bool isEnding() const { return m_data->isEnding; };
+ bool isEnding() const { return m_data->is_ending; };
// True if this scroll is the direct result of user input.
- bool fromUserInput() const { return m_data->fromUserInput; };
+ bool fromUserInput() const { return m_data->from_user_input; };
+ // True if this scroll is the result of the user interacting directly with
+ // the screen, e.g., via touch.
+ bool isDirectManipulation() const { return m_data->is_direct_manipulation; }
// True if this scroll is allowed to bubble upwards.
- bool shouldPropagate() const { return m_data->shouldPropagate; };
+ bool shouldPropagate() const { return m_data->should_propagate; };
// Non web exposed methods.
void consumeDeltaNative(double x, double y);
@@ -69,47 +70,28 @@ public:
Element* currentNativeScrollingElement() const;
void setCurrentNativeScrollingElement(Element*);
- int currentNativeScrollingElementId() const;
void setCurrentNativeScrollingElementById(int elementId);
bool deltaConsumedForScrollSequence() const
{
- return m_data->deltaConsumedForScrollSequence;
+ return m_data->delta_consumed_for_scroll_sequence;
}
// Scroll begin and end must propagate to all nodes to ensure
// their state is updated.
bool fullyConsumed() const
{
- return !m_data->deltaX && !m_data->deltaY && !m_data->isEnding && !m_data->isBeginning;
- }
-
- // These are only used for CompositorWorker scrolling, and should be gotten
- // rid of eventually.
- void setCausedScroll(bool x, bool y)
- {
- m_data->causedScrollX = x;
- m_data->causedScrollY = y;
- }
-
- bool causedScrollX() const
- {
- return m_data->causedScrollX;
- }
-
- bool causedScrollY() const
- {
- return m_data->causedScrollY;
+ return !m_data->delta_x && !m_data->delta_y && !m_data->is_ending && !m_data->is_beginning;
}
- WebScrollStateData* data() const { return m_data.get(); }
+ ScrollStateData* data() const { return m_data.get(); }
DEFINE_INLINE_TRACE() {}
private:
ScrollState();
- ScrollState(PassOwnPtr<WebScrollStateData>);
- PassOwnPtr<WebScrollStateData> m_data;
+ ScrollState(PassOwnPtr<ScrollStateData>);
+ PassOwnPtr<ScrollStateData> m_data;
std::deque<int> m_scrollChain;
};
« no previous file with comments | « third_party/WebKit/Source/core/input/EventHandler.cpp ('k') | third_party/WebKit/Source/core/page/scrolling/ScrollState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698