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

Unified Diff: Source/platform/scroll/ScrollbarTheme.cpp

Issue 1154993004: Don't paint empty scrollbar parts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/platform/scroll/ScrollbarTheme.cpp
diff --git a/Source/platform/scroll/ScrollbarTheme.cpp b/Source/platform/scroll/ScrollbarTheme.cpp
index d28399988d7b96e52cc92b5082e174bdca9e97d6..fc6983b5f96fb1772aa8c895326212515bed62e9 100644
--- a/Source/platform/scroll/ScrollbarTheme.cpp
+++ b/Source/platform/scroll/ScrollbarTheme.cpp
@@ -50,6 +50,11 @@ namespace blink {
bool ScrollbarTheme::gMockScrollbarsEnabled = false;
+static inline bool shouldPaintScrollbarPart(const IntRect& partRect, const IntRect& damageRect)
+{
+ return (RuntimeEnabledFeatures::slimmingPaintEnabled() && !partRect.isEmpty()) || damageRect.intersects(partRect);
+}
+
bool ScrollbarTheme::paint(ScrollbarThemeClient* scrollbar, GraphicsContext* graphicsContext, const IntRect& damageRect)
{
// Create the ScrollbarControlPartMask based on the damageRect
@@ -61,16 +66,16 @@ bool ScrollbarTheme::paint(ScrollbarThemeClient* scrollbar, GraphicsContext* gra
IntRect forwardButtonEndPaintRect;
if (hasButtons(scrollbar)) {
backButtonStartPaintRect = backButtonRect(scrollbar, BackButtonStartPart, true);
- if (RuntimeEnabledFeatures::slimmingPaintEnabled() || damageRect.intersects(backButtonStartPaintRect))
+ if (shouldPaintScrollbarPart(backButtonStartPaintRect, damageRect))
scrollMask |= BackButtonStartPart;
backButtonEndPaintRect = backButtonRect(scrollbar, BackButtonEndPart, true);
- if (RuntimeEnabledFeatures::slimmingPaintEnabled() || damageRect.intersects(backButtonEndPaintRect))
+ if (shouldPaintScrollbarPart(backButtonEndPaintRect, damageRect))
scrollMask |= BackButtonEndPart;
forwardButtonStartPaintRect = forwardButtonRect(scrollbar, ForwardButtonStartPart, true);
- if (RuntimeEnabledFeatures::slimmingPaintEnabled() || damageRect.intersects(forwardButtonStartPaintRect))
+ if (shouldPaintScrollbarPart(forwardButtonStartPaintRect, damageRect))
scrollMask |= ForwardButtonStartPart;
forwardButtonEndPaintRect = forwardButtonRect(scrollbar, ForwardButtonEndPart, true);
- if (RuntimeEnabledFeatures::slimmingPaintEnabled() || damageRect.intersects(forwardButtonEndPaintRect))
+ if (shouldPaintScrollbarPart(forwardButtonEndPaintRect, damageRect))
scrollMask |= ForwardButtonEndPart;
}
@@ -84,11 +89,11 @@ bool ScrollbarTheme::paint(ScrollbarThemeClient* scrollbar, GraphicsContext* gra
if (thumbPresent) {
IntRect track = trackRect(scrollbar);
splitTrack(scrollbar, track, startTrackRect, thumbRect, endTrackRect);
- if (RuntimeEnabledFeatures::slimmingPaintEnabled() || damageRect.intersects(thumbRect))
+ if (shouldPaintScrollbarPart(thumbRect, damageRect))
scrollMask |= ThumbPart;
- if (RuntimeEnabledFeatures::slimmingPaintEnabled() || damageRect.intersects(startTrackRect))
+ if (shouldPaintScrollbarPart(startTrackRect, damageRect))
scrollMask |= BackTrackPart;
- if (RuntimeEnabledFeatures::slimmingPaintEnabled() || damageRect.intersects(endTrackRect))
+ if (shouldPaintScrollbarPart(endTrackRect, damageRect))
scrollMask |= ForwardTrackPart;
}
« Source/core/paint/ScrollableAreaPainter.cpp ('K') | « Source/core/paint/ScrollableAreaPainter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698