| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/frame/RootFrameViewport.h" | 5 #include "core/frame/RootFrameViewport.h" |
| 6 | 6 |
| 7 #include "core/layout/ScrollAlignment.h" | 7 #include "core/layout/ScrollAlignment.h" |
| 8 #include "platform/geometry/DoubleRect.h" | 8 #include "platform/geometry/DoubleRect.h" |
| 9 #include "platform/geometry/LayoutRect.h" | 9 #include "platform/geometry/LayoutRect.h" |
| 10 #include "platform/scroll/ScrollableArea.h" | 10 #include "platform/scroll/ScrollableArea.h" |
| 11 #include "public/platform/Platform.h" |
| 12 #include "public/platform/WebScheduler.h" |
| 13 #include "public/platform/WebThread.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 15 |
| 13 #define EXPECT_POINT_EQ(expected, actual) \ | 16 #define EXPECT_POINT_EQ(expected, actual) \ |
| 14 do { \ | 17 do { \ |
| 15 EXPECT_EQ((expected).x(), (actual).x()); \ | 18 EXPECT_EQ((expected).x(), (actual).x()); \ |
| 16 EXPECT_EQ((expected).y(), (actual).y()); \ | 19 EXPECT_EQ((expected).y(), (actual).y()); \ |
| 17 } while (false) | 20 } while (false) |
| 18 #define EXPECT_SIZE_EQ(expected, actual) \ | 21 #define EXPECT_SIZE_EQ(expected, actual) \ |
| 19 do { \ | 22 do { \ |
| 20 EXPECT_EQ((expected).width(), (actual).width()); \ | 23 EXPECT_EQ((expected).width(), (actual).width()); \ |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 ScrollOffset minimumScrollOffset() const override { return ScrollOffset(); } | 64 ScrollOffset minimumScrollOffset() const override { return ScrollOffset(); } |
| 62 IntSize maximumScrollOffsetInt() const override { | 65 IntSize maximumScrollOffsetInt() const override { |
| 63 return flooredIntSize(maximumScrollOffset()); | 66 return flooredIntSize(maximumScrollOffset()); |
| 64 } | 67 } |
| 65 | 68 |
| 66 IntSize contentsSize() const override { return m_contentsSize; } | 69 IntSize contentsSize() const override { return m_contentsSize; } |
| 67 void setContentSize(const IntSize& contentsSize) { | 70 void setContentSize(const IntSize& contentsSize) { |
| 68 m_contentsSize = contentsSize; | 71 m_contentsSize = contentsSize; |
| 69 } | 72 } |
| 70 | 73 |
| 74 RefPtr<WebTaskRunner> getTimerTaskRunner() const final { |
| 75 return Platform::current()->currentThread()->scheduler()->timerTaskRunner(); |
| 76 } |
| 77 |
| 71 DEFINE_INLINE_VIRTUAL_TRACE() { ScrollableArea::trace(visitor); } | 78 DEFINE_INLINE_VIRTUAL_TRACE() { ScrollableArea::trace(visitor); } |
| 72 | 79 |
| 73 protected: | 80 protected: |
| 74 ScrollableAreaStub(const IntSize& viewportSize, const IntSize& contentsSize) | 81 ScrollableAreaStub(const IntSize& viewportSize, const IntSize& contentsSize) |
| 75 : m_userInputScrollableX(true), | 82 : m_userInputScrollableX(true), |
| 76 m_userInputScrollableY(true), | 83 m_userInputScrollableY(true), |
| 77 m_viewportSize(viewportSize), | 84 m_viewportSize(viewportSize), |
| 78 m_contentsSize(contentsSize) {} | 85 m_contentsSize(contentsSize) {} |
| 79 | 86 |
| 80 void updateScrollOffset(const ScrollOffset& offset, ScrollType) override { | 87 void updateScrollOffset(const ScrollOffset& offset, ScrollType) override { |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 EXPECT_SIZE_EQ(ScrollOffset(50, 50), visualViewport->getScrollOffset()); | 487 EXPECT_SIZE_EQ(ScrollOffset(50, 50), visualViewport->getScrollOffset()); |
| 481 EXPECT_SIZE_EQ(ScrollOffset(150, 150), alternateScroller->getScrollOffset()); | 488 EXPECT_SIZE_EQ(ScrollOffset(150, 150), alternateScroller->getScrollOffset()); |
| 482 EXPECT_SIZE_EQ(ScrollOffset(200, 200), rootFrameViewport->getScrollOffset()); | 489 EXPECT_SIZE_EQ(ScrollOffset(200, 200), rootFrameViewport->getScrollOffset()); |
| 483 EXPECT_SIZE_EQ(ScrollOffset(50, 50), layoutViewport->getScrollOffset()); | 490 EXPECT_SIZE_EQ(ScrollOffset(50, 50), layoutViewport->getScrollOffset()); |
| 484 | 491 |
| 485 EXPECT_SIZE_EQ(ScrollOffset(550, 450), | 492 EXPECT_SIZE_EQ(ScrollOffset(550, 450), |
| 486 rootFrameViewport->maximumScrollOffset()); | 493 rootFrameViewport->maximumScrollOffset()); |
| 487 } | 494 } |
| 488 | 495 |
| 489 } // namespace blink | 496 } // namespace blink |
| OLD | NEW |