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