Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/IntersectionObservation.h |
| diff --git a/third_party/WebKit/Source/core/dom/IntersectionObservation.h b/third_party/WebKit/Source/core/dom/IntersectionObservation.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..24ede0b53eb14987f667f94ba6d218d5dd0b816e |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/dom/IntersectionObservation.h |
| @@ -0,0 +1,54 @@ |
| +// 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. |
| + |
| +#include "platform/geometry/LayoutRect.h" |
| +#include "platform/heap/Handle.h" |
| + |
| +#ifndef IntersectionObservation_h |
| +#define IntersectionObservation_h |
| + |
| +namespace blink { |
| + |
| +class Element; |
| +class IntersectionObserver; |
| + |
| +class IntersectionObservation : public GarbageCollectedFinalized<IntersectionObservation> { |
| +public: |
| + IntersectionObservation(IntersectionObserver&, Element&, bool shouldReportRootBounds); |
| + |
| + struct IntersectionGeometry { |
| + LayoutRect targetRect; |
| + LayoutRect intersectionRect; |
| + LayoutRect rootRect; |
| + }; |
| + |
| + IntersectionObserver& observer() const { return *m_observer; } |
| + Element* target() const { return m_target.get(); } |
| + bool isActive() const { return m_active; } |
| + void setActive(bool active) { m_active = active; } |
| + unsigned lastThresholdIndex() const { return m_lastThresholdIndex; } |
| + void setLastThresholdIndex(unsigned index) { m_lastThresholdIndex = index; } |
| + bool shouldReportRootBounds() const { return m_shouldReportRootBounds; } |
| + |
| + void computeIntersectionObservations(double timestamp); |
| + void disconnect(); |
| + |
| + DECLARE_TRACE(); |
| + |
| +private: |
| + void initializeGeometry(IntersectionGeometry&); |
| + void clipToRoot(LayoutRect&); |
| + void clipToFrameView(IntersectionGeometry&); |
| + bool computeGeometry(IntersectionGeometry&); |
| + |
| + Member<IntersectionObserver> m_observer; |
| + WeakPtrWillBeMember<Element> m_target; |
|
haraken
2016/01/02 13:47:40
Doesn't this need to be a WeakMember?
According t
szager1
2016/01/02 19:18:34
Actually, I agreed with your previous comment :)
haraken
2016/01/03 16:34:20
Thanks, I understand. Then I'd prefer using a Weak
szager1
2016/01/04 03:53:04
Done.
|
| + unsigned m_active : 1; |
| + unsigned m_shouldReportRootBounds : 1; |
| + unsigned m_lastThresholdIndex : 30; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // IntersectionObservation_h |