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 54a7f24099bfe08a2ab56c432cb2020c2f8fdb9c..c06566f16382efe14278af18b90c944653446faa 100644 |
--- a/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp |
+++ b/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp |
@@ -105,10 +105,14 @@ static LayoutPoint computeRelativeOffset(const LayoutObject* layoutObject, const |
return cornerPointOfRect(relativeBounds(layoutObject, scroller), corner); |
} |
-static bool candidateMovesWithScroller(const LayoutObject* candidate, const ScrollableArea* scroller) |
+static bool candidateMayMoveWithScroller(const LayoutObject* candidate, const ScrollableArea* scroller) |
{ |
- if (candidate->style() && candidate->style()->hasViewportConstrainedPosition()) |
+ const ComputedStyle* style = candidate->style(); |
+ if (style && (style->hasViewportConstrainedPosition() || style->hasOutOfFlowPosition())) { |
+ // Elements with absolute positioning are often used for social nav |
skobes
2016/05/28 00:18:10
"social nav bars" is too specific, just say that t
ymalik
2016/05/31 22:47:02
Done.
|
+ // bars that move with the viewort. |
return false; |
+ } |
bool skippedByContainerLookup = false; |
candidate->container(scrollerLayoutBox(scroller), &skippedByContainerLookup); |
skobes
2016/05/28 00:18:10
I think we don't need this anymore?
ymalik
2016/05/30 18:13:03
You're right that we don't need this if we don't s
ymalik
2016/05/31 22:47:01
As per your comment below and our offline conversa
|
@@ -123,7 +127,7 @@ ScrollAnchor::ExamineResult ScrollAnchor::examine(const LayoutObject* candidate) |
if (!candidate->isText() && !candidate->isBox()) |
return ExamineResult(Skip); |
- if (!candidateMovesWithScroller(candidate, m_scroller)) |
+ if (!candidateMayMoveWithScroller(candidate, m_scroller)) |
return ExamineResult(Skip); |
LayoutRect candidateRect = relativeBounds(candidate, m_scroller); |
@@ -189,7 +193,7 @@ void ScrollAnchor::save() |
// We need to update m_lastAdjusted.m_savedRelativeOffset, since it is |
// relative to the visible rect and the user may have scrolled since the |
// last adjustment. |
- if (!candidateMovesWithScroller(m_lastAdjusted.m_anchorObject, m_scroller)) { |
+ if (!candidateMayMoveWithScroller(m_lastAdjusted.m_anchorObject, m_scroller)) { |
m_lastAdjusted.clear(); |
} else if (m_lastAdjusted.m_anchorObject == m_current.m_anchorObject |
&& m_lastAdjusted.m_corner == m_current.m_corner) { |