| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |