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

Unified Diff: third_party/WebKit/Source/core/layout/ScrollAnchor.cpp

Issue 1831993002: Handle position:absolute candidates correctly in ScrollAnchor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698