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

Side by Side Diff: Source/platform/graphics/GraphicsLayerTest.cpp

Issue 629583002: Make compositor and blink talk in fractional scroll offset (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 virtual bool userInputScrollable(ScrollbarOrientation) const override { retu rn true; } 139 virtual bool userInputScrollable(ScrollbarOrientation) const override { retu rn true; }
140 virtual bool shouldPlaceVerticalScrollbarOnLeft() const override { return fa lse; } 140 virtual bool shouldPlaceVerticalScrollbarOnLeft() const override { return fa lse; }
141 virtual int pageStep(ScrollbarOrientation) const override { return 0; } 141 virtual int pageStep(ScrollbarOrientation) const override { return 0; }
142 virtual IntPoint minimumScrollPosition() const override { return IntPoint(); } 142 virtual IntPoint minimumScrollPosition() const override { return IntPoint(); }
143 virtual IntPoint maximumScrollPosition() const override 143 virtual IntPoint maximumScrollPosition() const override
144 { 144 {
145 return IntPoint(contentsSize().width() - visibleWidth(), contentsSize(). height() - visibleHeight()); 145 return IntPoint(contentsSize().width() - visibleWidth(), contentsSize(). height() - visibleHeight());
146 } 146 }
147 147
148 virtual void setScrollOffset(const IntPoint& scrollOffset) override { m_scro llPosition = scrollOffset; } 148 virtual void setScrollOffset(const IntPoint& scrollOffset) override { m_scro llPosition = scrollOffset; }
149 virtual IntPoint scrollPosition() const override { return m_scrollPosition; } 149 virtual void setScrollOffset(const DoublePoint& scrollOffset) override { m_s crollPosition = scrollOffset; }
150 virtual DoublePoint scrollPositionDouble() const override { return m_scrollP osition; }
151 virtual IntPoint scrollPosition() const override { return flooredIntPoint(m_ scrollPosition); }
150 152
151 private: 153 private:
152 IntPoint m_scrollPosition; 154 DoublePoint m_scrollPosition;
153 }; 155 };
154 156
155 TEST_F(GraphicsLayerTest, applyScrollToScrollableArea) 157 TEST_F(GraphicsLayerTest, applyScrollToScrollableArea)
156 { 158 {
157 FakeScrollableArea scrollableArea; 159 FakeScrollableArea scrollableArea;
158 m_graphicsLayer->setScrollableArea(&scrollableArea, false); 160 m_graphicsLayer->setScrollableArea(&scrollableArea, false);
159 161
160 WebPoint scrollPosition(7, 9); 162 WebDoublePoint scrollPosition(7.2, 9.6);
161 m_platformLayer->setScrollPosition(scrollPosition); 163 m_platformLayer->setScrollPositionDouble(scrollPosition);
162 m_graphicsLayer->didScroll(); 164 m_graphicsLayer->didScroll();
163 165
164 EXPECT_EQ(scrollPosition, WebPoint(scrollableArea.scrollPosition())); 166 EXPECT_FLOAT_EQ(scrollPosition.x, scrollableArea.scrollPositionDouble().x()) ;
167 EXPECT_FLOAT_EQ(scrollPosition.y, scrollableArea.scrollPositionDouble().y()) ;
165 } 168 }
166 169
167 } // namespace 170 } // namespace
OLDNEW
« no previous file with comments | « Source/platform/graphics/GraphicsLayer.cpp ('k') | Source/web/tests/ScrollingCoordinatorChromiumTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698