Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "platform/geometry/LayoutRect.h" | |
| 6 #include "platform/heap/Handle.h" | |
| 7 | |
| 8 #ifndef IntersectionObservation_h | |
| 9 #define IntersectionObservation_h | |
| 10 | |
| 11 namespace blink { | |
| 12 | |
| 13 class Element; | |
| 14 class IntersectionObserver; | |
| 15 | |
| 16 class IntersectionObservation : public GarbageCollectedFinalized<IntersectionObs ervation> { | |
| 17 public: | |
| 18 IntersectionObservation(IntersectionObserver&, Element&, bool shouldReportRo otBounds); | |
|
haraken
2015/12/22 01:13:30
Can we add a destructor and add ASSERT(!m_target)?
szager1
2015/12/22 07:53:41
It should be OK to destruct an IntersectionObserva
| |
| 19 | |
| 20 struct IntersectionGeometry { | |
| 21 LayoutRect targetRect; | |
| 22 LayoutRect intersectionRect; | |
| 23 LayoutRect rootRect; | |
| 24 }; | |
| 25 | |
| 26 const IntersectionObserver* observer() const { return m_observer; } | |
| 27 IntersectionObserver* observer() { return m_observer; } | |
|
esprehn
2015/12/22 07:50:32
can these ever be null?
szager1
2015/12/22 08:49:50
No, switched to reference.
| |
| 28 const Element* target() const { return m_target.get(); } | |
| 29 Element* target() { return m_target.get(); } | |
| 30 bool isActive() const { return m_active; } | |
| 31 void setActive(bool active) { m_active = active; } | |
| 32 unsigned lastThresholdIndex() const { return m_lastThresholdIndex; } | |
| 33 void setLastThresholdIndex(unsigned index) { m_lastThresholdIndex = index; } | |
| 34 bool shouldReportRootBounds() const { return m_shouldReportRootBounds; } | |
| 35 | |
| 36 void computeIntersectionObservations(double timestamp); | |
| 37 void disconnect(); | |
| 38 | |
| 39 DECLARE_TRACE(); | |
| 40 | |
| 41 private: | |
| 42 void initializeGeometry(IntersectionGeometry&); | |
| 43 void clipToRoot(LayoutRect&); | |
| 44 void clipToFrameView(IntersectionGeometry&); | |
| 45 bool computeGeometry(IntersectionGeometry&); | |
| 46 | |
| 47 Member<IntersectionObserver> m_observer; | |
| 48 WeakPtrWillBeWeakMember<Element> m_target; | |
|
haraken
2015/12/22 01:13:30
In oilpan, why does this need to be a WeakMember?
szager1
2015/12/22 07:53:41
The IntersectionObservation should not
| |
| 49 unsigned m_active : 1; | |
| 50 unsigned m_shouldReportRootBounds : 1; | |
| 51 unsigned m_lastThresholdIndex : 30; | |
| 52 }; | |
| 53 | |
| 54 } // namespace blink { | |
| 55 | |
| 56 #endif // IntersectionObservation_h | |
| OLD | NEW |