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

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

Issue 2835403002: Call ScrollableArea::ShowOverlayScrollbars for explicit scrolls only. (Closed)
Patch Set: fix VisualViewport Created 3 years, 7 months 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "platform/scroll/ScrollbarThemeOverlay.h" 5 #include "platform/scroll/ScrollbarThemeOverlay.h"
6 6
7 #include "platform/scroll/ScrollbarTestSuite.h" 7 #include "platform/scroll/ScrollbarTestSuite.h"
8 #include "platform/testing/TestingPlatformSupport.h" 8 #include "platform/testing/TestingPlatformSupport.h"
9 9
10 namespace blink { 10 namespace blink {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 mock_scrollable_area->ClearNeedsPaintInvalidationForScrollControls(); 108 mock_scrollable_area->ClearNeedsPaintInvalidationForScrollControls();
109 109
110 // Move off should cause invalidation 110 // Move off should cause invalidation
111 vertical_scrollbar->SetHoveredPart(kNoPart); 111 vertical_scrollbar->SetHoveredPart(kNoPart);
112 EXPECT_TRUE(vertical_scrollbar->ThumbNeedsRepaint()); 112 EXPECT_TRUE(vertical_scrollbar->ThumbNeedsRepaint());
113 EXPECT_TRUE(mock_scrollable_area->VerticalScrollbarNeedsPaintInvalidation()); 113 EXPECT_TRUE(mock_scrollable_area->VerticalScrollbarNeedsPaintInvalidation());
114 114
115 vertical_scrollbar->ClearThumbNeedsRepaint(); 115 vertical_scrollbar->ClearThumbNeedsRepaint();
116 mock_scrollable_area->ClearNeedsPaintInvalidationForScrollControls(); 116 mock_scrollable_area->ClearNeedsPaintInvalidationForScrollControls();
117 117
118 // Disabling the scrollbar is used to hide it so it should cause invalidation 118 // Hiding the scrollbar should invalidate the layer (SetNeedsDisplay) but not
119 // but only in the general sense since the compositor will have hidden it 119 // trigger repaint of the thumb resouce, since the compositor will give the
120 // without a repaint. 120 // entire layer opacity 0.
121 EXPECT_CALL(*mock_scrollable_area, ScrollbarsHidden()).WillOnce(Return(true));
121 vertical_scrollbar->SetEnabled(false); 122 vertical_scrollbar->SetEnabled(false);
122 EXPECT_FALSE(vertical_scrollbar->ThumbNeedsRepaint()); 123 EXPECT_FALSE(vertical_scrollbar->ThumbNeedsRepaint());
123 EXPECT_TRUE(mock_scrollable_area->VerticalScrollbarNeedsPaintInvalidation()); 124 EXPECT_TRUE(mock_scrollable_area->VerticalScrollbarNeedsPaintInvalidation());
124 125
125 mock_scrollable_area->ClearNeedsPaintInvalidationForScrollControls(); 126 mock_scrollable_area->ClearNeedsPaintInvalidationForScrollControls();
126 127
128 // Showing the scrollbar needs to repaint the thumb resource, since it may
129 // have been repainted in the disabled state while hidden (e.g. from
130 // SetProportion on bounds changes).
131 EXPECT_CALL(*mock_scrollable_area, ScrollbarsHidden())
132 .WillOnce(Return(false));
127 vertical_scrollbar->SetEnabled(true); 133 vertical_scrollbar->SetEnabled(true);
128 EXPECT_FALSE(vertical_scrollbar->ThumbNeedsRepaint()); 134 EXPECT_TRUE(vertical_scrollbar->ThumbNeedsRepaint());
129 EXPECT_TRUE(mock_scrollable_area->VerticalScrollbarNeedsPaintInvalidation()); 135 EXPECT_TRUE(mock_scrollable_area->VerticalScrollbarNeedsPaintInvalidation());
130 136
131 ThreadState::Current()->CollectAllGarbage(); 137 ThreadState::Current()->CollectAllGarbage();
132 } 138 }
133 139
134 } // namespace blink 140 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698