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

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

Issue 1580783003: Revert of Use Document, rather than document element, for implicit root. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@intersection-observer
Patch Set: 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;
16 15
17 class IntersectionObservation : public GarbageCollectedFinalized<IntersectionObs ervation> { 16 class IntersectionObservation : public GarbageCollectedFinalized<IntersectionObs ervation> {
18 public: 17 public:
19 IntersectionObservation(IntersectionObserver&, Element&, bool shouldReportRo otBounds); 18 IntersectionObservation(IntersectionObserver&, Element&, bool shouldReportRo otBounds);
20 19
21 struct IntersectionGeometry { 20 struct IntersectionGeometry {
22 LayoutRect targetRect; 21 LayoutRect targetRect;
23 LayoutRect intersectionRect; 22 LayoutRect intersectionRect;
24 LayoutRect rootRect; 23 LayoutRect rootRect;
25 }; 24 };
26 25
27 IntersectionObserver& observer() const { return *m_observer; } 26 IntersectionObserver& observer() const { return *m_observer; }
28 Element* target() const; 27 Element* target() const { return m_target.get(); }
29 bool isActive() const { return m_active; } 28 bool isActive() const { return m_active; }
30 void setActive(bool active) { m_active = active; } 29 void setActive(bool active) { m_active = active; }
31 unsigned lastThresholdIndex() const { return m_lastThresholdIndex; } 30 unsigned lastThresholdIndex() const { return m_lastThresholdIndex; }
32 void setLastThresholdIndex(unsigned index) { m_lastThresholdIndex = index; } 31 void setLastThresholdIndex(unsigned index) { m_lastThresholdIndex = index; }
33 bool shouldReportRootBounds() const { return m_shouldReportRootBounds; } 32 bool shouldReportRootBounds() const { return m_shouldReportRootBounds; }
34 33
35 void computeIntersectionObservations(double timestamp); 34 void computeIntersectionObservations(double timestamp);
36 void disconnect(); 35 void disconnect();
37 36
38 DECLARE_TRACE(); 37 DECLARE_TRACE();
39 38
40 private: 39 private:
41 void initializeGeometry(IntersectionGeometry&); 40 void initializeGeometry(IntersectionGeometry&);
42 void clipToRoot(LayoutRect&); 41 void clipToRoot(LayoutRect&);
43 void clipToFrameView(IntersectionGeometry&); 42 void clipToFrameView(IntersectionGeometry&);
44 bool computeGeometry(IntersectionGeometry&); 43 bool computeGeometry(IntersectionGeometry&);
45 44
46 Member<IntersectionObserver> m_observer; 45 Member<IntersectionObserver> m_observer;
47 46 WeakPtrWillBeWeakMember<Element> m_target;
48 // TODO(szager): Why Node instead of Element? Because NodeIntersectionObser verData::createWeakPtr()
49 // returns a WeakPtr<Node>, which cannot be coerced into a WeakPtr<Element>. When oilpan rolls out,
50 // this can be changed to WeakMember<Element>.
51 WeakPtrWillBeWeakMember<Node> m_target;
52
53 unsigned m_active : 1; 47 unsigned m_active : 1;
54 unsigned m_shouldReportRootBounds : 1; 48 unsigned m_shouldReportRootBounds : 1;
55 unsigned m_lastThresholdIndex : 30; 49 unsigned m_lastThresholdIndex : 30;
56 }; 50 };
57 51
58 } // namespace blink 52 } // namespace blink
59 53
60 #endif // IntersectionObservation_h 54 #endif // IntersectionObservation_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ElementRareData.h ('k') | third_party/WebKit/Source/core/dom/IntersectionObservation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698