Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/ScrollAnchor.cpp |
| diff --git a/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp b/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp |
| index ba2558be4ea525a692f070152ea8065f091c6b32..7959b41f6a48b238cf4a8b6d07280beb69333687 100644 |
| --- a/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp |
| +++ b/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp |
| @@ -86,6 +86,16 @@ static LayoutPoint computeRelativeOffset(const LayoutObject* layoutObject, const |
| return cornerPointOfRect(relativeBounds(layoutObject, scroller), corner); |
| } |
| +static bool candidateMovesWithScroller(const LayoutObject* candidate, const ScrollableArea* scroller) |
| +{ |
| + if (candidate->style() && candidate->style()->hasViewportConstrainedPosition()) |
| + return false; |
| + |
| + bool skippedByContainerLookup = false; |
| + candidate->container(scrollerLayoutBox(scroller), &skippedByContainerLookup); |
| + return !skippedByContainerLookup; |
|
ymalik
2016/03/25 18:53:19
Sorry, could you briefly explain why if !skippedBy
skobes
2016/03/25 19:36:35
This is looking for cases where the candidate's "c
|
| +} |
| + |
| ScrollAnchor::ExamineResult ScrollAnchor::examine(const LayoutObject* candidate) const |
| { |
| if (candidate->isLayoutInline()) |
| @@ -94,7 +104,7 @@ ScrollAnchor::ExamineResult ScrollAnchor::examine(const LayoutObject* candidate) |
| if (!candidate->isText() && !candidate->isBox()) |
| return ExamineResult(Skip); |
| - if (candidate->style() && candidate->style()->hasViewportConstrainedPosition()) |
| + if (!candidateMovesWithScroller(candidate, m_scroller)) |
| return ExamineResult(Skip); |
| LayoutRect candidateRect = relativeBounds(candidate, m_scroller); |