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

Unified Diff: Source/core/page/scrolling/ScrollStateCallback.h

Issue 1057603002: Expose scroll customization for touch to JS (behind REF). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address haraken's comments. Created 5 years, 6 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: Source/core/page/scrolling/ScrollStateCallback.h
diff --git a/Source/core/page/scrolling/ScrollStateCallback.h b/Source/core/page/scrolling/ScrollStateCallback.h
new file mode 100644
index 0000000000000000000000000000000000000000..4a567732471794428093a5660b048964c3102e3f
--- /dev/null
+++ b/Source/core/page/scrolling/ScrollStateCallback.h
@@ -0,0 +1,42 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ScrollStateCallback_h
+#define ScrollStateCallback_h
+
+#include "bindings/core/v8/ScrollStateCallbackToScriptValue.h"
+#include "core/dom/Element.h"
+#include "platform/heap/GarbageCollected.h"
+
+namespace blink {
+
+class ScrollState;
+
+class ScrollStateCallback : public GarbageCollectedFinalized<ScrollStateCallback> {
+public:
+ enum class CallbackType {
+ UNSET,
+ APPLY_SCROLL,
+ DISTRIBUTE_SCROLL,
+ };
+ ScrollStateCallback();
+ virtual ~ScrollStateCallback() {}
+ DEFINE_INLINE_VIRTUAL_TRACE() { visitor->trace(m_targetElement); }
+ virtual void handleEvent(ScrollState*) = 0;
+ void handleEventForElement(Element& targetElement, ScrollState*);
+ ScriptValue toScriptValue(ScriptState* scriptState) { return scrollStateCallbackToScriptValue(*this, scriptState); }
+ CallbackType callbackType() { return m_callbackType; }
+ void setCallbackType(CallbackType callbackType) { m_callbackType = callbackType; }
+
+protected:
+ // Used to pass the target element to handleEvent for native
+ // ScrollStateCallback implementations. Null except within the
+ // scope of |handleEventForElement|.
+ RefPtrWillBeMember<Element> m_targetElement;
+ CallbackType m_callbackType;
+};
+
+} // namespace blink
+
+#endif // ScrollStateCallback_h

Powered by Google App Engine
This is Rietveld 408576698