Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: third_party/WebKit/Source/core/dom/IntersectionObservation.h

Issue 1548523002: Use Document, rather than document element, for implicit root. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@intersection-observer
Patch Set: rebaseline Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "platform/geometry/LayoutRect.h" 8 #include "platform/geometry/LayoutRect.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 class Node;
15 16
16 class IntersectionObservation : public GarbageCollectedFinalized<IntersectionObs ervation> { 17 class IntersectionObservation : public GarbageCollectedFinalized<IntersectionObs ervation> {
17 public: 18 public:
18 IntersectionObservation(IntersectionObserver&, Element&, bool shouldReportRo otBounds); 19 IntersectionObservation(IntersectionObserver&, Element&, bool shouldReportRo otBounds);
19 20
20 struct IntersectionGeometry { 21 struct IntersectionGeometry {
21 LayoutRect targetRect; 22 LayoutRect targetRect;
22 LayoutRect intersectionRect; 23 LayoutRect intersectionRect;
23 LayoutRect rootRect; 24 LayoutRect rootRect;
24 }; 25 };
25 26
26 IntersectionObserver& observer() const { return *m_observer; } 27 IntersectionObserver& observer() const { return *m_observer; }
27 Element* target() const { return m_target.get(); } 28 Element* target() const;
28 bool isActive() const { return m_active; } 29 bool isActive() const { return m_active; }
29 void setActive(bool active) { m_active = active; } 30 void setActive(bool active) { m_active = active; }
30 unsigned lastThresholdIndex() const { return m_lastThresholdIndex; } 31 unsigned lastThresholdIndex() const { return m_lastThresholdIndex; }
31 void setLastThresholdIndex(unsigned index) { m_lastThresholdIndex = index; } 32 void setLastThresholdIndex(unsigned index) { m_lastThresholdIndex = index; }
32 bool shouldReportRootBounds() const { return m_shouldReportRootBounds; } 33 bool shouldReportRootBounds() const { return m_shouldReportRootBounds; }
33 34
34 void computeIntersectionObservations(double timestamp); 35 void computeIntersectionObservations(double timestamp);
35 void disconnect(); 36 void disconnect();
36 37
37 DECLARE_TRACE(); 38 DECLARE_TRACE();
38 39
39 private: 40 private:
40 void initializeGeometry(IntersectionGeometry&); 41 void initializeGeometry(IntersectionGeometry&);
41 void clipToRoot(LayoutRect&); 42 void clipToRoot(LayoutRect&);
42 void clipToFrameView(IntersectionGeometry&); 43 void clipToFrameView(IntersectionGeometry&);
43 bool computeGeometry(IntersectionGeometry&); 44 bool computeGeometry(IntersectionGeometry&);
44 45
45 Member<IntersectionObserver> m_observer; 46 Member<IntersectionObserver> m_observer;
46 WeakPtrWillBeWeakMember<Element> m_target; 47 WeakPtrWillBeWeakMember<Node> m_target;
ojan 2016/01/12 01:28:18 Isn't target still always an Element?
szager1 2016/01/12 21:19:51 Yeah, this weird, but this comes from NodeIntersec
47 unsigned m_active : 1; 48 unsigned m_active : 1;
48 unsigned m_shouldReportRootBounds : 1; 49 unsigned m_shouldReportRootBounds : 1;
49 unsigned m_lastThresholdIndex : 30; 50 unsigned m_lastThresholdIndex : 30;
50 }; 51 };
51 52
52 } // namespace blink 53 } // namespace blink
53 54
54 #endif // IntersectionObservation_h 55 #endif // IntersectionObservation_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698