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

Unified Diff: third_party/WebKit/Source/core/page/scrolling/SnapCoordinator.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/SnapCoordinator.h
diff --git a/third_party/WebKit/Source/core/page/scrolling/SnapCoordinator.h b/third_party/WebKit/Source/core/page/scrolling/SnapCoordinator.h
index aca6905209fda100ea972fef3eafeb874bafb36c..b435e82c6ea748ab18eca145e7b4097af62a8610 100644
--- a/third_party/WebKit/Source/core/page/scrolling/SnapCoordinator.h
+++ b/third_party/WebKit/Source/core/page/scrolling/SnapCoordinator.h
@@ -17,6 +17,12 @@ class ContainerNode;
class Element;
class LayoutBox;
struct LengthPoint;
+class SnapManager;
+
+struct SnapOffsets {
+ Vector<double> horizontal;
+ Vector<double> vertical;
+};
// Snap Coordinator keeps track of snap containers and all of their associated
// snap areas. It also contains the logic to generate the list of valid snap
@@ -33,15 +39,22 @@ struct LengthPoint;
// For more information see spec: https://drafts.csswg.org/css-snappoints/
class CORE_EXPORT SnapCoordinator final : public GarbageCollectedFinalized<SnapCoordinator> {
WTF_MAKE_NONCOPYABLE(SnapCoordinator);
-
public:
- static SnapCoordinator* create();
+ class Client {
+ public:
+ virtual void didUpdateSnapOffsets(const LayoutBox&, SnapOffsets) = 0;
+ };
+
+ static SnapCoordinator* create(Client*);
~SnapCoordinator();
DEFINE_INLINE_TRACE() {}
void snapContainerDidChange(LayoutBox&, ScrollSnapType);
void snapAreaDidChange(LayoutBox&, const Vector<LengthPoint>& snapCoordinates);
+ void notifyLayoutUpdated();
+ void clear();
+
#ifndef NDEBUG
void showSnapAreaMap();
void showSnapAreasFor(const LayoutBox*);
@@ -49,13 +62,18 @@ public:
private:
friend class SnapCoordinatorTest;
- explicit SnapCoordinator();
+ explicit SnapCoordinator(Client*);
Vector<double> snapOffsets(const ContainerNode&, ScrollbarOrientation);
HashSet<const LayoutBox*> m_snapContainers;
+ HashMap<const LayoutBox*, SnapOffsets> m_offsetMap;
+ Client* m_client;
+
};
+bool operator==(const SnapOffsets&, const SnapOffsets&);
+
} // namespace blink
#endif // SnapCoordinator_h

Powered by Google App Engine
This is Rietveld 408576698