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

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

Issue 1422493003: Change Widget subclasses to use a CullRect instead of an IntRect for painting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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: third_party/WebKit/Source/platform/scroll/ScrollbarTheme.cpp
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollbarTheme.cpp b/third_party/WebKit/Source/platform/scroll/ScrollbarTheme.cpp
index ee46dc0bb80bb92d5c64f014753f001f9a5efbb5..9a1b08e5f1e06dd64991235e9f8b697a7a429875 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollbarTheme.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollbarTheme.cpp
@@ -30,6 +30,7 @@
#include "platform/RuntimeEnabledFeatures.h"
#include "platform/graphics/Color.h"
#include "platform/graphics/GraphicsContext.h"
+#include "platform/graphics/paint/CullRect.h"
#include "platform/graphics/paint/DrawingDisplayItem.h"
#include "platform/graphics/paint/DrawingRecorder.h"
#include "platform/graphics/paint/PaintController.h"
@@ -50,14 +51,14 @@ namespace blink {
bool ScrollbarTheme::gMockScrollbarsEnabled = false;
-static inline bool shouldPaintScrollbarPart(const IntRect& partRect, const IntRect& damageRect)
+static inline bool shouldPaintScrollbarPart(const IntRect& partRect, const CullRect& cullRect)
{
- return (!partRect.isEmpty()) || damageRect.intersects(partRect);
+ return (!partRect.isEmpty()) || cullRect.intersectsCullRect(partRect);
}
-bool ScrollbarTheme::paint(const ScrollbarThemeClient* scrollbar, GraphicsContext* graphicsContext, const IntRect& damageRect)
+bool ScrollbarTheme::paint(const ScrollbarThemeClient* scrollbar, GraphicsContext* graphicsContext, const CullRect& cullRect)
{
- // Create the ScrollbarControlPartMask based on the damageRect
+ // Create the ScrollbarControlPartMask based on the cullRect
ScrollbarControlPartMask scrollMask = NoPart;
IntRect backButtonStartPaintRect;
@@ -66,16 +67,16 @@ bool ScrollbarTheme::paint(const ScrollbarThemeClient* scrollbar, GraphicsContex
IntRect forwardButtonEndPaintRect;
if (hasButtons(scrollbar)) {
backButtonStartPaintRect = backButtonRect(scrollbar, BackButtonStartPart, true);
- if (shouldPaintScrollbarPart(backButtonStartPaintRect, damageRect))
+ if (shouldPaintScrollbarPart(backButtonStartPaintRect, cullRect))
scrollMask |= BackButtonStartPart;
backButtonEndPaintRect = backButtonRect(scrollbar, BackButtonEndPart, true);
- if (shouldPaintScrollbarPart(backButtonEndPaintRect, damageRect))
+ if (shouldPaintScrollbarPart(backButtonEndPaintRect, cullRect))
scrollMask |= BackButtonEndPart;
forwardButtonStartPaintRect = forwardButtonRect(scrollbar, ForwardButtonStartPart, true);
- if (shouldPaintScrollbarPart(forwardButtonStartPaintRect, damageRect))
+ if (shouldPaintScrollbarPart(forwardButtonStartPaintRect, cullRect))
scrollMask |= ForwardButtonStartPart;
forwardButtonEndPaintRect = forwardButtonRect(scrollbar, ForwardButtonEndPart, true);
- if (shouldPaintScrollbarPart(forwardButtonEndPaintRect, damageRect))
+ if (shouldPaintScrollbarPart(forwardButtonEndPaintRect, cullRect))
scrollMask |= ForwardButtonEndPart;
}
@@ -88,11 +89,11 @@ bool ScrollbarTheme::paint(const ScrollbarThemeClient* scrollbar, GraphicsContex
if (thumbPresent) {
IntRect track = trackRect(scrollbar);
splitTrack(scrollbar, track, startTrackRect, thumbRect, endTrackRect);
- if (shouldPaintScrollbarPart(thumbRect, damageRect))
+ if (shouldPaintScrollbarPart(thumbRect, cullRect))
scrollMask |= ThumbPart;
- if (shouldPaintScrollbarPart(startTrackRect, damageRect))
+ if (shouldPaintScrollbarPart(startTrackRect, cullRect))
scrollMask |= BackTrackPart;
- if (shouldPaintScrollbarPart(endTrackRect, damageRect))
+ if (shouldPaintScrollbarPart(endTrackRect, cullRect))
scrollMask |= ForwardTrackPart;
}

Powered by Google App Engine
This is Rietveld 408576698