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

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

Issue 1245323002: Pass scroll bar placement as an enum instead of std::string (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix the headers to pass depchecks 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 static int cButtonLength[] = { 14, 10 }; 51 static int cButtonLength[] = { 14, 10 };
52 static int cScrollbarThickness[] = { 15, 11 }; 52 static int cScrollbarThickness[] = { 15, 11 };
53 static int cButtonInset[] = { 14, 11 }; 53 static int cButtonInset[] = { 14, 11 };
54 static int cThumbMinLength[] = { 26, 20 }; 54 static int cThumbMinLength[] = { 26, 20 };
55 55
56 static int cOuterButtonLength[] = { 16, 14 }; // The outer button in a double bu tton pair is a bit bigger. 56 static int cOuterButtonLength[] = { 16, 14 }; // The outer button in a double bu tton pair is a bit bigger.
57 static int cOuterButtonOverlap = 2; 57 static int cOuterButtonOverlap = 2;
58 58
59 static ScrollbarButtonsPlacement gButtonPlacement = ScrollbarButtonsDoubleEnd; 59 static ScrollbarButtonsPlacement gButtonPlacement = ScrollbarButtonsDoubleEnd;
60 60
61 void ScrollbarThemeMacNonOverlayAPI::updateButtonPlacement(const std::string& bu ttonPlacement) 61 void ScrollbarThemeMacNonOverlayAPI::updateButtonPlacement(ScrollbarButtonsPlace ment buttonPlacement)
62 { 62 {
63 if (buttonPlacement == "Single") 63 gButtonPlacement = buttonPlacement;
64 gButtonPlacement = ScrollbarButtonsSingle;
65 else if (buttonPlacement == "DoubleMin")
66 gButtonPlacement = ScrollbarButtonsDoubleStart;
67 else if (buttonPlacement == "DoubleBoth")
68 gButtonPlacement = ScrollbarButtonsDoubleBoth;
69 else
70 gButtonPlacement = ScrollbarButtonsDoubleEnd;
71 } 64 }
72 65
73 // Override ScrollbarThemeMacCommon::paint() to add support for the following: 66 // Override ScrollbarThemeMacCommon::paint() to add support for the following:
74 // - drawing using WebThemeEngine functions 67 // - drawing using WebThemeEngine functions
75 // - drawing tickmarks 68 // - drawing tickmarks
76 // - Skia specific changes 69 // - Skia specific changes
77 bool ScrollbarThemeMacNonOverlayAPI::paint(ScrollbarThemeClient* scrollbar, Grap hicsContext* context, const IntRect& damageRect) 70 bool ScrollbarThemeMacNonOverlayAPI::paint(ScrollbarThemeClient* scrollbar, Grap hicsContext* context, const IntRect& damageRect)
78 { 71 {
79 DisplayItem::Type displayItemType = scrollbar->orientation() == HorizontalSc rollbar ? DisplayItem::ScrollbarHorizontal : DisplayItem::ScrollbarVertical; 72 DisplayItem::Type displayItemType = scrollbar->orientation() == HorizontalSc rollbar ? DisplayItem::ScrollbarHorizontal : DisplayItem::ScrollbarVertical;
80 if (DrawingRecorder::useCachedDrawingIfPossible(*context, *scrollbar, displa yItemType)) 73 if (DrawingRecorder::useCachedDrawingIfPossible(*context, *scrollbar, displa yItemType))
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 return IntRect(scrollbar->x() + startWidth, scrollbar->y(), scrollbar->w idth() - totalWidth, thickness); 309 return IntRect(scrollbar->x() + startWidth, scrollbar->y(), scrollbar->w idth() - totalWidth, thickness);
317 return IntRect(scrollbar->x(), scrollbar->y() + startWidth, thickness, scrol lbar->height() - totalWidth); 310 return IntRect(scrollbar->x(), scrollbar->y() + startWidth, thickness, scrol lbar->height() - totalWidth);
318 } 311 }
319 312
320 int ScrollbarThemeMacNonOverlayAPI::minimumThumbLength(ScrollbarThemeClient* scr ollbar) 313 int ScrollbarThemeMacNonOverlayAPI::minimumThumbLength(ScrollbarThemeClient* scr ollbar)
321 { 314 {
322 return cThumbMinLength[scrollbar->controlSize()]; 315 return cThumbMinLength[scrollbar->controlSize()];
323 } 316 }
324 317
325 } 318 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698