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

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

Issue 1158673006: Replace various ScrollableArea scroll methods with setScrollPosition (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Build fix Created 5 years, 6 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
« no previous file with comments | « Source/platform/graphics/GraphicsLayer.cpp ('k') | Source/platform/mac/ScrollAnimatorMac.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 virtual void invalidateScrollCornerRect(const IntRect&) override { } 140 virtual void invalidateScrollCornerRect(const IntRect&) override { }
141 virtual bool userInputScrollable(ScrollbarOrientation) const override { retu rn true; } 141 virtual bool userInputScrollable(ScrollbarOrientation) const override { retu rn true; }
142 virtual bool shouldPlaceVerticalScrollbarOnLeft() const override { return fa lse; } 142 virtual bool shouldPlaceVerticalScrollbarOnLeft() const override { return fa lse; }
143 virtual int pageStep(ScrollbarOrientation) const override { return 0; } 143 virtual int pageStep(ScrollbarOrientation) const override { return 0; }
144 virtual IntPoint minimumScrollPosition() const override { return IntPoint(); } 144 virtual IntPoint minimumScrollPosition() const override { return IntPoint(); }
145 virtual IntPoint maximumScrollPosition() const override 145 virtual IntPoint maximumScrollPosition() const override
146 { 146 {
147 return IntPoint(contentsSize().width() - visibleWidth(), contentsSize(). height() - visibleHeight()); 147 return IntPoint(contentsSize().width() - visibleWidth(), contentsSize(). height() - visibleHeight());
148 } 148 }
149 149
150 virtual void setScrollOffset(const IntPoint& scrollOffset) override { m_scro llPosition = scrollOffset; } 150 virtual void setScrollOffset(const IntPoint& scrollOffset, ScrollType) overr ide { m_scrollPosition = scrollOffset; }
151 virtual void setScrollOffset(const DoublePoint& scrollOffset) override { m_s crollPosition = scrollOffset; } 151 virtual void setScrollOffset(const DoublePoint& scrollOffset, ScrollType) ov erride { m_scrollPosition = scrollOffset; }
152 virtual DoublePoint scrollPositionDouble() const override { return m_scrollP osition; } 152 virtual DoublePoint scrollPositionDouble() const override { return m_scrollP osition; }
153 virtual IntPoint scrollPosition() const override { return flooredIntPoint(m_ scrollPosition); } 153 virtual IntPoint scrollPosition() const override { return flooredIntPoint(m_ scrollPosition); }
154 154
155 private: 155 private:
156 DoublePoint m_scrollPosition; 156 DoublePoint m_scrollPosition;
157 }; 157 };
158 158
159 TEST_F(GraphicsLayerTest, applyScrollToScrollableArea) 159 TEST_F(GraphicsLayerTest, applyScrollToScrollableArea)
160 { 160 {
161 FakeScrollableArea scrollableArea; 161 FakeScrollableArea scrollableArea;
162 m_graphicsLayer->setScrollableArea(&scrollableArea, false); 162 m_graphicsLayer->setScrollableArea(&scrollableArea, false);
163 163
164 WebDoublePoint scrollPosition(7, 9); 164 WebDoublePoint scrollPosition(7, 9);
165 m_platformLayer->setScrollPositionDouble(scrollPosition); 165 m_platformLayer->setScrollPositionDouble(scrollPosition);
166 m_graphicsLayer->didScroll(); 166 m_graphicsLayer->didScroll();
167 167
168 EXPECT_FLOAT_EQ(scrollPosition.x, scrollableArea.scrollPositionDouble().x()) ; 168 EXPECT_FLOAT_EQ(scrollPosition.x, scrollableArea.scrollPositionDouble().x()) ;
169 EXPECT_FLOAT_EQ(scrollPosition.y, scrollableArea.scrollPositionDouble().y()) ; 169 EXPECT_FLOAT_EQ(scrollPosition.y, scrollableArea.scrollPositionDouble().y()) ;
170 } 170 }
171 171
172 } // namespace 172 } // namespace
OLDNEW
« no previous file with comments | « Source/platform/graphics/GraphicsLayer.cpp ('k') | Source/platform/mac/ScrollAnimatorMac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698