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

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

Issue 1220583004: Refactor DrawingRecorders to check for cached drawings earlier (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix some !'s and &&'s. De Morgan would be proud. 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 72 }
73 } 73 }
74 74
75 // Override ScrollbarThemeMacCommon::paint() to add support for the following: 75 // Override ScrollbarThemeMacCommon::paint() to add support for the following:
76 // - drawing using WebThemeEngine functions 76 // - drawing using WebThemeEngine functions
77 // - drawing tickmarks 77 // - drawing tickmarks
78 // - Skia specific changes 78 // - Skia specific changes
79 bool ScrollbarThemeMacNonOverlayAPI::paint(ScrollbarThemeClient* scrollbar, Grap hicsContext* context, const IntRect& damageRect) 79 bool ScrollbarThemeMacNonOverlayAPI::paint(ScrollbarThemeClient* scrollbar, Grap hicsContext* context, const IntRect& damageRect)
80 { 80 {
81 DisplayItem::Type displayItemType = scrollbar->orientation() == HorizontalSc rollbar ? DisplayItem::ScrollbarHorizontal : DisplayItem::ScrollbarVertical; 81 DisplayItem::Type displayItemType = scrollbar->orientation() == HorizontalSc rollbar ? DisplayItem::ScrollbarHorizontal : DisplayItem::ScrollbarVertical;
82 if (DrawingRecorder::useCachedDrawingIfPossible(*context, *scrollbar, displa yItemType))
83 return true;
84
82 DrawingRecorder recorder(*context, *scrollbar, displayItemType, scrollbar->f rameRect()); 85 DrawingRecorder recorder(*context, *scrollbar, displayItemType, scrollbar->f rameRect());
83 if (recorder.canUseCachedDrawing())
84 return true;
85 86
86 // Get the tickmarks for the frameview. 87 // Get the tickmarks for the frameview.
87 Vector<IntRect> tickmarks; 88 Vector<IntRect> tickmarks;
88 scrollbar->getTickmarks(tickmarks); 89 scrollbar->getTickmarks(tickmarks);
89 90
90 HIThemeTrackDrawInfo trackInfo; 91 HIThemeTrackDrawInfo trackInfo;
91 trackInfo.version = 0; 92 trackInfo.version = 0;
92 trackInfo.kind = scrollbar->controlSize() == RegularScrollbar ? kThemeMedium ScrollBar : kThemeSmallScrollBar; 93 trackInfo.kind = scrollbar->controlSize() == RegularScrollbar ? kThemeMedium ScrollBar : kThemeSmallScrollBar;
93 trackInfo.bounds = scrollbar->frameRect(); 94 trackInfo.bounds = scrollbar->frameRect();
94 trackInfo.min = 0; 95 trackInfo.min = 0;
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 return IntRect(scrollbar->x() + startWidth, scrollbar->y(), scrollbar->w idth() - totalWidth, thickness); 318 return IntRect(scrollbar->x() + startWidth, scrollbar->y(), scrollbar->w idth() - totalWidth, thickness);
318 return IntRect(scrollbar->x(), scrollbar->y() + startWidth, thickness, scrol lbar->height() - totalWidth); 319 return IntRect(scrollbar->x(), scrollbar->y() + startWidth, thickness, scrol lbar->height() - totalWidth);
319 } 320 }
320 321
321 int ScrollbarThemeMacNonOverlayAPI::minimumThumbLength(ScrollbarThemeClient* scr ollbar) 322 int ScrollbarThemeMacNonOverlayAPI::minimumThumbLength(ScrollbarThemeClient* scr ollbar)
322 { 323 {
323 return cThumbMinLength[scrollbar->controlSize()]; 324 return cThumbMinLength[scrollbar->controlSize()];
324 } 325 }
325 326
326 } 327 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698