| 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" |
| 11 #include "core/layout/LayoutText.h" | 11 #include "core/layout/LayoutText.h" |
| 12 #include "core/layout/LayoutView.h" | 12 #include "core/layout/LayoutView.h" |
| 13 #include "core/paint/PaintLayer.h" | 13 #include "core/paint/PaintLayer.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 IntersectionObservation::IntersectionObservation(IntersectionObserver& observer,
Element& target, bool shouldReportRootBounds) | 17 IntersectionObservation::IntersectionObservation(IntersectionObserver& observer,
Element& target, bool shouldReportRootBounds) |
| 18 : m_observer(observer) | 18 : m_observer(observer) |
| 19 , m_target(target.ensureIntersectionObserverData().createWeakPtr(&target)) | 19 , m_target(target.ensureIntersectionObserverData().createWeakPtr(&target)) |
| 20 , m_active(true) | 20 , m_active(true) |
| 21 , m_shouldReportRootBounds(shouldReportRootBounds) | 21 , m_shouldReportRootBounds(shouldReportRootBounds) |
| 22 , m_lastThresholdIndex(0) | 22 , m_lastThresholdIndex(0) |
| 23 { | 23 { |
| 24 } | 24 } |
| 25 | 25 |
| 26 IntersectionObservation::~IntersectionObservation() |
| 27 { |
| 28 } |
| 29 |
| 26 Element* IntersectionObservation::target() const | 30 Element* IntersectionObservation::target() const |
| 27 { | 31 { |
| 28 return toElement(m_target.get()); | 32 return toElement(m_target.get()); |
| 29 } | 33 } |
| 30 | 34 |
| 31 void IntersectionObservation::initializeGeometry(IntersectionGeometry& geometry) | 35 void IntersectionObservation::initializeGeometry(IntersectionGeometry& geometry) |
| 32 { | 36 { |
| 33 ASSERT(m_target); | 37 ASSERT(m_target); |
| 34 LayoutObject* targetLayoutObject = target()->layoutObject(); | 38 LayoutObject* targetLayoutObject = target()->layoutObject(); |
| 35 if (targetLayoutObject->isBoxModelObject()) | 39 if (targetLayoutObject->isBoxModelObject()) |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 m_observer.clear(); | 171 m_observer.clear(); |
| 168 } | 172 } |
| 169 | 173 |
| 170 DEFINE_TRACE(IntersectionObservation) | 174 DEFINE_TRACE(IntersectionObservation) |
| 171 { | 175 { |
| 172 visitor->trace(m_observer); | 176 visitor->trace(m_observer); |
| 173 visitor->trace(m_target); | 177 visitor->trace(m_target); |
| 174 } | 178 } |
| 175 | 179 |
| 176 } // namespace blink | 180 } // namespace blink |
| OLD | NEW |