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

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

Issue 1870963002: Clean up CompositorPendingAnimations inclusion. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 "core/dom/DOMHighResTimeStamp.h" 8 #include "core/dom/DOMHighResTimeStamp.h"
9 #include "platform/geometry/LayoutRect.h" 9 #include "platform/geometry/LayoutRect.h"
10 #include "platform/heap/Handle.h" 10 #include "platform/heap/Handle.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 class Element; 14 class Element;
15 class IntersectionObserver; 15 class IntersectionObserver;
16 class Node;
17 16
18 // TODO(oilpan): Switch to GarbageCollected<> after oilpan ships. 17 class IntersectionObservation final : public GarbageCollected<IntersectionObserv ation> {
19 class IntersectionObservation : public GarbageCollectedFinalized<IntersectionObs ervation> {
20 public: 18 public:
21 IntersectionObservation(IntersectionObserver&, Element&, bool shouldReportRo otBounds); 19 IntersectionObservation(IntersectionObserver&, Element&, bool shouldReportRo otBounds);
22 20
23 struct IntersectionGeometry { 21 struct IntersectionGeometry {
24 LayoutRect targetRect; 22 LayoutRect targetRect;
25 LayoutRect intersectionRect; 23 LayoutRect intersectionRect;
26 LayoutRect rootRect; 24 LayoutRect rootRect;
27 bool doesIntersect; 25 bool doesIntersect;
28 }; 26 };
29 27
30 IntersectionObserver& observer() const { return *m_observer; } 28 IntersectionObserver& observer() const { return *m_observer; }
31 Element* target() const; 29 Element* target() const { return m_target; }
32 unsigned lastThresholdIndex() const { return m_lastThresholdIndex; } 30 unsigned lastThresholdIndex() const { return m_lastThresholdIndex; }
33 void setLastThresholdIndex(unsigned index) { m_lastThresholdIndex = index; } 31 void setLastThresholdIndex(unsigned index) { m_lastThresholdIndex = index; }
34 bool shouldReportRootBounds() const { return m_shouldReportRootBounds; } 32 bool shouldReportRootBounds() const { return m_shouldReportRootBounds; }
35 void computeIntersectionObservations(DOMHighResTimeStamp); 33 void computeIntersectionObservations(DOMHighResTimeStamp);
36 void disconnect(); 34 void disconnect();
37 void clearRootAndRemoveFromTarget(); 35 void clearRootAndRemoveFromTarget();
38 36
39 DECLARE_TRACE(); 37 DECLARE_TRACE();
40 38
41 private: 39 private:
42 void applyRootMargin(LayoutRect&) const; 40 void applyRootMargin(LayoutRect&) const;
43 void initializeGeometry(IntersectionGeometry&) const; 41 void initializeGeometry(IntersectionGeometry&) const;
44 void initializeTargetRect(LayoutRect&) const; 42 void initializeTargetRect(LayoutRect&) const;
45 void initializeRootRect(LayoutRect&) const; 43 void initializeRootRect(LayoutRect&) const;
46 void clipToRoot(IntersectionGeometry&) const; 44 void clipToRoot(IntersectionGeometry&) const;
47 void mapTargetRectToTargetFrameCoordinates(LayoutRect&) const; 45 void mapTargetRectToTargetFrameCoordinates(LayoutRect&) const;
48 void mapRootRectToRootFrameCoordinates(LayoutRect&) const; 46 void mapRootRectToRootFrameCoordinates(LayoutRect&) const;
49 void mapRootRectToTargetFrameCoordinates(LayoutRect&) const; 47 void mapRootRectToTargetFrameCoordinates(LayoutRect&) const;
50 bool computeGeometry(IntersectionGeometry&) const; 48 bool computeGeometry(IntersectionGeometry&) const;
51 49
52 Member<IntersectionObserver> m_observer; 50 Member<IntersectionObserver> m_observer;
53 51
54 // TODO(szager): Why Node instead of Element? Because NodeIntersectionObser verData::createWeakPtr() 52 WeakMember<Element> m_target;
55 // returns a WeakPtr<Node>, which cannot be coerced into a WeakPtr<Element>. When oilpan rolls out,
56 // this can be changed to WeakMember<Element>.
57 WeakMember<Node> m_target;
58 53
59 unsigned m_shouldReportRootBounds : 1; 54 unsigned m_shouldReportRootBounds : 1;
60 unsigned m_lastThresholdIndex : 30; 55 unsigned m_lastThresholdIndex : 30;
61 }; 56 };
62 57
63 } // namespace blink 58 } // namespace blink
64 59
65 #endif // IntersectionObservation_h 60 #endif // IntersectionObservation_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/DocumentParser.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