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