OLD | NEW |
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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 void scrollControlWasSetNeedsPaintInvalidation() override {} | 177 void scrollControlWasSetNeedsPaintInvalidation() override {} |
178 bool userInputScrollable(ScrollbarOrientation) const override { return true; } | 178 bool userInputScrollable(ScrollbarOrientation) const override { return true; } |
179 bool shouldPlaceVerticalScrollbarOnLeft() const override { return false; } | 179 bool shouldPlaceVerticalScrollbarOnLeft() const override { return false; } |
180 int pageStep(ScrollbarOrientation) const override { return 0; } | 180 int pageStep(ScrollbarOrientation) const override { return 0; } |
181 IntPoint minimumScrollPosition() const override { return IntPoint(); } | 181 IntPoint minimumScrollPosition() const override { return IntPoint(); } |
182 IntPoint maximumScrollPosition() const override { | 182 IntPoint maximumScrollPosition() const override { |
183 return IntPoint(contentsSize().width() - visibleWidth(), | 183 return IntPoint(contentsSize().width() - visibleWidth(), |
184 contentsSize().height() - visibleHeight()); | 184 contentsSize().height() - visibleHeight()); |
185 } | 185 } |
186 | 186 |
187 void setScrollOffset(const DoublePoint& offset, ScrollType) override { | 187 void setScrollOffset(const DoublePoint& scrollOffset, ScrollType) override { |
188 m_scrollPosition = offset; | 188 m_scrollPosition = scrollOffset; |
189 } | 189 } |
190 DoublePoint scrollPositionDouble() const override { return m_scrollPosition; } | 190 DoublePoint scrollPositionDouble() const override { return m_scrollPosition; } |
191 IntPoint scrollPosition() const override { | 191 IntPoint scrollPosition() const override { |
192 return flooredIntPoint(m_scrollPosition); | 192 return flooredIntPoint(m_scrollPosition); |
193 } | 193 } |
194 | 194 |
195 DEFINE_INLINE_VIRTUAL_TRACE() { ScrollableArea::trace(visitor); } | 195 DEFINE_INLINE_VIRTUAL_TRACE() { ScrollableArea::trace(visitor); } |
196 | 196 |
197 private: | 197 private: |
198 DoublePoint m_scrollPosition; | 198 DoublePoint m_scrollPosition; |
199 }; | 199 }; |
200 | 200 |
201 TEST_F(GraphicsLayerTest, applyScrollToScrollableArea) { | 201 TEST_F(GraphicsLayerTest, applyScrollToScrollableArea) { |
202 FakeScrollableArea* scrollableArea = FakeScrollableArea::create(); | 202 FakeScrollableArea* scrollableArea = FakeScrollableArea::create(); |
203 m_graphicsLayer->setScrollableArea(scrollableArea, false); | 203 m_graphicsLayer->setScrollableArea(scrollableArea, false); |
204 | 204 |
205 WebDoublePoint scrollPosition(7, 9); | 205 WebDoublePoint scrollPosition(7, 9); |
206 m_platformLayer->setScrollPositionDouble(scrollPosition); | 206 m_platformLayer->setScrollPositionDouble(scrollPosition); |
207 m_graphicsLayer->didScroll(); | 207 m_graphicsLayer->didScroll(); |
208 | 208 |
209 EXPECT_FLOAT_EQ(scrollPosition.x, scrollableArea->scrollPositionDouble().x()); | 209 EXPECT_FLOAT_EQ(scrollPosition.x, scrollableArea->scrollPositionDouble().x()); |
210 EXPECT_FLOAT_EQ(scrollPosition.y, scrollableArea->scrollPositionDouble().y()); | 210 EXPECT_FLOAT_EQ(scrollPosition.y, scrollableArea->scrollPositionDouble().y()); |
211 } | 211 } |
212 | 212 |
213 } // namespace blink | 213 } // namespace blink |
OLD | NEW |