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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 // developers to reason about the anchor node. | 133 // developers to reason about the anchor node. |
134 if (candidate->isAnonymous()) | 134 if (candidate->isAnonymous()) |
135 return ExamineResult(Continue); | 135 return ExamineResult(Continue); |
136 | 136 |
137 if (!candidate->isText() && !candidate->isBox()) | 137 if (!candidate->isText() && !candidate->isBox()) |
138 return ExamineResult(Skip); | 138 return ExamineResult(Skip); |
139 | 139 |
140 if (!candidateMayMoveWithScroller(candidate, m_scroller)) | 140 if (!candidateMayMoveWithScroller(candidate, m_scroller)) |
141 return ExamineResult(Skip); | 141 return ExamineResult(Skip); |
142 | 142 |
143 if (candidate->style()->overflowAnchor() == AnchorNone) | 143 if (candidate->style()->overflowAnchor() == EOverflowAnchor::None) |
144 return ExamineResult(Skip); | 144 return ExamineResult(Skip); |
145 | 145 |
146 LayoutRect candidateRect = relativeBounds(candidate, m_scroller); | 146 LayoutRect candidateRect = relativeBounds(candidate, m_scroller); |
147 LayoutRect visibleRect = | 147 LayoutRect visibleRect = |
148 scrollerLayoutBoxItem(m_scroller).overflowClipRect(LayoutPoint()); | 148 scrollerLayoutBoxItem(m_scroller).overflowClipRect(LayoutPoint()); |
149 | 149 |
150 bool occupiesSpace = candidateRect.width() > 0 && candidateRect.height() > 0; | 150 bool occupiesSpace = candidateRect.width() > 0 && candidateRect.height() > 0; |
151 if (occupiesSpace && visibleRect.intersects(candidateRect)) { | 151 if (occupiesSpace && visibleRect.intersects(candidateRect)) { |
152 return ExamineResult( | 152 return ExamineResult( |
153 visibleRect.contains(candidateRect) ? Return : Constrain, | 153 visibleRect.contains(candidateRect) ? Return : Constrain, |
(...skipping 176 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 |