| 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/ExceptionCode.h" | 10 #include "core/dom/ExceptionCode.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 { | 189 { |
| 190 if (!target || !target->intersectionObserverData()) | 190 if (!target || !target->intersectionObserverData()) |
| 191 return; | 191 return; |
| 192 // TODO(szager): unobserve callback | 192 // TODO(szager): unobserve callback |
| 193 if (IntersectionObservation* observation = target->intersectionObserverData(
)->getObservationFor(*this)) | 193 if (IntersectionObservation* observation = target->intersectionObserverData(
)->getObservationFor(*this)) |
| 194 observation->disconnect(); | 194 observation->disconnect(); |
| 195 } | 195 } |
| 196 | 196 |
| 197 void IntersectionObserver::computeIntersectionObservations() | 197 void IntersectionObserver::computeIntersectionObservations() |
| 198 { | 198 { |
| 199 if (!m_root || !m_root->inDocument()) | 199 if (!m_root || !m_root->inShadowIncludingDocument()) |
| 200 return; | 200 return; |
| 201 Document* callbackDocument = toDocument(m_callback->getExecutionContext()); | 201 Document* callbackDocument = toDocument(m_callback->getExecutionContext()); |
| 202 if (!callbackDocument) | 202 if (!callbackDocument) |
| 203 return; | 203 return; |
| 204 LocalDOMWindow* callbackDOMWindow = callbackDocument->domWindow(); | 204 LocalDOMWindow* callbackDOMWindow = callbackDocument->domWindow(); |
| 205 if (!callbackDOMWindow) | 205 if (!callbackDOMWindow) |
| 206 return; | 206 return; |
| 207 DOMHighResTimeStamp timestamp = DOMWindowPerformance::performance(*callbackD
OMWindow)->now(); | 207 DOMHighResTimeStamp timestamp = DOMWindowPerformance::performance(*callbackD
OMWindow)->now(); |
| 208 for (auto& observation : m_observations) | 208 for (auto& observation : m_observations) |
| 209 observation->computeIntersectionObservations(timestamp); | 209 observation->computeIntersectionObservations(timestamp); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 308 |
| 309 DEFINE_TRACE(IntersectionObserver) | 309 DEFINE_TRACE(IntersectionObserver) |
| 310 { | 310 { |
| 311 visitor->template registerWeakMembers<IntersectionObserver, &IntersectionObs
erver::clearWeakMembers>(this); | 311 visitor->template registerWeakMembers<IntersectionObserver, &IntersectionObs
erver::clearWeakMembers>(this); |
| 312 visitor->trace(m_callback); | 312 visitor->trace(m_callback); |
| 313 visitor->trace(m_observations); | 313 visitor->trace(m_observations); |
| 314 visitor->trace(m_entries); | 314 visitor->trace(m_entries); |
| 315 } | 315 } |
| 316 | 316 |
| 317 } // namespace blink | 317 } // namespace blink |
| OLD | NEW |