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

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

Issue 1814553003: IntersectionObserver: use border box rect for unclipped root. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@intersection-observer-idle-callback
Patch Set: rebase Created 4 years, 8 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/unclipped-root-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/layout/LayoutBox.h" 10 #include "core/layout/LayoutBox.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 LayoutObject* targetLayoutObject = target()->layoutObject(); 48 LayoutObject* targetLayoutObject = target()->layoutObject();
49 ASSERT(targetLayoutObject && targetLayoutObject->isBoxModelObject()); 49 ASSERT(targetLayoutObject && targetLayoutObject->isBoxModelObject());
50 rect = toLayoutBoxModelObject(targetLayoutObject)->visualOverflowRect(); 50 rect = toLayoutBoxModelObject(targetLayoutObject)->visualOverflowRect();
51 } 51 }
52 52
53 void IntersectionObservation::initializeRootRect(LayoutRect& rect) const 53 void IntersectionObservation::initializeRootRect(LayoutRect& rect) const
54 { 54 {
55 LayoutObject* rootLayoutObject = m_observer->rootLayoutObject(); 55 LayoutObject* rootLayoutObject = m_observer->rootLayoutObject();
56 if (rootLayoutObject->isLayoutView()) 56 if (rootLayoutObject->isLayoutView())
57 rect = LayoutRect(toLayoutView(rootLayoutObject)->frameView()->visibleCo ntentRect()); 57 rect = LayoutRect(toLayoutView(rootLayoutObject)->frameView()->visibleCo ntentRect());
58 // TODO(szager): Obey the spec -- use content box for a scrolling element, b order box otherwise. 58 else if (rootLayoutObject->isBox() && rootLayoutObject->hasOverflowClip())
59 else if (rootLayoutObject->isBox())
60 rect = LayoutRect(toLayoutBox(rootLayoutObject)->contentBoxRect()); 59 rect = LayoutRect(toLayoutBox(rootLayoutObject)->contentBoxRect());
61 else 60 else
62 rect = LayoutRect(toLayoutBoxModelObject(rootLayoutObject)->borderBoundi ngBox()); 61 rect = LayoutRect(toLayoutBoxModelObject(rootLayoutObject)->borderBoundi ngBox());
63 applyRootMargin(rect); 62 applyRootMargin(rect);
64 } 63 }
65 64
66 void IntersectionObservation::clipToRoot(IntersectionGeometry& geometry) const 65 void IntersectionObservation::clipToRoot(IntersectionGeometry& geometry) const
67 { 66 {
68 // Map and clip rect into root element coordinates. 67 // Map and clip rect into root element coordinates.
69 // TODO(szager): the writing mode flipping needs a test. 68 // TODO(szager): the writing mode flipping needs a test.
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 m_observer.clear(); 241 m_observer.clear();
243 } 242 }
244 243
245 DEFINE_TRACE(IntersectionObservation) 244 DEFINE_TRACE(IntersectionObservation)
246 { 245 {
247 visitor->trace(m_observer); 246 visitor->trace(m_observer);
248 visitor->trace(m_target); 247 visitor->trace(m_target);
249 } 248 }
250 249
251 } // namespace blink 250 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/intersection-observer/unclipped-root-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698