Chromium Code Reviews| 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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 338 for (auto& observation : m_observations) | 338 for (auto& observation : m_observations) |
| 339 observation->clearRootAndRemoveFromTarget(); | 339 observation->clearRootAndRemoveFromTarget(); |
| 340 m_observations.clear(); | 340 m_observations.clear(); |
| 341 } | 341 } |
| 342 | 342 |
| 343 void IntersectionObserver::removeObservation( | 343 void IntersectionObserver::removeObservation( |
| 344 IntersectionObservation& observation) { | 344 IntersectionObservation& observation) { |
| 345 m_observations.remove(&observation); | 345 m_observations.remove(&observation); |
| 346 } | 346 } |
| 347 | 347 |
| 348 void IntersectionObserver::setInitialState(InitialState initialState) { | |
|
ojan
2016/10/31 19:37:09
This will happen to work for ElementVisibilityObse
Sami
2016/11/01 10:44:48
Thanks, I think this will help to avoid some surpr
| |
| 349 DCHECK_EQ(initialState, InitialState::AUTO); | |
| 350 for (auto& observation : observations()) | |
| 351 observation->setLastThresholdIndex(std::numeric_limits<unsigned>::max()); | |
| 352 } | |
| 353 | |
| 348 HeapVector<Member<IntersectionObserverEntry>> IntersectionObserver::takeRecords( | 354 HeapVector<Member<IntersectionObserverEntry>> IntersectionObserver::takeRecords( |
| 349 ExceptionState& exceptionState) { | 355 ExceptionState& exceptionState) { |
| 350 HeapVector<Member<IntersectionObserverEntry>> entries; | 356 HeapVector<Member<IntersectionObserverEntry>> entries; |
| 351 | 357 |
| 352 if (!m_root) | 358 if (!m_root) |
| 353 exceptionState.throwDOMException(InvalidStateError, | 359 exceptionState.throwDOMException(InvalidStateError, |
| 354 "takeRecords() called on an " | 360 "takeRecords() called on an " |
| 355 "IntersectionObserver with an invalid " | 361 "IntersectionObserver with an invalid " |
| 356 "root."); | 362 "root."); |
| 357 else | 363 else |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 436 | 442 |
| 437 DEFINE_TRACE(IntersectionObserver) { | 443 DEFINE_TRACE(IntersectionObserver) { |
| 438 visitor->template registerWeakMembers< | 444 visitor->template registerWeakMembers< |
| 439 IntersectionObserver, &IntersectionObserver::clearWeakMembers>(this); | 445 IntersectionObserver, &IntersectionObserver::clearWeakMembers>(this); |
| 440 visitor->trace(m_callback); | 446 visitor->trace(m_callback); |
| 441 visitor->trace(m_observations); | 447 visitor->trace(m_observations); |
| 442 visitor->trace(m_entries); | 448 visitor->trace(m_entries); |
| 443 } | 449 } |
| 444 | 450 |
| 445 } // namespace blink | 451 } // namespace blink |
| OLD | NEW |