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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 { | 187 { |
188 if (!target || !target->intersectionObserverData()) | 188 if (!target || !target->intersectionObserverData()) |
189 return; | 189 return; |
190 // TODO(szager): unobserve callback | 190 // TODO(szager): unobserve callback |
191 if (IntersectionObservation* observation = target->intersectionObserverData( )->getObservationFor(*this)) | 191 if (IntersectionObservation* observation = target->intersectionObserverData( )->getObservationFor(*this)) |
192 observation->disconnect(); | 192 observation->disconnect(); |
193 } | 193 } |
194 | 194 |
195 void IntersectionObserver::computeIntersectionObservations() | 195 void IntersectionObserver::computeIntersectionObservations() |
196 { | 196 { |
197 if (!m_root || !m_root->inShadowIncludingDocument()) | |
ojan
2016/04/15 18:19:08
Moving this makes me a bit sad because it means we
| |
198 return; | |
199 Document* callbackDocument = toDocument(m_callback->getExecutionContext()); | 197 Document* callbackDocument = toDocument(m_callback->getExecutionContext()); |
200 if (!callbackDocument) | 198 if (!callbackDocument) |
201 return; | 199 return; |
202 LocalDOMWindow* callbackDOMWindow = callbackDocument->domWindow(); | 200 LocalDOMWindow* callbackDOMWindow = callbackDocument->domWindow(); |
203 if (!callbackDOMWindow) | 201 if (!callbackDOMWindow) |
204 return; | 202 return; |
205 DOMHighResTimeStamp timestamp = DOMWindowPerformance::performance(*callbackD OMWindow)->now(); | 203 DOMHighResTimeStamp timestamp = DOMWindowPerformance::performance(*callbackD OMWindow)->now(); |
206 for (auto& observation : m_observations) | 204 for (auto& observation : m_observations) |
207 observation->computeIntersectionObservations(timestamp); | 205 observation->computeIntersectionObservations(timestamp); |
208 } | 206 } |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
306 | 304 |
307 DEFINE_TRACE(IntersectionObserver) | 305 DEFINE_TRACE(IntersectionObserver) |
308 { | 306 { |
309 visitor->template registerWeakMembers<IntersectionObserver, &IntersectionObs erver::clearWeakMembers>(this); | 307 visitor->template registerWeakMembers<IntersectionObserver, &IntersectionObs erver::clearWeakMembers>(this); |
310 visitor->trace(m_callback); | 308 visitor->trace(m_callback); |
311 visitor->trace(m_observations); | 309 visitor->trace(m_observations); |
312 visitor->trace(m_entries); | 310 visitor->trace(m_entries); |
313 } | 311 } |
314 | 312 |
315 } // namespace blink | 313 } // namespace blink |
OLD | NEW |