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

Side by Side Diff: Source/platform/scroll/ScrollbarTheme.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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2011 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 } 208 }
209 result.moveBy(-scrollbar->location()); 209 result.moveBy(-scrollbar->location());
210 scrollbar->invalidateRect(result); 210 scrollbar->invalidateRect(result);
211 } 211 }
212 212
213 void ScrollbarTheme::paintScrollCorner(GraphicsContext* context, const DisplayIt emClientWrapper& displayItemClient, const IntRect& cornerRect) 213 void ScrollbarTheme::paintScrollCorner(GraphicsContext* context, const DisplayIt emClientWrapper& displayItemClient, const IntRect& cornerRect)
214 { 214 {
215 if (cornerRect.isEmpty()) 215 if (cornerRect.isEmpty())
216 return; 216 return;
217 217
218 DrawingRecorder recorder(*context, displayItemClient, DisplayItem::Scrollbar Corner, cornerRect); 218 if (DrawingRecorder::useCachedDrawingIfPossible(*context, displayItemClient, DisplayItem::ScrollbarCorner))
219 if (recorder.canUseCachedDrawing())
220 return; 219 return;
221 220
221 DrawingRecorder recorder(*context, displayItemClient, DisplayItem::Scrollbar Corner, cornerRect);
222 #if OS(MACOSX) 222 #if OS(MACOSX)
223 context->fillRect(cornerRect, Color::white); 223 context->fillRect(cornerRect, Color::white);
224 #else 224 #else
225 Platform::current()->themeEngine()->paint(context->canvas(), WebThemeEngine: :PartScrollbarCorner, WebThemeEngine::StateNormal, WebRect(cornerRect), 0); 225 Platform::current()->themeEngine()->paint(context->canvas(), WebThemeEngine: :PartScrollbarCorner, WebThemeEngine::StateNormal, WebRect(cornerRect), 0);
226 #endif 226 #endif
227 } 227 }
228 228
229 bool ScrollbarTheme::shouldCenterOnThumb(ScrollbarThemeClient* scrollbar, const PlatformMouseEvent& evt) 229 bool ScrollbarTheme::shouldCenterOnThumb(ScrollbarThemeClient* scrollbar, const PlatformMouseEvent& evt)
230 { 230 {
231 return Platform::current()->scrollbarBehavior()->shouldCenterOnThumb(static_ cast<WebScrollbarBehavior::Button>(evt.button()), evt.shiftKey(), evt.altKey()); 231 return Platform::current()->scrollbarBehavior()->shouldCenterOnThumb(static_ cast<WebScrollbarBehavior::Button>(evt.button()), evt.shiftKey(), evt.altKey());
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 return DisplayItem::ScrollbarBackTrack; 372 return DisplayItem::ScrollbarBackTrack;
373 case ForwardTrackPart: 373 case ForwardTrackPart:
374 return DisplayItem::ScrollbarForwardTrack; 374 return DisplayItem::ScrollbarForwardTrack;
375 default: 375 default:
376 ASSERT_NOT_REACHED(); 376 ASSERT_NOT_REACHED();
377 return DisplayItem::ScrollbarBackTrack; 377 return DisplayItem::ScrollbarBackTrack;
378 } 378 }
379 } 379 }
380 380
381 } // namespace blink 381 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/graphics/paint/DrawingRecorder.cpp ('k') | Source/platform/scroll/ScrollbarThemeAura.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698