| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef IntersectionObservation_h | 5 #ifndef IntersectionObservation_h |
| 6 #define IntersectionObservation_h | 6 #define IntersectionObservation_h |
| 7 | 7 |
| 8 #include "core/dom/DOMHighResTimeStamp.h" | 8 #include "core/dom/DOMHighResTimeStamp.h" |
| 9 #include "platform/geometry/LayoutRect.h" | 9 #include "platform/geometry/LayoutRect.h" |
| 10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 IntersectionObservation(IntersectionObserver&, Element&, bool shouldReportRo
otBounds); | 21 IntersectionObservation(IntersectionObserver&, Element&, bool shouldReportRo
otBounds); |
| 22 | 22 |
| 23 struct IntersectionGeometry { | 23 struct IntersectionGeometry { |
| 24 LayoutRect targetRect; | 24 LayoutRect targetRect; |
| 25 LayoutRect intersectionRect; | 25 LayoutRect intersectionRect; |
| 26 LayoutRect rootRect; | 26 LayoutRect rootRect; |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 IntersectionObserver& observer() const { return *m_observer; } | 29 IntersectionObserver& observer() const { return *m_observer; } |
| 30 Element* target() const; | 30 Element* target() const; |
| 31 bool isActive() const { return m_active; } | |
| 32 void setActive(bool active) { m_active = active; } | |
| 33 unsigned lastThresholdIndex() const { return m_lastThresholdIndex; } | 31 unsigned lastThresholdIndex() const { return m_lastThresholdIndex; } |
| 34 void setLastThresholdIndex(unsigned index) { m_lastThresholdIndex = index; } | 32 void setLastThresholdIndex(unsigned index) { m_lastThresholdIndex = index; } |
| 35 bool shouldReportRootBounds() const { return m_shouldReportRootBounds; } | 33 bool shouldReportRootBounds() const { return m_shouldReportRootBounds; } |
| 36 void computeIntersectionObservations(DOMHighResTimeStamp); | 34 void computeIntersectionObservations(DOMHighResTimeStamp); |
| 37 void disconnect(); | 35 void disconnect(); |
| 38 void clearRootAndRemoveFromTarget(); | 36 void clearRootAndRemoveFromTarget(); |
| 39 | 37 |
| 40 DECLARE_TRACE(); | 38 DECLARE_TRACE(); |
| 41 | 39 |
| 42 private: | 40 private: |
| 43 void initializeGeometry(IntersectionGeometry&); | 41 void initializeGeometry(IntersectionGeometry&); |
| 44 void clipToRoot(LayoutRect&); | 42 void clipToRoot(LayoutRect&); |
| 45 void clipToFrameView(IntersectionGeometry&); | 43 void clipToFrameView(IntersectionGeometry&); |
| 46 bool computeGeometry(IntersectionGeometry&); | 44 bool computeGeometry(IntersectionGeometry&); |
| 47 | 45 |
| 48 Member<IntersectionObserver> m_observer; | 46 Member<IntersectionObserver> m_observer; |
| 49 | 47 |
| 50 // TODO(szager): Why Node instead of Element? Because NodeIntersectionObser
verData::createWeakPtr() | 48 // TODO(szager): Why Node instead of Element? Because NodeIntersectionObser
verData::createWeakPtr() |
| 51 // returns a WeakPtr<Node>, which cannot be coerced into a WeakPtr<Element>.
When oilpan rolls out, | 49 // returns a WeakPtr<Node>, which cannot be coerced into a WeakPtr<Element>.
When oilpan rolls out, |
| 52 // this can be changed to WeakMember<Element>. | 50 // this can be changed to WeakMember<Element>. |
| 53 WeakPtrWillBeWeakMember<Node> m_target; | 51 WeakPtrWillBeWeakMember<Node> m_target; |
| 54 | 52 |
| 55 unsigned m_active : 1; | |
| 56 unsigned m_shouldReportRootBounds : 1; | 53 unsigned m_shouldReportRootBounds : 1; |
| 57 unsigned m_lastThresholdIndex : 30; | 54 unsigned m_lastThresholdIndex : 30; |
| 58 }; | 55 }; |
| 59 | 56 |
| 60 } // namespace blink | 57 } // namespace blink |
| 61 | 58 |
| 62 #endif // IntersectionObservation_h | 59 #endif // IntersectionObservation_h |
| OLD | NEW |