Chromium Code Reviews| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 if (geometry.intersectionRect.size().isZero()) | 109 if (geometry.intersectionRect.size().isZero()) |
| 110 geometry.intersectionRect = LayoutRect(); | 110 geometry.intersectionRect = LayoutRect(); |
| 111 if (!m_shouldReportRootBounds) | 111 if (!m_shouldReportRootBounds) |
| 112 geometry.rootRect = LayoutRect(); | 112 geometry.rootRect = LayoutRect(); |
| 113 | 113 |
| 114 return true; | 114 return true; |
| 115 } | 115 } |
| 116 | 116 |
| 117 void IntersectionObservation::computeIntersectionObservations(double timestamp) | 117 void IntersectionObservation::computeIntersectionObservations(double timestamp) |
| 118 { | 118 { |
| 119 // Pre-oilpan, there will be a delay between the time when the target Elemen t gets deleted | |
|
dcheng
2016/01/11 22:29:42
It's not accurate to imply that an Element and any
| |
| 120 // (because its ref count dropped to zero) and when this IntersectionObserva tion gets | |
| 121 // deleted (during the next gc run, because the target Element is the only t hing keeping | |
| 122 // the IntersectionObservation alive). During that interval, we need to che ck that m_target | |
| 123 // hasn't been cleared. | |
|
haraken
2016/01/12 00:01:37
Nit: This comment looks nice (so I want to keep it
| |
| 119 Element* targetElement = target(); | 124 Element* targetElement = target(); |
| 120 if (!targetElement || !isActive()) | 125 if (!targetElement || !isActive()) |
| 121 return; | 126 return; |
| 122 LayoutObject* targetLayoutObject = targetElement->layoutObject(); | 127 LayoutObject* targetLayoutObject = targetElement->layoutObject(); |
| 123 // TODO(szager): Support SVG | 128 // TODO(szager): Support SVG |
| 124 if (!targetLayoutObject || (!targetLayoutObject->isBox() && !targetLayoutObj ect->isInline())) | 129 if (!targetLayoutObject || (!targetLayoutObject->isBox() && !targetLayoutObj ect->isInline())) |
| 125 return; | 130 return; |
| 126 | 131 |
| 127 IntersectionGeometry geometry; | 132 IntersectionGeometry geometry; |
| 128 if (!computeGeometry(geometry)) | 133 if (!computeGeometry(geometry)) |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 154 m_observer.clear(); | 159 m_observer.clear(); |
| 155 } | 160 } |
| 156 | 161 |
| 157 DEFINE_TRACE(IntersectionObservation) | 162 DEFINE_TRACE(IntersectionObservation) |
| 158 { | 163 { |
| 159 visitor->trace(m_observer); | 164 visitor->trace(m_observer); |
| 160 visitor->trace(m_target); | 165 visitor->trace(m_target); |
| 161 } | 166 } |
| 162 | 167 |
| 163 } // namespace blink | 168 } // namespace blink |
| OLD | NEW |