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

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

Issue 1220583004: Refactor DrawingRecorders to check for cached drawings earlier (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 5 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
« no previous file with comments | « Source/platform/scroll/ScrollbarTheme.cpp ('k') | Source/platform/scroll/ScrollbarThemeMacCommon.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/scroll/ScrollbarThemeAura.cpp
diff --git a/Source/platform/scroll/ScrollbarThemeAura.cpp b/Source/platform/scroll/ScrollbarThemeAura.cpp
index 9354c27f7db73c4f311ebbd1693b9b1c6011dd02..09190ff1e700d07ae8c91efa9dc6a71195e4efcd 100644
--- a/Source/platform/scroll/ScrollbarThemeAura.cpp
+++ b/Source/platform/scroll/ScrollbarThemeAura.cpp
@@ -72,15 +72,17 @@ int ScrollbarThemeAura::scrollbarThickness(ScrollbarControlSize controlSize)
void ScrollbarThemeAura::paintTrackPiece(GraphicsContext* gc, ScrollbarThemeClient* scrollbar, const IntRect& rect, ScrollbarPart partType)
{
+ DisplayItem::Type displayItemType = trackPiecePartToDisplayItemType(partType);
+ if (DrawingRecorder::useCachedDrawingIfPossible(*gc, *scrollbar, displayItemType))
+ return;
+
+ DrawingRecorder recorder(*gc, *scrollbar, displayItemType, rect);
+
WebThemeEngine::State state = scrollbar->hoveredPart() == partType ? WebThemeEngine::StateHover : WebThemeEngine::StateNormal;
if (useMockTheme() && !scrollbar->enabled())
state = WebThemeEngine::StateDisabled;
- DrawingRecorder recorder(*gc, *scrollbar, trackPiecePartToDisplayItemType(partType), rect);
- if (recorder.canUseCachedDrawing())
- return;
-
IntRect alignRect = trackRect(scrollbar, false);
WebThemeEngine::ExtraParams extraParams;
extraParams.scrollbarTrack.isBack = (partType == BackTrackPart);
@@ -120,10 +122,12 @@ void ScrollbarThemeAura::paintButton(GraphicsContext* gc, ScrollbarThemeClient*
}
}
- DrawingRecorder recorder(*gc, *scrollbar, buttonPartToDisplayItemType(part), rect);
- if (recorder.canUseCachedDrawing())
+ DisplayItem::Type displayItemType = buttonPartToDisplayItemType(part);
+ if (DrawingRecorder::useCachedDrawingIfPossible(*gc, *scrollbar, displayItemType))
return;
+ DrawingRecorder recorder(*gc, *scrollbar, displayItemType, rect);
+
if (useMockTheme() && !scrollbar->enabled()) {
state = WebThemeEngine::StateDisabled;
} else if (!useMockTheme() && ((checkMin && (scrollbar->currentPos() <= 0))
@@ -140,10 +144,11 @@ void ScrollbarThemeAura::paintButton(GraphicsContext* gc, ScrollbarThemeClient*
void ScrollbarThemeAura::paintThumb(GraphicsContext* gc, ScrollbarThemeClient* scrollbar, const IntRect& rect)
{
- DrawingRecorder recorder(*gc, *scrollbar, DisplayItem::ScrollbarThumb, rect);
- if (recorder.canUseCachedDrawing())
+ if (DrawingRecorder::useCachedDrawingIfPossible(*gc, *scrollbar, DisplayItem::ScrollbarThumb))
return;
+ DrawingRecorder recorder(*gc, *scrollbar, DisplayItem::ScrollbarThumb, rect);
+
WebThemeEngine::State state;
WebCanvas* canvas = gc->canvas();
if (scrollbar->pressedPart() == ThumbPart)
« no previous file with comments | « Source/platform/scroll/ScrollbarTheme.cpp ('k') | Source/platform/scroll/ScrollbarThemeMacCommon.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698