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/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class Element; | 13 class Element; |
14 class IntersectionObserver; | 14 class IntersectionObserver; |
15 | 15 |
16 class IntersectionObservation final | 16 class IntersectionObservation final |
17 : public GarbageCollected<IntersectionObservation> { | 17 : public GarbageCollected<IntersectionObservation> { |
18 public: | 18 public: |
19 IntersectionObservation(IntersectionObserver&, | 19 IntersectionObservation(IntersectionObserver&, |
20 Element&, | 20 Element&, |
21 bool shouldReportRootBounds); | 21 bool shouldReportRootBounds); |
22 | 22 |
23 IntersectionObserver* observer() const { return m_observer.get(); } | 23 IntersectionObserver* observer() const { return m_observer.get(); } |
24 Element* target() const { return m_target; } | 24 Element* target() const { return m_target; } |
25 unsigned lastThresholdIndex() const { return m_lastThresholdIndex; } | 25 unsigned lastThresholdIndex() const { return m_lastThresholdIndex; } |
26 void setLastThresholdIndex(unsigned index) { m_lastThresholdIndex = index; } | 26 void setLastThresholdIndex(int index) { m_lastThresholdIndex = index; } |
ojan
2017/01/26 01:44:56
I assume this is leftover from a previous iteratio
szager1
2017/01/30 19:37:41
Yep, thanks for the catch.
| |
27 void computeIntersectionObservations(DOMHighResTimeStamp); | 27 void computeIntersectionObservations(DOMHighResTimeStamp); |
28 void disconnect(); | 28 void disconnect(); |
29 | 29 |
30 DECLARE_TRACE(); | 30 DECLARE_TRACE(); |
31 | 31 |
32 private: | 32 private: |
33 Member<IntersectionObserver> m_observer; | 33 Member<IntersectionObserver> m_observer; |
34 WeakMember<Element> m_target; | 34 WeakMember<Element> m_target; |
35 | 35 |
36 const unsigned m_shouldReportRootBounds : 1; | 36 const unsigned m_shouldReportRootBounds : 1; |
37 | |
38 // HACK: the spec calls for the inital value of m_lastThresholdIndex to be | |
39 // -1. But if m_lastThresholdIndex is changed to a signed int type, then | |
40 // we can't bit-pack it. Instead, inflate all thresholdIndex values by 1. | |
ojan
2017/01/26 01:44:56
Since we're going hacky, how about initializing m_
szager1
2017/01/30 19:37:41
The RELEASE_ASSERT is me being paranoid. This pat
| |
37 unsigned m_lastThresholdIndex : 30; | 41 unsigned m_lastThresholdIndex : 30; |
42 static const unsigned kMaxThresholdIndex = (unsigned)0x40000000; | |
38 }; | 43 }; |
39 | 44 |
40 } // namespace blink | 45 } // namespace blink |
41 | 46 |
42 #endif // IntersectionObservation_h | 47 #endif // IntersectionObservation_h |
OLD | NEW |