| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 LayoutRect clipRect(LayoutPoint(), LayoutSize(rootLayoutBox->layer()->si
ze())); | 56 LayoutRect clipRect(LayoutPoint(), LayoutSize(rootLayoutBox->layer()->si
ze())); |
| 57 m_observer->applyRootMargin(clipRect); | 57 m_observer->applyRootMargin(clipRect); |
| 58 rootLayoutBox->flipForWritingMode(rect); | 58 rootLayoutBox->flipForWritingMode(rect); |
| 59 rect.intersect(clipRect); | 59 rect.intersect(clipRect); |
| 60 rootLayoutBox->flipForWritingMode(rect); | 60 rootLayoutBox->flipForWritingMode(rect); |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | 63 |
| 64 void IntersectionObservation::clipToFrameView(IntersectionGeometry& geometry) | 64 void IntersectionObservation::clipToFrameView(IntersectionGeometry& geometry) |
| 65 { | 65 { |
| 66 Node* rootNode = m_observer->root(); | 66 Node* rootNode = m_observer->rootNode(); |
| 67 LayoutObject* rootLayoutObject = m_observer->rootLayoutObject(); | 67 LayoutObject* rootLayoutObject = m_observer->rootLayoutObject(); |
| 68 if (rootLayoutObject->isLayoutView()) { | 68 if (rootLayoutObject->isLayoutView()) { |
| 69 geometry.rootRect = LayoutRect(toLayoutView(rootLayoutObject)->frameView
()->visibleContentRect()); | 69 geometry.rootRect = LayoutRect(toLayoutView(rootLayoutObject)->frameView
()->visibleContentRect()); |
| 70 m_observer->applyRootMargin(geometry.rootRect); | 70 m_observer->applyRootMargin(geometry.rootRect); |
| 71 geometry.intersectionRect.intersect(geometry.rootRect); | 71 geometry.intersectionRect.intersect(geometry.rootRect); |
| 72 } else { | 72 } else { |
| 73 if (rootLayoutObject->isBox()) | 73 if (rootLayoutObject->isBox()) |
| 74 geometry.rootRect = LayoutRect(toLayoutBox(rootLayoutObject)->absolu
teContentBox()); | 74 geometry.rootRect = LayoutRect(toLayoutBox(rootLayoutObject)->absolu
teContentBox()); |
| 75 else | 75 else |
| 76 geometry.rootRect = LayoutRect(rootLayoutObject->absoluteBoundingBox
Rect()); | 76 geometry.rootRect = LayoutRect(rootLayoutObject->absoluteBoundingBox
Rect()); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 m_observer.clear(); | 177 m_observer.clear(); |
| 178 } | 178 } |
| 179 | 179 |
| 180 DEFINE_TRACE(IntersectionObservation) | 180 DEFINE_TRACE(IntersectionObservation) |
| 181 { | 181 { |
| 182 visitor->trace(m_observer); | 182 visitor->trace(m_observer); |
| 183 visitor->trace(m_target); | 183 visitor->trace(m_target); |
| 184 } | 184 } |
| 185 | 185 |
| 186 } // namespace blink | 186 } // namespace blink |
| OLD | NEW |