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

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

Issue 2046113002: IntersectionObserver: use border bounding box for target rect. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 4 years, 6 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 | « third_party/WebKit/LayoutTests/intersection-observer/client-rect-expected.txt ('k') | no next file » | 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/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
(...skipping 23 matching lines...) Expand all
34 geometry.intersectionRect = geometry.targetRect; 34 geometry.intersectionRect = geometry.targetRect;
35 initializeRootRect(geometry.rootRect); 35 initializeRootRect(geometry.rootRect);
36 geometry.doesIntersect = true; 36 geometry.doesIntersect = true;
37 } 37 }
38 38
39 void IntersectionObservation::initializeTargetRect(LayoutRect& rect) const 39 void IntersectionObservation::initializeTargetRect(LayoutRect& rect) const
40 { 40 {
41 DCHECK(m_target); 41 DCHECK(m_target);
42 LayoutObject* targetLayoutObject = target()->layoutObject(); 42 LayoutObject* targetLayoutObject = target()->layoutObject();
43 DCHECK(targetLayoutObject && targetLayoutObject->isBoxModelObject()); 43 DCHECK(targetLayoutObject && targetLayoutObject->isBoxModelObject());
44 rect = toLayoutBoxModelObject(targetLayoutObject)->visualOverflowRect(); 44 rect = LayoutRect(toLayoutBoxModelObject(targetLayoutObject)->borderBounding Box());
45 } 45 }
46 46
47 void IntersectionObservation::initializeRootRect(LayoutRect& rect) const 47 void IntersectionObservation::initializeRootRect(LayoutRect& rect) const
48 { 48 {
49 LayoutObject* rootLayoutObject = m_observer->rootLayoutObject(); 49 LayoutObject* rootLayoutObject = m_observer->rootLayoutObject();
50 if (rootLayoutObject->isLayoutView()) 50 if (rootLayoutObject->isLayoutView())
51 rect = LayoutRect(toLayoutView(rootLayoutObject)->frameView()->visibleCo ntentRect()); 51 rect = LayoutRect(toLayoutView(rootLayoutObject)->frameView()->visibleCo ntentRect());
52 else if (rootLayoutObject->isBox() && rootLayoutObject->hasOverflowClip()) 52 else if (rootLayoutObject->isBox() && rootLayoutObject->hasOverflowClip())
53 rect = LayoutRect(toLayoutBox(rootLayoutObject)->contentBoxRect()); 53 rect = LayoutRect(toLayoutBox(rootLayoutObject)->contentBoxRect());
54 else 54 else
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 m_observer.clear(); 243 m_observer.clear();
244 } 244 }
245 245
246 DEFINE_TRACE(IntersectionObservation) 246 DEFINE_TRACE(IntersectionObservation)
247 { 247 {
248 visitor->trace(m_observer); 248 visitor->trace(m_observer);
249 visitor->trace(m_target); 249 visitor->trace(m_target);
250 } 250 }
251 251
252 } // namespace blink 252 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/intersection-observer/client-rect-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698