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

Side by Side Diff: third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp

Issue 1406133005: Calculate paint invalidation rect for scrollbars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NeedsRebaselines for mac and windows etc Created 5 years, 1 month 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "config.h" 5 #include "config.h"
6 #include "platform/scroll/ScrollableArea.h" 6 #include "platform/scroll/ScrollableArea.h"
7 7
8 #include "platform/TestingPlatformSupport.h" 8 #include "platform/TestingPlatformSupport.h"
9 #include "public/platform/Platform.h" 9 #include "public/platform/Platform.h"
10 #include "public/platform/WebScheduler.h" 10 #include "public/platform/WebScheduler.h"
11 #include "public/platform/WebThread.h" 11 #include "public/platform/WebThread.h"
12 #include <gmock/gmock.h> 12 #include <gmock/gmock.h>
13 #include <gtest/gtest.h> 13 #include <gtest/gtest.h>
14 14
15 namespace blink { 15 namespace blink {
16 16
17 namespace { 17 namespace {
18 18
19 class MockScrollableArea : public NoBaseWillBeGarbageCollectedFinalized<MockScro llableArea>, public ScrollableArea { 19 class MockScrollableArea : public NoBaseWillBeGarbageCollectedFinalized<MockScro llableArea>, public ScrollableArea {
20 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MockScrollableArea); 20 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MockScrollableArea);
21 public: 21 public:
22 static PassOwnPtrWillBeRawPtr<MockScrollableArea> create(const IntPoint& max imumScrollPosition) 22 static PassOwnPtrWillBeRawPtr<MockScrollableArea> create(const IntPoint& max imumScrollPosition)
23 { 23 {
24 return adoptPtrWillBeNoop(new MockScrollableArea(maximumScrollPosition)) ; 24 return adoptPtrWillBeNoop(new MockScrollableArea(maximumScrollPosition)) ;
25 } 25 }
26 26
27 MOCK_CONST_METHOD0(isActive, bool()); 27 MOCK_CONST_METHOD0(isActive, bool());
28 MOCK_CONST_METHOD1(scrollSize, int(ScrollbarOrientation)); 28 MOCK_CONST_METHOD1(scrollSize, int(ScrollbarOrientation));
29 MOCK_METHOD2(invalidateScrollbar, void(Scrollbar*, const IntRect&));
30 MOCK_CONST_METHOD0(isScrollCornerVisible, bool()); 29 MOCK_CONST_METHOD0(isScrollCornerVisible, bool());
31 MOCK_CONST_METHOD0(scrollCornerRect, IntRect()); 30 MOCK_CONST_METHOD0(scrollCornerRect, IntRect());
32 MOCK_METHOD2(invalidateScrollbarRect, void(Scrollbar*, const IntRect&)); 31 MOCK_METHOD0(scrollControlWasSetNeedsPaintInvalidation, void());
33 MOCK_METHOD1(invalidateScrollCornerRect, void(const IntRect&));
34 MOCK_CONST_METHOD0(enclosingScrollableArea, ScrollableArea*()); 32 MOCK_CONST_METHOD0(enclosingScrollableArea, ScrollableArea*());
35 MOCK_CONST_METHOD1(visibleContentRect, IntRect(IncludeScrollbarsInRect)); 33 MOCK_CONST_METHOD1(visibleContentRect, IntRect(IncludeScrollbarsInRect));
36 MOCK_CONST_METHOD0(contentsSize, IntSize()); 34 MOCK_CONST_METHOD0(contentsSize, IntSize());
37 MOCK_CONST_METHOD0(scrollbarsCanBeActive, bool()); 35 MOCK_CONST_METHOD0(scrollbarsCanBeActive, bool());
38 MOCK_CONST_METHOD0(scrollableAreaBoundingBox, IntRect()); 36 MOCK_CONST_METHOD0(scrollableAreaBoundingBox, IntRect());
39 37
40 bool userInputScrollable(ScrollbarOrientation) const override { return true; } 38 bool userInputScrollable(ScrollbarOrientation) const override { return true; }
41 bool shouldPlaceVerticalScrollbarOnLeft() const override { return false; } 39 bool shouldPlaceVerticalScrollbarOnLeft() const override { return false; }
42 void setScrollOffset(const IntPoint& offset, ScrollType) override { m_scroll Position = offset.shrunkTo(m_maximumScrollPosition); } 40 void setScrollOffset(const IntPoint& offset, ScrollType) override { m_scroll Position = offset.shrunkTo(m_maximumScrollPosition); }
43 IntPoint scrollPosition() const override { return m_scrollPosition; } 41 IntPoint scrollPosition() const override { return m_scrollPosition; }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 }; 121 };
124 122
125 TEST_F(ScrollableAreaTest, ScrollAnimatorCurrentPositionShouldBeSync) 123 TEST_F(ScrollableAreaTest, ScrollAnimatorCurrentPositionShouldBeSync)
126 { 124 {
127 OwnPtrWillBeRawPtr<MockScrollableArea> scrollableArea = MockScrollableArea:: create(IntPoint(0, 100)); 125 OwnPtrWillBeRawPtr<MockScrollableArea> scrollableArea = MockScrollableArea:: create(IntPoint(0, 100));
128 scrollableArea->setScrollPosition(IntPoint(0, 10000), CompositorScroll); 126 scrollableArea->setScrollPosition(IntPoint(0, 10000), CompositorScroll);
129 EXPECT_EQ(100.0, scrollableArea->scrollAnimator()->currentPosition().y()); 127 EXPECT_EQ(100.0, scrollableArea->scrollAnimator()->currentPosition().y());
130 } 128 }
131 129
132 } // namespace blink 130 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698