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

Unified Diff: third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.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/platform/graphics/GraphicsLayerTest.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp
index d269a493abcef160c3c1c161b928598ea7aa9e39..d42561297670e23ca2467a5b2d619c8f931a6720 100644
--- a/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp
@@ -177,36 +177,35 @@ class FakeScrollableArea : public GarbageCollectedFinalized<FakeScrollableArea>,
bool userInputScrollable(ScrollbarOrientation) const override { return true; }
bool shouldPlaceVerticalScrollbarOnLeft() const override { return false; }
int pageStep(ScrollbarOrientation) const override { return 0; }
- IntPoint minimumScrollPosition() const override { return IntPoint(); }
- IntPoint maximumScrollPosition() const override {
- return IntPoint(contentsSize().width() - visibleWidth(),
- contentsSize().height() - visibleHeight());
+ IntSize minimumScrollOffsetInt() const override { return IntSize(); }
+ IntSize maximumScrollOffsetInt() const override {
+ return contentsSize() - IntSize(visibleWidth(), visibleHeight());
}
- void updateScrollPosition(const DoublePoint& position, ScrollType) override {
- m_scrollPosition = position;
+ void updateScrollOffset(const ScrollOffset& offset, ScrollType) override {
+ m_scrollOffset = offset;
}
- DoublePoint scrollPositionDouble() const override { return m_scrollPosition; }
- IntPoint scrollPosition() const override {
- return flooredIntPoint(m_scrollPosition);
+ ScrollOffset scrollOffset() const override { return m_scrollOffset; }
+ IntSize scrollOffsetInt() const override {
+ return flooredIntSize(m_scrollOffset);
}
DEFINE_INLINE_VIRTUAL_TRACE() { ScrollableArea::trace(visitor); }
private:
- DoublePoint m_scrollPosition;
+ ScrollOffset m_scrollOffset;
};
TEST_F(GraphicsLayerTest, applyScrollToScrollableArea) {
FakeScrollableArea* scrollableArea = FakeScrollableArea::create();
m_graphicsLayer->setScrollableArea(scrollableArea, false);
- WebDoublePoint scrollPosition(7, 9);
- m_platformLayer->setScrollPositionDouble(scrollPosition);
+ WebFloatSize scrollOffset(7, 9);
+ m_platformLayer->setScrollOffset(scrollOffset);
m_graphicsLayer->didScroll();
- EXPECT_FLOAT_EQ(scrollPosition.x, scrollableArea->scrollPositionDouble().x());
- EXPECT_FLOAT_EQ(scrollPosition.y, scrollableArea->scrollPositionDouble().y());
+ EXPECT_FLOAT_EQ(scrollOffset.width, scrollableArea->scrollOffset().width());
+ EXPECT_FLOAT_EQ(scrollOffset.height, scrollableArea->scrollOffset().height());
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698