| 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 } | 310 } |
| 311 | 311 |
| 312 bool IntersectionObserver::hasPercentMargin() const | 312 bool IntersectionObserver::hasPercentMargin() const |
| 313 { | 313 { |
| 314 return (m_topMargin.type() == Percent | 314 return (m_topMargin.type() == Percent |
| 315 || m_rightMargin.type() == Percent | 315 || m_rightMargin.type() == Percent |
| 316 || m_bottomMargin.type() == Percent | 316 || m_bottomMargin.type() == Percent |
| 317 || m_leftMargin.type() == Percent); | 317 || m_leftMargin.type() == Percent); |
| 318 } | 318 } |
| 319 | 319 |
| 320 void IntersectionObserver::rootDisappearedCallback(Visitor* visitor, void* self) | 320 void IntersectionObserver::clearWeakMembers(Visitor* visitor) |
| 321 { | 321 { |
| 322 IntersectionObserver* observer = static_cast<IntersectionObserver*>(self); | 322 if (Heap::isHeapObjectAlive(m_root)) |
| 323 observer->disconnect(); | 323 return; |
| 324 disconnect(); |
| 325 m_root = nullptr; |
| 324 } | 326 } |
| 325 | 327 |
| 326 DEFINE_TRACE(IntersectionObserver) | 328 DEFINE_TRACE(IntersectionObserver) |
| 327 { | 329 { |
| 328 #if ENABLE(OILPAN) | 330 #if ENABLE(OILPAN) |
| 329 visitor->registerWeakMembers(this, m_root.get(), IntersectionObserver::rootD
isappearedCallback); | 331 visitor->template registerWeakMembers<IntersectionObserver, &IntersectionObs
erver::clearWeakMembers>(this); |
| 330 #endif | 332 #endif |
| 331 visitor->trace(m_callback); | 333 visitor->trace(m_callback); |
| 332 visitor->trace(m_root); | |
| 333 visitor->trace(m_observations); | 334 visitor->trace(m_observations); |
| 334 visitor->trace(m_entries); | 335 visitor->trace(m_entries); |
| 335 } | 336 } |
| 336 | 337 |
| 337 } // namespace blink | 338 } // namespace blink |
| OLD | NEW |