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

Side by Side Diff: third_party/WebKit/Source/core/dom/IntersectionObserver.cpp

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 #include "core/dom/IntersectionObserver.h" 5 #include "core/dom/IntersectionObserver.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "core/css/parser/CSSParserTokenRange.h" 8 #include "core/css/parser/CSSParserTokenRange.h"
9 #include "core/css/parser/CSSTokenizer.h" 9 #include "core/css/parser/CSSTokenizer.h"
10 #include "core/dom/Element.h"
10 #include "core/dom/ExceptionCode.h" 11 #include "core/dom/ExceptionCode.h"
11 #include "core/dom/ExecutionContext.h" 12 #include "core/dom/ExecutionContext.h"
12 #include "core/dom/IntersectionObserverCallback.h" 13 #include "core/dom/IntersectionObserverCallback.h"
13 #include "core/dom/IntersectionObserverController.h" 14 #include "core/dom/IntersectionObserverController.h"
14 #include "core/dom/IntersectionObserverEntry.h" 15 #include "core/dom/IntersectionObserverEntry.h"
15 #include "core/dom/IntersectionObserverInit.h" 16 #include "core/dom/IntersectionObserverInit.h"
16 #include "core/dom/NodeIntersectionObserverData.h" 17 #include "core/dom/NodeIntersectionObserverData.h"
17 #include "core/html/HTMLFrameOwnerElement.h" 18 #include "core/html/HTMLFrameOwnerElement.h"
18 #include "core/layout/LayoutView.h" 19 #include "core/layout/LayoutView.h"
19 #include "core/timing/DOMWindowPerformance.h" 20 #include "core/timing/DOMWindowPerformance.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 else 109 else
109 thresholds.append(0); 110 thresholds.append(0);
110 if (exceptionState.hadException()) 111 if (exceptionState.hadException())
111 return nullptr; 112 return nullptr;
112 113
113 return new IntersectionObserver(callback, *root, rootMargin, thresholds); 114 return new IntersectionObserver(callback, *root, rootMargin, thresholds);
114 } 115 }
115 116
116 IntersectionObserver::IntersectionObserver(IntersectionObserverCallback& callbac k, Node& root, const Vector<Length>& rootMargin, const Vector<float>& thresholds ) 117 IntersectionObserver::IntersectionObserver(IntersectionObserverCallback& callbac k, Node& root, const Vector<Length>& rootMargin, const Vector<float>& thresholds )
117 : m_callback(&callback) 118 : m_callback(&callback)
119 , m_root(&root)
118 , m_thresholds(thresholds) 120 , m_thresholds(thresholds)
119 , m_topMargin(Fixed) 121 , m_topMargin(Fixed)
120 , m_rightMargin(Fixed) 122 , m_rightMargin(Fixed)
121 , m_bottomMargin(Fixed) 123 , m_bottomMargin(Fixed)
122 , m_leftMargin(Fixed) 124 , m_leftMargin(Fixed)
123 { 125 {
124 if (root.isDocumentNode())
125 m_root = toDocument(root).ensureIntersectionObserverData().createWeakPtr (&root);
126 else
127 m_root = toElement(root).ensureIntersectionObserverData().createWeakPtr( &root);
128 switch (rootMargin.size()) { 126 switch (rootMargin.size()) {
129 case 0: 127 case 0:
130 break; 128 break;
131 case 1: 129 case 1:
132 m_topMargin = m_rightMargin = m_bottomMargin = m_leftMargin = rootMargin [0]; 130 m_topMargin = m_rightMargin = m_bottomMargin = m_leftMargin = rootMargin [0];
133 break; 131 break;
134 case 2: 132 case 2:
135 m_topMargin = m_bottomMargin = rootMargin[0]; 133 m_topMargin = m_bottomMargin = rootMargin[0];
136 m_rightMargin = m_leftMargin = rootMargin[1]; 134 m_rightMargin = m_leftMargin = rootMargin[1];
137 break; 135 break;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 306
309 DEFINE_TRACE(IntersectionObserver) 307 DEFINE_TRACE(IntersectionObserver)
310 { 308 {
311 visitor->template registerWeakMembers<IntersectionObserver, &IntersectionObs erver::clearWeakMembers>(this); 309 visitor->template registerWeakMembers<IntersectionObserver, &IntersectionObs erver::clearWeakMembers>(this);
312 visitor->trace(m_callback); 310 visitor->trace(m_callback);
313 visitor->trace(m_observations); 311 visitor->trace(m_observations);
314 visitor->trace(m_entries); 312 visitor->trace(m_entries);
315 } 313 }
316 314
317 } // namespace blink 315 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698