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

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

Issue 2387883002: Use float for scroll offset. (Closed)
Patch Set: 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 aaaee8c578b7bdbb664dd5c4d21e66aa6d12ab25..8409919a6090e5b3d64e3bcb5ecf426ea04a6258 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
@@ -1086,8 +1086,10 @@ void CompositedLayerMapping::updateOverflowControlsHostLayerGeometry(
transformState.flatten();
hostLayerPosition = LayoutPoint(transformState.lastPlanarPoint());
if (PaintLayerScrollableArea* scrollableArea =
- compositingStackingContext->getScrollableArea())
- hostLayerPosition.move(LayoutSize(scrollableArea->offsetFromOrigin()));
+ compositingStackingContext->getScrollableArea()) {
+ hostLayerPosition.move(
+ LayoutSize(toFloatSize(scrollableArea->absolutePosition())));
+ }
hostLayerPosition.move(-stackingOffsetFromLayoutObject);
}
} else {
@@ -1194,8 +1196,8 @@ void CompositedLayerMapping::updateScrollingLayerGeometry(
LayoutBox* layoutBox = toLayoutBox(layoutObject());
IntRect overflowClipRect =
enclosingIntRect(layoutBox->overflowClipRect(LayoutPoint()));
- DoubleSize scrollOffsetFromOrigin =
- m_owningLayer.getScrollableArea()->offsetFromOrigin();
+ FloatPoint scrollPosition =
+ m_owningLayer.getScrollableArea()->absolutePosition();
m_scrollingLayer->setPosition(FloatPoint(
overflowClipRect.location() - localCompositingBounds.location() +
roundedIntSize(m_owningLayer.subpixelAccumulation())));
@@ -1222,8 +1224,8 @@ void CompositedLayerMapping::updateScrollingLayerGeometry(
m_scrollingContentsLayer->setNeedsDisplay();
DoubleSize scrollingContentsOffset(
- overflowClipRect.location().x() - scrollOffsetFromOrigin.width(),
- overflowClipRect.location().y() - scrollOffsetFromOrigin.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 ||
@@ -1231,9 +1233,8 @@ void CompositedLayerMapping::updateScrollingLayerGeometry(
bool coordinatorHandlesOffset =
compositor()->scrollingLayerDidChange(&m_owningLayer);
m_scrollingContentsLayer->setPosition(
- coordinatorHandlesOffset
- ? FloatPoint()
- : FloatPoint(-toFloatSize(scrollOffsetFromOrigin)));
+ coordinatorHandlesOffset ? FloatPoint()
+ : FloatPoint(-toFloatSize(scrollPosition)));
}
m_scrollingContentsOffset = scrollingContentsOffset;
@@ -2823,8 +2824,8 @@ void CompositedLayerMapping::adjustForCompositedScrolling(
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.
- IntPoint scrollPosition = scrollableArea->scrollPosition();
- offset.expand(-scrollPosition.x(), -scrollPosition.y());
+ ScrollOffset scrollOffset = scrollableArea->scrollOffset();
+ offset.expand(-scrollOffset.width(), -scrollOffset.height());
}
}
}

Powered by Google App Engine
This is Rietveld 408576698