| 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/line/InlineTextBox.h" | 9 #include "core/layout/line/InlineTextBox.h" |
| 10 #include "core/paint/PaintLayerScrollableArea.h" | 10 #include "core/paint/PaintLayerScrollableArea.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 bool skippedByContainerLookup = false; | 112 bool skippedByContainerLookup = false; |
| 113 candidate->container(scrollerLayoutBox(scroller), &skippedByContainerLookup)
; | 113 candidate->container(scrollerLayoutBox(scroller), &skippedByContainerLookup)
; |
| 114 return !skippedByContainerLookup; | 114 return !skippedByContainerLookup; |
| 115 } | 115 } |
| 116 | 116 |
| 117 ScrollAnchor::ExamineResult ScrollAnchor::examine(const LayoutObject* candidate)
const | 117 ScrollAnchor::ExamineResult ScrollAnchor::examine(const LayoutObject* candidate)
const |
| 118 { | 118 { |
| 119 if (candidate->isLayoutInline()) | 119 if (candidate->isLayoutInline()) |
| 120 return ExamineResult(Continue); | 120 return ExamineResult(Continue); |
| 121 | 121 |
| 122 // Anonymous blocks are not in the DOM tree and it may be hard for |
| 123 // developers to reason about the anchor node. |
| 124 if (candidate->isAnonymous()) |
| 125 return ExamineResult(Continue); |
| 126 |
| 122 if (!candidate->isText() && !candidate->isBox()) | 127 if (!candidate->isText() && !candidate->isBox()) |
| 123 return ExamineResult(Skip); | 128 return ExamineResult(Skip); |
| 124 | 129 |
| 125 if (!candidateMovesWithScroller(candidate, m_scroller)) | 130 if (!candidateMovesWithScroller(candidate, m_scroller)) |
| 126 return ExamineResult(Skip); | 131 return ExamineResult(Skip); |
| 127 | 132 |
| 128 LayoutRect candidateRect = relativeBounds(candidate, m_scroller); | 133 LayoutRect candidateRect = relativeBounds(candidate, m_scroller); |
| 129 LayoutRect visibleRect = scrollerLayoutBoxItem(m_scroller).overflowClipRect(
LayoutPoint()); | 134 LayoutRect visibleRect = scrollerLayoutBoxItem(m_scroller).overflowClipRect(
LayoutPoint()); |
| 130 | 135 |
| 131 bool occupiesSpace = candidateRect.width() > 0 && candidateRect.height() > 0
; | 136 bool occupiesSpace = candidateRect.width() > 0 && candidateRect.height() > 0
; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 | 299 |
| 295 void ScrollAnchor::notifyRemoved(LayoutObject* layoutObject) | 300 void ScrollAnchor::notifyRemoved(LayoutObject* layoutObject) |
| 296 { | 301 { |
| 297 if (m_current.m_anchorObject == layoutObject) | 302 if (m_current.m_anchorObject == layoutObject) |
| 298 m_current.clear(); | 303 m_current.clear(); |
| 299 if (m_lastAdjusted.m_anchorObject == layoutObject) | 304 if (m_lastAdjusted.m_anchorObject == layoutObject) |
| 300 m_lastAdjusted.clear(); | 305 m_lastAdjusted.clear(); |
| 301 } | 306 } |
| 302 | 307 |
| 303 } // namespace blink | 308 } // namespace blink |
| OLD | NEW |