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

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: address review comment 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..63d2ab1506acaa75fda26529493a594dff8167ef 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
@@ -161,6 +162,7 @@ void PaintLayerScrollableArea::dispose()
DEFINE_TRACE(PaintLayerScrollableArea)
{
visitor->trace(m_scrollbarManager);
+ visitor->trace(m_scrollAnchor);
ScrollableArea::trace(visitor);
}
@@ -327,7 +329,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 +409,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 (scrollAnchoringEnabled() && scrollType != AnchoringScroll)
+ scrollAnchor().clear();
}
IntPoint PaintLayerScrollableArea::scrollPosition() const
@@ -1447,6 +1453,15 @@ Widget* PaintLayerScrollableArea::widget()
return box().frame()->view();
}
+bool PaintLayerScrollableArea::scrollAnchoringEnabled() const
+{
+ if (Frame* frame = box().frame()) {
+ if (Settings* settings = frame->settings())
+ return settings->scrollAnchoringEnabled();
+ }
+ return false;
+}
+
PaintLayerScrollableArea::ScrollbarManager::ScrollbarManager(PaintLayerScrollableArea& scrollableArea)
: m_scrollableArea(&scrollableArea)
, m_canDetachScrollbars(0)

Powered by Google App Engine
This is Rietveld 408576698