Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: third_party/WebKit/Source/core/dom/IntersectionObservation.cpp

Issue 1994203003: Apply scroll offset and content box offset before recursing in mapAncestorToLocal (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutView.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 &layoutObject, 87 &layoutObject,
88 FloatQuad(FloatRect(rect)), 88 FloatQuad(FloatRect(rect)),
89 UseTransforms | ApplyContainerFlip | TraverseDocumentBoundaries); 89 UseTransforms | ApplyContainerFlip | TraverseDocumentBoundaries);
90 rect = LayoutRect(mappedQuad.boundingBox()); 90 rect = LayoutRect(mappedQuad.boundingBox());
91 } 91 }
92 92
93 void IntersectionObservation::mapTargetRectToTargetFrameCoordinates(LayoutRect& rect) const 93 void IntersectionObservation::mapTargetRectToTargetFrameCoordinates(LayoutRect& rect) const
94 { 94 {
95 LayoutObject& targetLayoutObject = *target()->layoutObject(); 95 LayoutObject& targetLayoutObject = *target()->layoutObject();
96 Document& targetDocument = target()->document(); 96 Document& targetDocument = target()->document();
97 LayoutSize scrollPosition = LayoutSize(toIntSize(targetDocument.view()->scro llPosition())); 97 LayoutSize scrollPosition = LayoutSize(targetDocument.view()->scrollOffset() );
98 mapRectUpToDocument(rect, targetLayoutObject, targetDocument); 98 mapRectUpToDocument(rect, targetLayoutObject, targetDocument);
99 rect.move(-scrollPosition); 99 rect.move(-scrollPosition);
100 } 100 }
101 101
102 void IntersectionObservation::mapRootRectToRootFrameCoordinates(LayoutRect& rect ) const 102 void IntersectionObservation::mapRootRectToRootFrameCoordinates(LayoutRect& rect ) const
103 { 103 {
104 LayoutObject& rootLayoutObject = *m_observer->rootLayoutObject(); 104 LayoutObject& rootLayoutObject = *m_observer->rootLayoutObject();
105 Document& rootDocument = rootLayoutObject.document(); 105 Document& rootDocument = rootLayoutObject.document();
106 LayoutSize scrollPosition = LayoutSize(toIntSize(rootDocument.view()->scroll Position())); 106 LayoutSize scrollPosition = LayoutSize(rootDocument.view()->scrollOffset());
107 mapRectUpToDocument(rect, rootLayoutObject, rootLayoutObject.document()); 107 mapRectUpToDocument(rect, rootLayoutObject, rootLayoutObject.document());
108 rect.move(-scrollPosition); 108 rect.move(-scrollPosition);
109 } 109 }
110 110
111 void IntersectionObservation::mapRootRectToTargetFrameCoordinates(LayoutRect& re ct) const 111 void IntersectionObservation::mapRootRectToTargetFrameCoordinates(LayoutRect& re ct) const
112 { 112 {
113 LayoutObject& rootLayoutObject = *m_observer->rootLayoutObject(); 113 LayoutObject& rootLayoutObject = *m_observer->rootLayoutObject();
114 Document& targetDocument = target()->document(); 114 Document& targetDocument = target()->document();
115 LayoutSize scrollPosition = LayoutSize(toIntSize(targetDocument.view()->scro llPosition())); 115 LayoutSize scrollPosition = LayoutSize(targetDocument.view()->scrollOffset() );
116 116
117 if (&targetDocument == &rootLayoutObject.document()) 117 if (&targetDocument == &rootLayoutObject.document())
118 mapRectUpToDocument(rect, rootLayoutObject, targetDocument); 118 mapRectUpToDocument(rect, rootLayoutObject, targetDocument);
119 else 119 else
120 mapRectDownToDocument(rect, toLayoutBoxModelObject(rootLayoutObject), ta rgetDocument); 120 mapRectDownToDocument(rect, toLayoutBoxModelObject(rootLayoutObject), ta rgetDocument);
121 121
122 rect.move(-scrollPosition); 122 rect.move(-scrollPosition);
123 } 123 }
124 124
125 static bool isContainingBlockChainDescendant(LayoutObject* descendant, LayoutObj ect* ancestor) 125 static bool isContainingBlockChainDescendant(LayoutObject* descendant, LayoutObj ect* ancestor)
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 m_observer.clear(); 244 m_observer.clear();
245 } 245 }
246 246
247 DEFINE_TRACE(IntersectionObservation) 247 DEFINE_TRACE(IntersectionObservation)
248 { 248 {
249 visitor->trace(m_observer); 249 visitor->trace(m_observer);
250 visitor->trace(m_target); 250 visitor->trace(m_target);
251 } 251 }
252 252
253 } // namespace blink 253 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698