| 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/IntersectionObservation.h" | 5 #include "core/dom/IntersectionObservation.h" |
| 6 | 6 |
| 7 #include "core/dom/ElementRareData.h" | 7 #include "core/dom/ElementRareData.h" |
| 8 #include "core/dom/IntersectionObserver.h" | 8 #include "core/dom/IntersectionObserver.h" |
| 9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
| 10 #include "core/layout/LayoutBox.h" | 10 #include "core/layout/LayoutBox.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 145 } |
| 146 | 146 |
| 147 bool IntersectionObservation::computeGeometry(IntersectionGeometry& geometry) co
nst | 147 bool IntersectionObservation::computeGeometry(IntersectionGeometry& geometry) co
nst |
| 148 { | 148 { |
| 149 // Pre-oilpan, there will be a delay between the time when the target Elemen
t gets deleted | 149 // Pre-oilpan, there will be a delay between the time when the target Elemen
t gets deleted |
| 150 // (because its ref count dropped to zero) and when this IntersectionObserva
tion gets | 150 // (because its ref count dropped to zero) and when this IntersectionObserva
tion gets |
| 151 // deleted (during the next gc run, because the target Element is the only t
hing keeping | 151 // deleted (during the next gc run, because the target Element is the only t
hing keeping |
| 152 // the IntersectionObservation alive). During that interval, we need to che
ck that m_target | 152 // the IntersectionObservation alive). During that interval, we need to che
ck that m_target |
| 153 // hasn't been cleared. | 153 // hasn't been cleared. |
| 154 Element* targetElement = target(); | 154 Element* targetElement = target(); |
| 155 if (!targetElement || !targetElement->inDocument()) | 155 if (!targetElement || !targetElement->inShadowIncludingDocument()) |
| 156 return false; | 156 return false; |
| 157 LayoutObject* targetLayoutObject = targetElement->layoutObject(); | 157 LayoutObject* targetLayoutObject = targetElement->layoutObject(); |
| 158 ASSERT(m_observer); | 158 ASSERT(m_observer); |
| 159 LayoutObject* rootLayoutObject = m_observer->rootLayoutObject(); | 159 LayoutObject* rootLayoutObject = m_observer->rootLayoutObject(); |
| 160 // TODO(szager): Support SVG | 160 // TODO(szager): Support SVG |
| 161 if (!targetLayoutObject) | 161 if (!targetLayoutObject) |
| 162 return false; | 162 return false; |
| 163 if (!targetLayoutObject->isBoxModelObject() && !targetLayoutObject->isText()
) | 163 if (!targetLayoutObject->isBoxModelObject() && !targetLayoutObject->isText()
) |
| 164 return false; | 164 return false; |
| 165 if (!rootLayoutObject || !rootLayoutObject->isBoxModelObject()) | 165 if (!rootLayoutObject || !rootLayoutObject->isBoxModelObject()) |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 m_observer.clear(); | 242 m_observer.clear(); |
| 243 } | 243 } |
| 244 | 244 |
| 245 DEFINE_TRACE(IntersectionObservation) | 245 DEFINE_TRACE(IntersectionObservation) |
| 246 { | 246 { |
| 247 visitor->trace(m_observer); | 247 visitor->trace(m_observer); |
| 248 visitor->trace(m_target); | 248 visitor->trace(m_target); |
| 249 } | 249 } |
| 250 | 250 |
| 251 } // namespace blink | 251 } // namespace blink |
| OLD | NEW |