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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 } | 63 } |
64 | 64 |
65 void IntersectionObservation::clipToRoot(LayoutRect& rect, const LayoutRect& roo
tRect) const | 65 void IntersectionObservation::clipToRoot(LayoutRect& rect, const LayoutRect& roo
tRect) const |
66 { | 66 { |
67 // Map and clip rect into root element coordinates. | 67 // Map and clip rect into root element coordinates. |
68 // TODO(szager): the writing mode flipping needs a test. | 68 // TODO(szager): the writing mode flipping needs a test. |
69 ASSERT(m_target); | 69 ASSERT(m_target); |
70 LayoutObject* rootLayoutObject = m_observer->rootLayoutObject(); | 70 LayoutObject* rootLayoutObject = m_observer->rootLayoutObject(); |
71 LayoutObject* targetLayoutObject = target()->layoutObject(); | 71 LayoutObject* targetLayoutObject = target()->layoutObject(); |
72 | 72 |
73 targetLayoutObject->mapToVisibleRectInAncestorSpace(toLayoutBoxModelObject(r
ootLayoutObject), rect, nullptr); | 73 targetLayoutObject->mapToVisibleRectInAncestorSpace(toLayoutBoxModelObject(r
ootLayoutObject), rect); |
74 LayoutRect rootClipRect(rootRect); | 74 LayoutRect rootClipRect(rootRect); |
75 toLayoutBox(rootLayoutObject)->flipForWritingMode(rootClipRect); | 75 toLayoutBox(rootLayoutObject)->flipForWritingMode(rootClipRect); |
76 rect.intersect(rootClipRect); | 76 rect.intersect(rootClipRect); |
77 } | 77 } |
78 | 78 |
79 static void mapRectUpToDocument(LayoutRect& rect, const LayoutObject& layoutObje
ct, const Document& document) | 79 static void mapRectUpToDocument(LayoutRect& rect, const LayoutObject& layoutObje
ct, const Document& document) |
80 { | 80 { |
81 FloatQuad mappedQuad = layoutObject.localToAbsoluteQuad( | 81 FloatQuad mappedQuad = layoutObject.localToAbsoluteQuad( |
82 FloatQuad(FloatRect(rect)), | 82 FloatQuad(FloatRect(rect)), |
83 UseTransforms | ApplyContainerFlip); | 83 UseTransforms | ApplyContainerFlip); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 m_observer.clear(); | 223 m_observer.clear(); |
224 } | 224 } |
225 | 225 |
226 DEFINE_TRACE(IntersectionObservation) | 226 DEFINE_TRACE(IntersectionObservation) |
227 { | 227 { |
228 visitor->trace(m_observer); | 228 visitor->trace(m_observer); |
229 visitor->trace(m_target); | 229 visitor->trace(m_target); |
230 } | 230 } |
231 | 231 |
232 } // namespace blink | 232 } // namespace blink |
OLD | NEW |