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

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

Issue 1613543002: Use DOMHighResTimeStamp for notification time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: syntax error in test Created 4 years, 10 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 "platform/geometry/LayoutRect.h" 9 #include "platform/geometry/LayoutRect.h"
9 #include "platform/heap/Handle.h" 10 #include "platform/heap/Handle.h"
10 11
11 namespace blink { 12 namespace blink {
12 13
13 class Element; 14 class Element;
14 class IntersectionObserver; 15 class IntersectionObserver;
15 class Node; 16 class Node;
16 17
17 // TODO(oilpan): Switch to GarbageCollected<> after oilpan ships. 18 // TODO(oilpan): Switch to GarbageCollected<> after oilpan ships.
18 class IntersectionObservation : public GarbageCollectedFinalized<IntersectionObs ervation> { 19 class IntersectionObservation : public GarbageCollectedFinalized<IntersectionObs ervation> {
19 public: 20 public:
20 IntersectionObservation(IntersectionObserver&, Element&, bool shouldReportRo otBounds); 21 IntersectionObservation(IntersectionObserver&, Element&, bool shouldReportRo otBounds);
21 22
22 struct IntersectionGeometry { 23 struct IntersectionGeometry {
23 LayoutRect targetRect; 24 LayoutRect targetRect;
24 LayoutRect intersectionRect; 25 LayoutRect intersectionRect;
25 LayoutRect rootRect; 26 LayoutRect rootRect;
26 }; 27 };
27 28
28 IntersectionObserver& observer() const { return *m_observer; } 29 IntersectionObserver& observer() const { return *m_observer; }
29 Element* target() const; 30 Element* target() const;
30 bool isActive() const { return m_active; } 31 bool isActive() const { return m_active; }
31 void setActive(bool active) { m_active = active; } 32 void setActive(bool active) { m_active = active; }
32 unsigned lastThresholdIndex() const { return m_lastThresholdIndex; } 33 unsigned lastThresholdIndex() const { return m_lastThresholdIndex; }
33 void setLastThresholdIndex(unsigned index) { m_lastThresholdIndex = index; } 34 void setLastThresholdIndex(unsigned index) { m_lastThresholdIndex = index; }
34 bool shouldReportRootBounds() const { return m_shouldReportRootBounds; } 35 bool shouldReportRootBounds() const { return m_shouldReportRootBounds; }
35 void computeIntersectionObservations(double timestamp); 36 void computeIntersectionObservations(DOMHighResTimeStamp);
36 void disconnect(); 37 void disconnect();
37 void clearRootAndRemoveFromTarget(); 38 void clearRootAndRemoveFromTarget();
38 39
39 DECLARE_TRACE(); 40 DECLARE_TRACE();
40 41
41 private: 42 private:
42 void initializeGeometry(IntersectionGeometry&); 43 void initializeGeometry(IntersectionGeometry&);
43 void clipToRoot(LayoutRect&); 44 void clipToRoot(LayoutRect&);
44 void clipToFrameView(IntersectionGeometry&); 45 void clipToFrameView(IntersectionGeometry&);
45 bool computeGeometry(IntersectionGeometry&); 46 bool computeGeometry(IntersectionGeometry&);
46 47
47 Member<IntersectionObserver> m_observer; 48 Member<IntersectionObserver> m_observer;
48 49
49 // TODO(szager): Why Node instead of Element? Because NodeIntersectionObser verData::createWeakPtr() 50 // TODO(szager): Why Node instead of Element? Because NodeIntersectionObser verData::createWeakPtr()
50 // returns a WeakPtr<Node>, which cannot be coerced into a WeakPtr<Element>. When oilpan rolls out, 51 // returns a WeakPtr<Node>, which cannot be coerced into a WeakPtr<Element>. When oilpan rolls out,
51 // this can be changed to WeakMember<Element>. 52 // this can be changed to WeakMember<Element>.
52 WeakPtrWillBeWeakMember<Node> m_target; 53 WeakPtrWillBeWeakMember<Node> m_target;
53 54
54 unsigned m_active : 1; 55 unsigned m_active : 1;
55 unsigned m_shouldReportRootBounds : 1; 56 unsigned m_shouldReportRootBounds : 1;
56 unsigned m_lastThresholdIndex : 30; 57 unsigned m_lastThresholdIndex : 30;
57 }; 58 };
58 59
59 } // namespace blink 60 } // namespace blink
60 61
61 #endif // IntersectionObservation_h 62 #endif // IntersectionObservation_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698