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

Side by Side Diff: Source/platform/scroll/ScrollbarThemeMacCommon.mm

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) 2008, 2011 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008, 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 return; 144 return;
145 145
146 if (rect.height() <= 0 || rect.width() <= 0) 146 if (rect.height() <= 0 || rect.width() <= 0)
147 return; 147 return;
148 148
149 Vector<IntRect> tickmarks; 149 Vector<IntRect> tickmarks;
150 scrollbar->getTickmarks(tickmarks); 150 scrollbar->getTickmarks(tickmarks);
151 if (!tickmarks.size()) 151 if (!tickmarks.size())
152 return; 152 return;
153 153
154 if (DrawingRecorder::useCachedDrawingIfPossible(*context, *scrollbar, Displa yItem::ScrollbarTickmarks))
155 return;
156
154 DrawingRecorder recorder(*context, *scrollbar, DisplayItem::ScrollbarTickmar ks, rect); 157 DrawingRecorder recorder(*context, *scrollbar, DisplayItem::ScrollbarTickmar ks, rect);
155 if (recorder.canUseCachedDrawing())
156 return;
157 158
158 // Inset a bit. 159 // Inset a bit.
159 IntRect tickmarkTrackRect = rect; 160 IntRect tickmarkTrackRect = rect;
160 tickmarkTrackRect.setX(tickmarkTrackRect.x() + 1); 161 tickmarkTrackRect.setX(tickmarkTrackRect.x() + 1);
161 tickmarkTrackRect.setWidth(tickmarkTrackRect.width() - 2); 162 tickmarkTrackRect.setWidth(tickmarkTrackRect.width() - 2);
162 paintGivenTickmarks(context->canvas(), scrollbar, tickmarkTrackRect, tickmar ks); 163 paintGivenTickmarks(context->canvas(), scrollbar, tickmarkTrackRect, tickmar ks);
163 } 164 }
164 165
165 ScrollbarThemeMacCommon::~ScrollbarThemeMacCommon() 166 ScrollbarThemeMacCommon::~ScrollbarThemeMacCommon()
166 { 167 {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 // static 233 // static
233 bool ScrollbarThemeMacCommon::isOverlayAPIAvailable() 234 bool ScrollbarThemeMacCommon::isOverlayAPIAvailable()
234 { 235 {
235 static bool apiAvailable = 236 static bool apiAvailable =
236 [NSClassFromString(@"NSScrollerImp") respondsToSelector:@selector(scroll erImpWithStyle:controlSize:horizontal:replacingScrollerImp:)] 237 [NSClassFromString(@"NSScrollerImp") respondsToSelector:@selector(scroll erImpWithStyle:controlSize:horizontal:replacingScrollerImp:)]
237 && [NSClassFromString(@"NSScrollerImpPair") instancesRespondToSelector:@ selector(scrollerStyle)]; 238 && [NSClassFromString(@"NSScrollerImpPair") instancesRespondToSelector:@ selector(scrollerStyle)];
238 return apiAvailable; 239 return apiAvailable;
239 } 240 }
240 241
241 } // namespace blink 242 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/scroll/ScrollbarThemeAura.cpp ('k') | Source/platform/scroll/ScrollbarThemeMacNonOverlayAPI.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698