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

Unified Diff: third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.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/scroll/ScrollableAreaTest.cpp
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp b/third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp
index 7ada8fe331049e9abcc28c606ee633f14f8a92d7..4615dcca16cbe63cd78a1d3637caf8a3f78bb749 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp
@@ -36,15 +36,15 @@ class ScrollableAreaTest : public ScrollbarTestSuite {};
TEST_F(ScrollableAreaTest, ScrollAnimatorCurrentPositionShouldBeSync) {
MockScrollableArea* scrollableArea =
- MockScrollableArea::create(IntPoint(0, 100));
- scrollableArea->setScrollPosition(IntPoint(0, 10000), CompositorScroll);
- EXPECT_EQ(100.0, scrollableArea->scrollAnimator().currentPosition().y());
+ MockScrollableArea::create(ScrollOffset(0, 100));
+ scrollableArea->setScrollOffset(ScrollOffset(0, 10000), CompositorScroll);
+ EXPECT_EQ(100.0, scrollableArea->scrollAnimator().currentOffset().height());
}
TEST_F(ScrollableAreaTest, ScrollbarTrackAndThumbRepaint) {
ScrollbarThemeWithMockInvalidation theme;
MockScrollableArea* scrollableArea =
- MockScrollableArea::create(IntPoint(0, 100));
+ MockScrollableArea::create(ScrollOffset(0, 100));
Scrollbar* scrollbar = Scrollbar::createForTesting(
scrollableArea, HorizontalScrollbar, RegularScrollbar, &theme);
@@ -83,7 +83,7 @@ TEST_F(ScrollableAreaTest, ScrollbarTrackAndThumbRepaint) {
TEST_F(ScrollableAreaTest, ScrollbarGraphicsLayerInvalidation) {
ScrollbarTheme::setMockScrollbarsEnabled(true);
MockScrollableArea* scrollableArea =
- MockScrollableArea::create(IntPoint(0, 100));
+ MockScrollableArea::create(ScrollOffset(0, 100));
FakeGraphicsLayerClient graphicsLayerClient;
graphicsLayerClient.setIsTrackingPaintInvalidations(true);
FakeGraphicsLayer graphicsLayer(&graphicsLayerClient);
@@ -106,7 +106,7 @@ TEST_F(ScrollableAreaTest, ScrollbarGraphicsLayerInvalidation) {
TEST_F(ScrollableAreaTest, InvalidatesNonCompositedScrollbarsWhenThumbMoves) {
ScrollbarThemeWithMockInvalidation theme;
MockScrollableArea* scrollableArea =
- MockScrollableArea::create(IntPoint(100, 100));
+ MockScrollableArea::create(ScrollOffset(100, 100));
Scrollbar* horizontalScrollbar = Scrollbar::createForTesting(
scrollableArea, HorizontalScrollbar, RegularScrollbar, &theme);
Scrollbar* verticalScrollbar = Scrollbar::createForTesting(
@@ -130,11 +130,11 @@ TEST_F(ScrollableAreaTest, InvalidatesNonCompositedScrollbarsWhenThumbMoves) {
.WillRepeatedly(Return(NoPart));
// A scroll in each direction should only invalidate one scrollbar.
- scrollableArea->setScrollPosition(DoublePoint(0, 50), ProgrammaticScroll);
+ scrollableArea->setScrollOffset(ScrollOffset(0, 50), ProgrammaticScroll);
EXPECT_FALSE(scrollableArea->horizontalScrollbarNeedsPaintInvalidation());
EXPECT_TRUE(scrollableArea->verticalScrollbarNeedsPaintInvalidation());
scrollableArea->clearNeedsPaintInvalidationForScrollControls();
- scrollableArea->setScrollPosition(DoublePoint(50, 50), ProgrammaticScroll);
+ scrollableArea->setScrollOffset(ScrollOffset(50, 50), ProgrammaticScroll);
EXPECT_TRUE(scrollableArea->horizontalScrollbarNeedsPaintInvalidation());
EXPECT_FALSE(scrollableArea->verticalScrollbarNeedsPaintInvalidation());
scrollableArea->clearNeedsPaintInvalidationForScrollControls();
@@ -146,7 +146,7 @@ TEST_F(ScrollableAreaTest, InvalidatesNonCompositedScrollbarsWhenThumbMoves) {
TEST_F(ScrollableAreaTest, InvalidatesCompositedScrollbarsIfPartsNeedRepaint) {
ScrollbarThemeWithMockInvalidation theme;
MockScrollableArea* scrollableArea =
- MockScrollableArea::create(IntPoint(100, 100));
+ MockScrollableArea::create(ScrollOffset(100, 100));
Scrollbar* horizontalScrollbar = Scrollbar::createForTesting(
scrollableArea, HorizontalScrollbar, RegularScrollbar, &theme);
horizontalScrollbar->clearTrackNeedsRepaint();
@@ -183,7 +183,7 @@ TEST_F(ScrollableAreaTest, InvalidatesCompositedScrollbarsIfPartsNeedRepaint) {
// the back button (i.e. the track).
EXPECT_CALL(theme, invalidateOnThumbPositionChange(_, _, _))
.WillOnce(Return(BackButtonStartPart));
- scrollableArea->setScrollPosition(DoublePoint(50, 0), ProgrammaticScroll);
+ scrollableArea->setScrollOffset(ScrollOffset(50, 0), ProgrammaticScroll);
EXPECT_TRUE(layerForHorizontalScrollbar.hasTrackedPaintInvalidations());
EXPECT_FALSE(layerForVerticalScrollbar.hasTrackedPaintInvalidations());
EXPECT_TRUE(horizontalScrollbar->trackNeedsRepaint());
@@ -194,7 +194,7 @@ TEST_F(ScrollableAreaTest, InvalidatesCompositedScrollbarsIfPartsNeedRepaint) {
// Next, we'll scroll vertically, but invalidate the thumb.
EXPECT_CALL(theme, invalidateOnThumbPositionChange(_, _, _))
.WillOnce(Return(ThumbPart));
- scrollableArea->setScrollPosition(DoublePoint(50, 50), ProgrammaticScroll);
+ scrollableArea->setScrollOffset(ScrollOffset(50, 50), ProgrammaticScroll);
EXPECT_FALSE(layerForHorizontalScrollbar.hasTrackedPaintInvalidations());
EXPECT_TRUE(layerForVerticalScrollbar.hasTrackedPaintInvalidations());
EXPECT_FALSE(verticalScrollbar->trackNeedsRepaint());
@@ -209,7 +209,7 @@ TEST_F(ScrollableAreaTest, InvalidatesCompositedScrollbarsIfPartsNeedRepaint) {
EXPECT_CALL(theme, invalidateOnThumbPositionChange(_, _, _))
.Times(2)
.WillRepeatedly(Return(NoPart));
- scrollableArea->setScrollPosition(DoublePoint(70, 70), ProgrammaticScroll);
+ scrollableArea->setScrollOffset(ScrollOffset(70, 70), ProgrammaticScroll);
EXPECT_TRUE(layerForHorizontalScrollbar.hasTrackedPaintInvalidations());
EXPECT_TRUE(layerForVerticalScrollbar.hasTrackedPaintInvalidations());
EXPECT_FALSE(horizontalScrollbar->trackNeedsRepaint());
@@ -223,7 +223,7 @@ TEST_F(ScrollableAreaTest, InvalidatesCompositedScrollbarsIfPartsNeedRepaint) {
TEST_F(ScrollableAreaTest, RecalculatesScrollbarOverlayIfBackgroundChanges) {
MockScrollableArea* scrollableArea =
- MockScrollableArea::create(IntPoint(0, 100));
+ MockScrollableArea::create(ScrollOffset(0, 100));
EXPECT_EQ(ScrollbarOverlayStyleDefault,
scrollableArea->getScrollbarOverlayStyle());

Powered by Google App Engine
This is Rietveld 408576698