| 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/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 bool IntersectionObservation::computeGeometry(IntersectionGeometry& geometry) co
nst | 140 bool IntersectionObservation::computeGeometry(IntersectionGeometry& geometry) co
nst |
| 141 { | 141 { |
| 142 // In the first few lines here, before initializeGeometry is called, "return
true" | 142 // In the first few lines here, before initializeGeometry is called, "return
true" |
| 143 // effectively means "if the previous observed state was that root and targe
t were | 143 // effectively means "if the previous observed state was that root and targe
t were |
| 144 // intersecting, then generate a notification indicating that they are no lo
nger | 144 // intersecting, then generate a notification indicating that they are no lo
nger |
| 145 // intersecting." This happens, for example, when root or target is removed
from the | 145 // intersecting." This happens, for example, when root or target is removed
from the |
| 146 // DOM tree and not reinserted before the next frame is generated. | 146 // DOM tree and not reinserted before the next frame is generated. |
| 147 Element* targetElement = target(); | 147 Element* targetElement = target(); |
| 148 if (!targetElement) | 148 if (!targetElement) |
| 149 return false; | 149 return false; |
| 150 if (!targetElement->inShadowIncludingDocument()) | 150 if (!targetElement->isConnected()) |
| 151 return true; | 151 return true; |
| 152 DCHECK(m_observer); | 152 DCHECK(m_observer); |
| 153 Element* rootElement = m_observer->root(); | 153 Element* rootElement = m_observer->root(); |
| 154 if (rootElement && !rootElement->inShadowIncludingDocument()) | 154 if (rootElement && !rootElement->isConnected()) |
| 155 return true; | 155 return true; |
| 156 | 156 |
| 157 LayoutObject* rootLayoutObject = m_observer->rootLayoutObject(); | 157 LayoutObject* rootLayoutObject = m_observer->rootLayoutObject(); |
| 158 if (!rootLayoutObject || !rootLayoutObject->isBoxModelObject()) | 158 if (!rootLayoutObject || !rootLayoutObject->isBoxModelObject()) |
| 159 return false; | 159 return false; |
| 160 // TODO(szager): Support SVG | 160 // TODO(szager): Support SVG |
| 161 LayoutObject* targetLayoutObject = targetElement->layoutObject(); | 161 LayoutObject* targetLayoutObject = targetElement->layoutObject(); |
| 162 if (!targetLayoutObject) | 162 if (!targetLayoutObject) |
| 163 return false; | 163 return false; |
| 164 if (!targetLayoutObject->isBoxModelObject() && !targetLayoutObject->isText()
) | 164 if (!targetLayoutObject->isBoxModelObject() && !targetLayoutObject->isText()
) |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 m_observer.clear(); | 243 m_observer.clear(); |
| 244 } | 244 } |
| 245 | 245 |
| 246 DEFINE_TRACE(IntersectionObservation) | 246 DEFINE_TRACE(IntersectionObservation) |
| 247 { | 247 { |
| 248 visitor->trace(m_observer); | 248 visitor->trace(m_observer); |
| 249 visitor->trace(m_target); | 249 visitor->trace(m_target); |
| 250 } | 250 } |
| 251 | 251 |
| 252 } // namespace blink | 252 } // namespace blink |
| OLD | NEW |