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

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

Issue 2298933003: [IntersectionObserver] Enable observations across shadow DOM roots. (Closed)
Patch Set: 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
« no previous file with comments | « third_party/WebKit/LayoutTests/intersection-observer/shadow-content-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 242
243 if (target->ensureIntersectionObserverData().getObservationFor(*this)) 243 if (target->ensureIntersectionObserverData().getObservationFor(*this))
244 return; 244 return;
245 bool shouldReportRootBounds = false; 245 bool shouldReportRootBounds = false;
246 bool isDOMDescendant = false; 246 bool isDOMDescendant = false;
247 LocalFrame* targetFrame = target->document().frame(); 247 LocalFrame* targetFrame = target->document().frame();
248 LocalFrame* rootFrame = m_root->document().frame(); 248 LocalFrame* rootFrame = m_root->document().frame();
249 249
250 if (target->document() == rootNode()->document()) { 250 if (target->document() == rootNode()->document()) {
251 shouldReportRootBounds = true; 251 shouldReportRootBounds = true;
252 isDOMDescendant = target->isDescendantOf(rootNode()); 252 isDOMDescendant = rootNode()->isShadowIncludingInclusiveAncestorOf(targe t);
253 } else if (targetFrame && rootFrame) { 253 } else if (targetFrame && rootFrame) {
254 shouldReportRootBounds = targetFrame->securityContext()->getSecurityOrig in()->canAccess(rootFrame->securityContext()->getSecurityOrigin()); 254 shouldReportRootBounds = targetFrame->securityContext()->getSecurityOrig in()->canAccess(rootFrame->securityContext()->getSecurityOrigin());
255 isDOMDescendant = (targetFrame->tree().top() == rootFrame); 255 isDOMDescendant = (targetFrame->tree().top() == rootFrame);
256 } 256 }
257 257
258 IntersectionObservation* observation = new IntersectionObservation(*this, *t arget, shouldReportRootBounds); 258 IntersectionObservation* observation = new IntersectionObservation(*this, *t arget, shouldReportRootBounds);
259 target->ensureIntersectionObserverData().addObservation(*observation); 259 target->ensureIntersectionObserverData().addObservation(*observation);
260 m_observations.add(observation); 260 m_observations.add(observation);
261 261
262 if (!isDOMDescendant) { 262 if (!isDOMDescendant) {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 407
408 DEFINE_TRACE(IntersectionObserver) 408 DEFINE_TRACE(IntersectionObserver)
409 { 409 {
410 visitor->template registerWeakMembers<IntersectionObserver, &IntersectionObs erver::clearWeakMembers>(this); 410 visitor->template registerWeakMembers<IntersectionObserver, &IntersectionObs erver::clearWeakMembers>(this);
411 visitor->trace(m_callback); 411 visitor->trace(m_callback);
412 visitor->trace(m_observations); 412 visitor->trace(m_observations);
413 visitor->trace(m_entries); 413 visitor->trace(m_entries);
414 } 414 }
415 415
416 } // namespace blink 416 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/intersection-observer/shadow-content-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698