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

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

Issue 1333323003: SnapManager implementation using V8 Extras - {WIP} Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update with latest master Created 4 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: third_party/WebKit/Source/core/page/scrolling/snap/SnapManagerBridge.h
diff --git a/third_party/WebKit/Source/core/page/scrolling/snap/SnapManagerBridge.h b/third_party/WebKit/Source/core/page/scrolling/snap/SnapManagerBridge.h
new file mode 100644
index 0000000000000000000000000000000000000000..3d5a086cc1aa8b1812744cf7960e679b8ebc23a9
--- /dev/null
+++ b/third_party/WebKit/Source/core/page/scrolling/snap/SnapManagerBridge.h
@@ -0,0 +1,54 @@
+// Copyright 2014 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 SnapManagerBridge_h
+#define SnapManagerBridge_h
+
+#include "bindings/core/v8/ScriptValue.h"
+#include "core/page/scrolling/SnapCoordinator.h"
+#include "platform/heap/Handle.h"
+#include "wtf/RefCounted.h"
+#include "wtf/Vector.h"
+
+namespace blink {
+
+class Document;
+class Node;
+class Element;
+class ScriptValue;
+
+// Represents the PrivateScript implementation of snap manager.
+class CORE_EXPORT SnapManagerBridge : public GarbageCollectedFinalized<SnapManagerBridge>, public SnapCoordinator::Client {
+public:
+ static SnapManagerBridge* create(const Document* document)
+ {
+ return new SnapManagerBridge(document);
+ }
+ virtual ~SnapManagerBridge() {}
+
+ // Delegates to implementation in private script
+ void didUpdateSnapOffsets(const LayoutBox&, SnapOffsets) override;
+
+ // Invoked from private script
+ Vector<Element*> getUpdatedSnapContainers();
+
+ DEFINE_INLINE_TRACE()
+ {
+ visitor->trace(m_document);
+ }
+
+private:
+ explicit SnapManagerBridge(const Document*);
+ Member<const Document> m_document;
+ RefPtr<ScriptState> m_scriptState;
+
+ // The snap manager instance
+ ScriptValue m_instance;
+
+ void maybeCreateSnapManagerInstance();
+};
+
+} // namespace blink
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698