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

Unified Diff: third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.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/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 89bd506d83926764001d7f1f13959dd0defa49b6..f8c07de75bb1911cf232af397fd862a3a4a9446f 100644
--- a/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp
@@ -178,24 +178,23 @@ 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 setScrollOffset(const DoublePoint& offset, ScrollType) override {
- m_scrollPosition = offset;
+ 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) {
@@ -206,8 +205,8 @@ TEST_F(GraphicsLayerTest, applyScrollToScrollableArea) {
m_platformLayer->setScrollPositionDouble(scrollPosition);
m_graphicsLayer->didScroll();
- EXPECT_FLOAT_EQ(scrollPosition.x, scrollableArea->scrollPositionDouble().x());
- EXPECT_FLOAT_EQ(scrollPosition.y, scrollableArea->scrollPositionDouble().y());
+ EXPECT_FLOAT_EQ(scrollPosition.x, scrollableArea->scrollOffset().width());
+ EXPECT_FLOAT_EQ(scrollPosition.y, scrollableArea->scrollOffset().height());
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698