| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 exceptionState.throwTypeError("Threshold values must be between 0 an
d 1"); | 76 exceptionState.throwTypeError("Threshold values must be between 0 an
d 1"); |
| 77 break; | 77 break; |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 | 80 |
| 81 std::sort(thresholds.begin(), thresholds.end()); | 81 std::sort(thresholds.begin(), thresholds.end()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 IntersectionObserver* IntersectionObserver::create(const IntersectionObserverIni
t& observerInit, IntersectionObserverCallback& callback, ExceptionState& excepti
onState) | 84 IntersectionObserver* IntersectionObserver::create(const IntersectionObserverIni
t& observerInit, IntersectionObserverCallback& callback, ExceptionState& excepti
onState) |
| 85 { | 85 { |
| 86 RefPtrWillBeRawPtr<Node> root = observerInit.root(); | 86 RawPtr<Node> root = observerInit.root(); |
| 87 if (!root) { | 87 if (!root) { |
| 88 // TODO(szager): Use Document instead of document element for implicit r
oot. (crbug.com/570538) | 88 // TODO(szager): Use Document instead of document element for implicit r
oot. (crbug.com/570538) |
| 89 ExecutionContext* context = callback.executionContext(); | 89 ExecutionContext* context = callback.executionContext(); |
| 90 ASSERT(context->isDocument()); | 90 ASSERT(context->isDocument()); |
| 91 Frame* mainFrame = toDocument(context)->frame()->tree().top(); | 91 Frame* mainFrame = toDocument(context)->frame()->tree().top(); |
| 92 if (mainFrame && mainFrame->isLocalFrame()) | 92 if (mainFrame && mainFrame->isLocalFrame()) |
| 93 root = toLocalFrame(mainFrame)->document(); | 93 root = toLocalFrame(mainFrame)->document(); |
| 94 } | 94 } |
| 95 if (!root) { | 95 if (!root) { |
| 96 exceptionState.throwDOMException(HierarchyRequestError, "Unable to get r
oot node in main frame to track."); | 96 exceptionState.throwDOMException(HierarchyRequestError, "Unable to get r
oot node in main frame to track."); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 { | 376 { |
| 377 #if ENABLE(OILPAN) | 377 #if ENABLE(OILPAN) |
| 378 visitor->template registerWeakMembers<IntersectionObserver, &IntersectionObs
erver::clearWeakMembers>(this); | 378 visitor->template registerWeakMembers<IntersectionObserver, &IntersectionObs
erver::clearWeakMembers>(this); |
| 379 #endif | 379 #endif |
| 380 visitor->trace(m_callback); | 380 visitor->trace(m_callback); |
| 381 visitor->trace(m_observations); | 381 visitor->trace(m_observations); |
| 382 visitor->trace(m_entries); | 382 visitor->trace(m_entries); |
| 383 } | 383 } |
| 384 | 384 |
| 385 } // namespace blink | 385 } // namespace blink |
| OLD | NEW |