Chromium Code Reviews| 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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..99de521b22df7dad511fb9d4aea72c1f30e37f9a |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/page/scrolling/SnapCoordinator.h |
| @@ -0,0 +1,52 @@ |
| +// 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 SnapCoordinator_h |
| +#define SnapCoordinator_h |
| + |
| +#include "core/dom/Element.h" |
|
esprehn
2015/12/01 18:31:12
can you forward declare more of this?
majidvp
2015/12/03 17:54:17
Done.
|
| +#include "core/layout/LayoutBox.h" |
| +#include "platform/heap/Handle.h" |
| +#include "platform/scroll/ScrollTypes.h" |
| +#include "wtf/PassRefPtr.h" |
| +#include "wtf/RefCounted.h" |
| +#include "wtf/Vector.h" |
| + |
| +namespace blink { |
| + |
| +class ComputedStyle; |
| +struct LengthPoint; |
| + |
| +// Snap Coordinator keeps track of snap containers and all of their associated |
| +// snap elements. It also contains the logic to generate the final list of snap |
| +// offsets for any snap container. |
| +class CORE_EXPORT SnapCoordinator final : public NoBaseWillBeGarbageCollected<SnapCoordinator> { |
| + WTF_MAKE_NONCOPYABLE(SnapCoordinator); |
| + |
| +public: |
| + static PassOwnPtrWillBeRawPtr<SnapCoordinator> create(); |
| + ~SnapCoordinator(); |
| + DEFINE_INLINE_TRACE() {} |
| + |
| + void snapContainerDidChange(LayoutBox&, ScrollSnapType); |
| + void snapAreaDidChange(LayoutBox&, const Vector<LengthPoint>& snapCoordinates); |
| + |
| +#ifndef NDEBUG |
| + void showSnapAreaMap(); |
| + void showSnapAreasFor(const LayoutBox*); |
| +#endif |
| + |
| +private: |
| + friend class SnapCoordinatorTest; |
| + explicit SnapCoordinator(); |
| + |
| + Vector<double> snapOffsets(const Element&, ScrollbarOrientation); |
| + LayoutBox* findSnapContainer(const LayoutBox&); |
| + |
| + WillBeHeapHashSet<RawPtrWillBeWeakMember<const LayoutBox>> m_snapContainers; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // SnapCoordinator_h |