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

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp

Issue 1647793002: Use ScrollAnchor in FrameView and PaintLayerScrollableArea. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@anchor-skeleton
Patch Set: move save/restore from LayoutBlockFlow into LayoutBlock Created 4 years, 11 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
Index: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
index 0714d24c6258aadc85e16e1ef0bb245a42063d20..a515034a173a1fca281b7d209d74ad448e4d77c1 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
@@ -92,6 +92,7 @@ PaintLayerScrollableArea::PaintLayerScrollableArea(PaintLayer& layer)
, m_scrollbarManager(*this)
, m_scrollCorner(nullptr)
, m_resizer(nullptr)
+ , m_scrollAnchor(this)
#if ENABLE(ASSERT)
, m_hasBeenDisposed(false)
#endif
@@ -153,6 +154,9 @@ void PaintLayerScrollableArea::dispose()
clearScrollAnimators();
+ if (RuntimeEnabledFeatures::scrollAnchoringEnabled())
+ m_scrollAnchor.clear();
+
#if ENABLE(ASSERT)
m_hasBeenDisposed = true;
#endif
@@ -161,6 +165,7 @@ void PaintLayerScrollableArea::dispose()
DEFINE_TRACE(PaintLayerScrollableArea)
{
visitor->trace(m_scrollbarManager);
+ visitor->trace(m_scrollAnchor);
ScrollableArea::trace(visitor);
}
@@ -327,7 +332,7 @@ void PaintLayerScrollableArea::setScrollOffset(const IntPoint& newScrollOffset,
setScrollOffset(DoublePoint(newScrollOffset), scrollType);
}
-void PaintLayerScrollableArea::setScrollOffset(const DoublePoint& newScrollOffset, ScrollType)
+void PaintLayerScrollableArea::setScrollOffset(const DoublePoint& newScrollOffset, ScrollType scrollType)
{
if (scrollOffset() == toDoubleSize(newScrollOffset))
return;
@@ -407,6 +412,10 @@ void PaintLayerScrollableArea::setScrollOffset(const DoublePoint& newScrollOffse
// All scrolls clear the fragment anchor.
frameView->clearFragmentAnchor();
+
+ // Clear the scroll anchor, unless it is the reason for this scroll.
+ if (RuntimeEnabledFeatures::scrollAnchoringEnabled() && scrollType != AnchoringScroll)
+ scrollAnchor().clear();
}
IntPoint PaintLayerScrollableArea::scrollPosition() const

Powered by Google App Engine
This is Rietveld 408576698