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

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

Issue 1867693002: Better scrolling fix (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: refined Created 4 years, 8 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 | « third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 087eaa3ce71a05b843d9fc3e4dfbb19d7e495d8f..e40d3bc920c23b7226720a12b1ce82c5464b6cff 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
@@ -596,6 +596,9 @@ void PaintLayerScrollableArea::computeScrollDimensions()
int scrollableLeftOverflow = m_overflowRect.x() - box().borderLeft() - (box().shouldPlaceBlockDirectionScrollbarOnLogicalLeft() ? box().verticalScrollbarWidth() : 0);
int scrollableTopOverflow = m_overflowRect.y() - box().borderTop();
setScrollOrigin(IntPoint(-scrollableLeftOverflow, -scrollableTopOverflow));
+ fprintf(stderr, "origin=%i,%i\n", scrollOrigin().x(), scrollOrigin().y());
+ fprintf(stderr, "........overflowRect x = %f width = %f layoutRect x = %f width = %f\n", m_overflowRect.x().toFloat(), m_overflowRect.width().toFloat(), box().location().x().toFloat(), box().size().width().toFloat());
+ fprintf(stderr, "offset=%f,%f\n", m_scrollOffset.width(), m_scrollOffset.height());
}
void PaintLayerScrollableArea::scrollToPosition(const DoublePoint& scrollPosition, ScrollOffsetClamping clamp, ScrollBehavior scrollBehavior, ScrollType scrollType)
@@ -607,6 +610,15 @@ void PaintLayerScrollableArea::scrollToPosition(const DoublePoint& scrollPositio
ScrollableArea::setScrollPosition(newScrollPosition, scrollType, scrollBehavior);
}
+void PaintLayerScrollableArea::clampPositionAfterLayout()
+{
+ // Layout may cause us to be at an invalid scroll position. In this case we need
+ // to pull our scroll offsets back to the max (or push them up to the min).
+ DoublePoint clampedScrollPosition = clampScrollPosition(scrollPositionDouble());
+ if (clampedScrollPosition != scrollPositionDouble())
+ scrollToPosition(clampedScrollPosition);
+}
+
bool PaintLayerScrollableArea::updateAfterLayout(SubtreeLayoutScope* delayedLayoutScope)
{
ASSERT(box().hasOverflowClip());
@@ -624,18 +636,25 @@ bool PaintLayerScrollableArea::updateAfterLayout(SubtreeLayoutScope* delayedLayo
IntPoint originalOrigin = scrollOrigin();
computeScrollDimensions();
- // Layout may cause us to be at an invalid scroll position. In this case we need
- // to pull our scroll offsets back to the max (or push them up to the min).
- DoublePoint clampedScrollPosition = clampScrollPosition(scrollPositionDouble());
- if (clampedScrollPosition != scrollPositionDouble()) {
- scrollToPosition(clampedScrollPosition);
- } else if (originalOrigin != scrollOrigin()) {
+ fprintf(stderr, "updateAfterLayout -- origin is %i,%i offset %f,%f\n", scrollOrigin().x(), scrollOrigin().y(), scrollPositionDouble().x(), scrollPositionDouble().y());
+
+ IntPoint newOrigin(scrollOrigin());
+ if (originalOrigin != newOrigin) {
// TODO: We should be able to use scrollOriginChanged() here, but we can't because
// PaintLayerScrollableArea does not maintain that flag: it gets set, but it never
// gets unset. We should unset the flag after layout.
- scrollPositionChanged(scrollPositionDouble(), ProgrammaticScroll);
+ DoubleSize originDiff(newOrigin - originalOrigin);
+ /*
+ if (originDiff.width() < 0)
+ originDiff.setWidth(0);
+ if (originDiff.height() < 0)
+ originDiff.setHeight(0);
+ */
+ scrollPositionChanged(scrollPositionDouble() + originDiff, ProgrammaticScroll);
+ fprintf(stderr, " adjusting position by %f,%f\n", originDiff.width(), originDiff.height());
}
+
m_scrollbarManager.setCanDetachScrollbars(false);
bool hasHorizontalOverflow = this->hasHorizontalOverflow();
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698