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