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

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

Issue 2272773002: Use intersection observer to control frame throttling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 3 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/Element.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 } 177 }
178 178
179 IntersectionObserver::IntersectionObserver(IntersectionObserverCallback& callbac k, Node& root, const Vector<Length>& rootMargin, const Vector<float>& thresholds ) 179 IntersectionObserver::IntersectionObserver(IntersectionObserverCallback& callbac k, Node& root, const Vector<Length>& rootMargin, const Vector<float>& thresholds )
180 : m_callback(&callback) 180 : m_callback(&callback)
181 , m_root(&root) 181 , m_root(&root)
182 , m_thresholds(thresholds) 182 , m_thresholds(thresholds)
183 , m_topMargin(Fixed) 183 , m_topMargin(Fixed)
184 , m_rightMargin(Fixed) 184 , m_rightMargin(Fixed)
185 , m_bottomMargin(Fixed) 185 , m_bottomMargin(Fixed)
186 , m_leftMargin(Fixed) 186 , m_leftMargin(Fixed)
187 , m_lowLatency(false)
187 { 188 {
188 switch (rootMargin.size()) { 189 switch (rootMargin.size()) {
189 case 0: 190 case 0:
190 break; 191 break;
191 case 1: 192 case 1:
192 m_topMargin = m_rightMargin = m_bottomMargin = m_leftMargin = rootMargin [0]; 193 m_topMargin = m_rightMargin = m_bottomMargin = m_leftMargin = rootMargin [0];
193 break; 194 break;
194 case 2: 195 case 2:
195 m_topMargin = m_bottomMargin = rootMargin[0]; 196 m_topMargin = m_bottomMargin = rootMargin[0];
196 m_rightMargin = m_leftMargin = rootMargin[1]; 197 m_rightMargin = m_leftMargin = rootMargin[1];
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 408
408 DEFINE_TRACE(IntersectionObserver) 409 DEFINE_TRACE(IntersectionObserver)
409 { 410 {
410 visitor->template registerWeakMembers<IntersectionObserver, &IntersectionObs erver::clearWeakMembers>(this); 411 visitor->template registerWeakMembers<IntersectionObserver, &IntersectionObs erver::clearWeakMembers>(this);
411 visitor->trace(m_callback); 412 visitor->trace(m_callback);
412 visitor->trace(m_observations); 413 visitor->trace(m_observations);
413 visitor->trace(m_entries); 414 visitor->trace(m_entries);
414 } 415 }
415 416
416 } // namespace blink 417 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698