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

Unified Diff: third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp

Issue 1458703010: Mac: Don't repaint scrollbars every frame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master2
Patch Set: Fix typo for real 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp b/third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp
index 13487d835d657377cc8cd2af7d229436487fdd1a..ac80728789b86a04cf08729f922f21849d81794a 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp
@@ -5,6 +5,8 @@
#include "config.h"
#include "platform/scroll/ScrollableArea.h"
+#include "platform/scroll/ScrollbarTheme.h"
+#include "platform/scroll/ScrollbarThemeMock.h"
#include "platform/testing/TestingPlatformSupport.h"
#include "public/platform/Platform.h"
#include "public/platform/WebScheduler.h"
@@ -127,4 +129,36 @@ TEST_F(ScrollableAreaTest, ScrollAnimatorCurrentPositionShouldBeSync)
EXPECT_EQ(100.0, scrollableArea->scrollAnimator()->currentPosition().y());
}
+TEST_F(ScrollableAreaTest, ScrollbarTrackAndThumbRepaint)
chrishtr 2015/11/24 21:15:12 This doesn't test the mac code...
ccameron 2015/11/25 00:23:02 You're referring to ScrollAnimatorMac? I put quite
+{
+ ScrollbarTheme::setMockScrollbarsEnabled(true);
+ ScrollbarThemeMock::setShouldRepaintAllPartsOnInvalidation(true);
+
+ OwnPtrWillBeRawPtr<MockScrollableArea> scrollableArea = MockScrollableArea::create(IntPoint(0, 100));
+ RefPtrWillBeRawPtr<Scrollbar> scrollbar = Scrollbar::create(scrollableArea.get(), HorizontalScrollbar, RegularScrollbar);
+
+ EXPECT_TRUE(scrollbar->trackBackgroundNeedsRepaint());
+ EXPECT_TRUE(scrollbar->thumbNeedsRepaint());
+ scrollbar->setNeedsPaintInvalidation();
+ EXPECT_TRUE(scrollbar->trackBackgroundNeedsRepaint());
+ EXPECT_TRUE(scrollbar->thumbNeedsRepaint());
+
+ scrollbar->setTrackBackgroundNeedsRepaint(false);
+ scrollbar->setThumbNeedsRepaint(false);
+ EXPECT_FALSE(scrollbar->trackBackgroundNeedsRepaint());
+ EXPECT_FALSE(scrollbar->thumbNeedsRepaint());
+ scrollbar->setNeedsPaintInvalidation();
+ EXPECT_TRUE(scrollbar->trackBackgroundNeedsRepaint());
+ EXPECT_TRUE(scrollbar->thumbNeedsRepaint());
+
+ ScrollbarThemeMock::setShouldRepaintAllPartsOnInvalidation(false);
+ scrollbar->setTrackBackgroundNeedsRepaint(false);
+ scrollbar->setThumbNeedsRepaint(false);
+ EXPECT_FALSE(scrollbar->trackBackgroundNeedsRepaint());
+ EXPECT_FALSE(scrollbar->thumbNeedsRepaint());
+ scrollbar->setNeedsPaintInvalidation();
+ EXPECT_FALSE(scrollbar->trackBackgroundNeedsRepaint());
+ EXPECT_FALSE(scrollbar->thumbNeedsRepaint());
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698