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

Side by Side Diff: third_party/WebKit/Source/core/layout/ScrollAnchor.cpp

Issue 2634493007: Introduce LayoutObject::AncestorSkipInfo. (Closed)
Patch Set: Turn AncestorSkipInfo into a proper class with private data members. Only look for filters when tol… Created 3 years, 11 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/Source/core/layout/LayoutObjectTest.cpp ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/layout/ScrollAnchor.h" 5 #include "core/layout/ScrollAnchor.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/frame/UseCounter.h" 8 #include "core/frame/UseCounter.h"
9 #include "core/layout/LayoutBlockFlow.h" 9 #include "core/layout/LayoutBlockFlow.h"
10 #include "core/layout/api/LayoutBoxItem.h" 10 #include "core/layout/api/LayoutBoxItem.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 return cornerPointOfRect(relativeBounds(layoutObject, scroller), corner); 112 return cornerPointOfRect(relativeBounds(layoutObject, scroller), corner);
113 } 113 }
114 114
115 static bool candidateMayMoveWithScroller(const LayoutObject* candidate, 115 static bool candidateMayMoveWithScroller(const LayoutObject* candidate,
116 const ScrollableArea* scroller) { 116 const ScrollableArea* scroller) {
117 if (const ComputedStyle* style = candidate->style()) { 117 if (const ComputedStyle* style = candidate->style()) {
118 if (style->hasViewportConstrainedPosition()) 118 if (style->hasViewportConstrainedPosition())
119 return false; 119 return false;
120 } 120 }
121 121
122 bool skippedByContainerLookup = false; 122 LayoutObject::AncestorSkipInfo skipInfo(scrollerLayoutBox(scroller));
123 candidate->container(scrollerLayoutBox(scroller), &skippedByContainerLookup); 123 candidate->container(&skipInfo);
124 return !skippedByContainerLookup; 124 return !skipInfo.ancestorSkipped();
125 } 125 }
126 126
127 ScrollAnchor::ExamineResult ScrollAnchor::examine( 127 ScrollAnchor::ExamineResult ScrollAnchor::examine(
128 const LayoutObject* candidate) const { 128 const LayoutObject* candidate) const {
129 if (candidate->isLayoutInline()) 129 if (candidate->isLayoutInline())
130 return ExamineResult(Continue); 130 return ExamineResult(Continue);
131 131
132 // Anonymous blocks are not in the DOM tree and it may be hard for 132 // Anonymous blocks are not in the DOM tree and it may be hard for
133 // developers to reason about the anchor node. 133 // developers to reason about the anchor node.
134 if (candidate->isAnonymous()) 134 if (candidate->isAnonymous())
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 bool ScrollAnchor::refersTo(const LayoutObject* layoutObject) const { 330 bool ScrollAnchor::refersTo(const LayoutObject* layoutObject) const {
331 return m_anchorObject == layoutObject; 331 return m_anchorObject == layoutObject;
332 } 332 }
333 333
334 void ScrollAnchor::notifyRemoved(LayoutObject* layoutObject) { 334 void ScrollAnchor::notifyRemoved(LayoutObject* layoutObject) {
335 if (m_anchorObject == layoutObject) 335 if (m_anchorObject == layoutObject)
336 clearSelf(); 336 clearSelf();
337 } 337 }
338 338
339 } // namespace blink 339 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698