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

Unified Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

Issue 2387883002: Use float for scroll offset. (Closed)
Patch Set: Fix README.md Created 4 years, 2 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/layout/compositing/CompositedLayerMapping.cpp
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
index 8f6f6f8bff6faa6b1eed578ee3dc8bf129e2734d..ff4963bf0446c3d7558206b75b4a20f06fd40d47 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
@@ -1109,9 +1109,10 @@ void CompositedLayerMapping::updateOverflowControlsHostLayerGeometry(
transformState.flatten();
hostLayerPosition = LayoutPoint(transformState.lastPlanarPoint());
if (PaintLayerScrollableArea* scrollableArea =
- compositingStackingContext->getScrollableArea())
+ compositingStackingContext->getScrollableArea()) {
hostLayerPosition.move(
- LayoutSize(scrollableArea->adjustedScrollOffset()));
+ LayoutSize(toFloatSize(scrollableArea->scrollPosition())));
+ }
hostLayerPosition.move(-stackingOffsetFromLayoutObject);
}
} else {
@@ -1221,8 +1222,8 @@ void CompositedLayerMapping::updateScrollingLayerGeometry(
LayoutBox* layoutBox = toLayoutBox(layoutObject());
IntRect overflowClipRect =
enclosingIntRect(layoutBox->overflowClipRect(LayoutPoint()));
- DoubleSize adjustedScrollOffset =
- m_owningLayer.getScrollableArea()->adjustedScrollOffset();
+ FloatPoint scrollPosition =
+ m_owningLayer.getScrollableArea()->scrollPosition();
m_scrollingLayer->setPosition(FloatPoint(
overflowClipRect.location() - localCompositingBounds.location() +
roundedIntSize(m_owningLayer.subpixelAccumulation())));
@@ -1249,8 +1250,8 @@ void CompositedLayerMapping::updateScrollingLayerGeometry(
m_scrollingContentsLayer->setNeedsDisplay();
DoubleSize scrollingContentsOffset(
- overflowClipRect.location().x() - adjustedScrollOffset.width(),
- overflowClipRect.location().y() - adjustedScrollOffset.height());
+ overflowClipRect.location().x() - scrollPosition.x(),
+ overflowClipRect.location().y() - scrollPosition.y());
// The scroll offset change is compared using floating point so that
// fractional scroll offset change can be propagated to compositor.
if (scrollingContentsOffset != m_scrollingContentsOffset ||
@@ -1258,9 +1259,8 @@ void CompositedLayerMapping::updateScrollingLayerGeometry(
bool coordinatorHandlesOffset =
compositor()->scrollingLayerDidChange(&m_owningLayer);
m_scrollingContentsLayer->setPosition(
- coordinatorHandlesOffset
- ? FloatPoint()
- : FloatPoint(-toFloatSize(adjustedScrollOffset)));
+ coordinatorHandlesOffset ? FloatPoint()
+ : FloatPoint(-toFloatSize(scrollPosition)));
}
m_scrollingContentsOffset = scrollingContentsOffset;
@@ -2893,10 +2893,11 @@ void CompositedLayerMapping::adjustForCompositedScrolling(
if (PaintLayerScrollableArea* scrollableArea =
m_owningLayer.getScrollableArea()) {
if (scrollableArea->usesCompositedScrolling()) {
- // Note: this is just the scroll offset, *not* the "adjusted scroll
- // offset". Scroll offset does not include the origin adjustment. That
- // is instead baked already into offsetFromLayoutObject.
- DoubleSize scrollOffset = scrollableArea->scrollOffset();
+ // Note: this is the offset from the beginning of flow of the block, not
+ // the offset from the top/left of the overflow rect.
+ // offsetFromLayoutObject adds the origin offset from top/left to the
+ // beginning of flow.
+ ScrollOffset scrollOffset = scrollableArea->scrollOffset();
offset.expand(-scrollOffset.width(), -scrollOffset.height());
}
}

Powered by Google App Engine
This is Rietveld 408576698