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