| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |