Chromium Code Reviews| 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 90ff56744e3faba95093776f53ca75b508b374dd..c4e56b7a84a669d3acd960c73d366fc562bb390e 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); |
| } |
| @@ -328,7 +330,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; |
| @@ -409,6 +411,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) |
|
ojan
2016/02/02 06:51:01
It's a bummer we need to copy-paste this. Maybe pu
skobes
2016/02/02 22:39:11
Yes, this is why we want root layer scrolling. :)
|
| + scrollAnchor().clear(); |
| } |
| IntPoint PaintLayerScrollableArea::scrollPosition() const |
| @@ -1449,6 +1455,15 @@ Widget* PaintLayerScrollableArea::widget() |
| return box().frame()->view(); |
| } |
| +bool PaintLayerScrollableArea::scrollAnchoringEnabled() const |
| +{ |
| + if (Frame* frame = box().frame()) { |
|
ojan
2016/02/02 06:51:01
Nit: If you add a scrollAnchoringEnabled method to
skobes
2016/02/02 22:39:11
Hmm, this doesn't save us very much, and it increa
|
| + if (Settings* settings = frame->settings()) |
| + return settings->scrollAnchoringEnabled(); |
| + } |
| + return false; |
| +} |
| + |
| PaintLayerScrollableArea::ScrollbarManager::ScrollbarManager(PaintLayerScrollableArea& scrollableArea) |
| : m_scrollableArea(&scrollableArea) |
| , m_canDetachScrollbars(0) |