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); | |
19 | |
20 struct IntersectionGeometry { | |
21 LayoutRect targetRect; | |
22 LayoutRect intersectionRect; | |
23 LayoutRect rootRect; | |
24 }; | |
25 | |
26 IntersectionObserver& observer() const { return *m_observer; } | |
27 Element* target() const { return m_target.get(); } | |
28 bool isActive() const { return m_active; } | |
29 void setActive(bool active) { m_active = active; } | |
30 unsigned lastThresholdIndex() const { return m_lastThresholdIndex; } | |
31 void setLastThresholdIndex(unsigned index) { m_lastThresholdIndex = index; } | |
32 bool shouldReportRootBounds() const { return m_shouldReportRootBounds; } | |
33 | |
34 void computeIntersectionObservations(double timestamp); | |
35 void disconnect(); | |
36 | |
37 DECLARE_TRACE(); | |
38 | |
39 private: | |
40 void initializeGeometry(IntersectionGeometry&); | |
41 void clipToRoot(LayoutRect&); | |
42 void clipToFrameView(IntersectionGeometry&); | |
43 bool computeGeometry(IntersectionGeometry&); | |
44 | |
45 Member<IntersectionObserver> m_observer; | |
46 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.
| |
47 unsigned m_active : 1; | |
48 unsigned m_shouldReportRootBounds : 1; | |
49 unsigned m_lastThresholdIndex : 30; | |
50 }; | |
51 | |
52 } // namespace blink | |
53 | |
54 #endif // IntersectionObservation_h | |
OLD | NEW |