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

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

Issue 1234783005: Add API to send NSUserDefault values over IPC, while preserving current behavior (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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() 61 void ScrollbarThemeMacNonOverlayAPI::updateButtonPlacement(const std::string& bu ttonPlacement)
62 { 62 {
63 NSString *buttonPlacement = [[NSUserDefaults standardUserDefaults] objectFor Key:@"AppleScrollBarVariant"]; 63 if (buttonPlacement == "Single")
64 if ([buttonPlacement isEqualToString:@"Single"])
65 gButtonPlacement = ScrollbarButtonsSingle; 64 gButtonPlacement = ScrollbarButtonsSingle;
66 else if ([buttonPlacement isEqualToString:@"DoubleMin"]) 65 else if (buttonPlacement == "DoubleMin")
67 gButtonPlacement = ScrollbarButtonsDoubleStart; 66 gButtonPlacement = ScrollbarButtonsDoubleStart;
68 else if ([buttonPlacement isEqualToString:@"DoubleBoth"]) 67 else if (buttonPlacement == "DoubleBoth")
69 gButtonPlacement = ScrollbarButtonsDoubleBoth; 68 gButtonPlacement = ScrollbarButtonsDoubleBoth;
70 else { 69 else
71 gButtonPlacement = ScrollbarButtonsDoubleEnd; 70 gButtonPlacement = ScrollbarButtonsDoubleEnd;
72 }
73 } 71 }
74 72
75 // Override ScrollbarThemeMacCommon::paint() to add support for the following: 73 // Override ScrollbarThemeMacCommon::paint() to add support for the following:
76 // - drawing using WebThemeEngine functions 74 // - drawing using WebThemeEngine functions
77 // - drawing tickmarks 75 // - drawing tickmarks
78 // - Skia specific changes 76 // - Skia specific changes
79 bool ScrollbarThemeMacNonOverlayAPI::paint(ScrollbarThemeClient* scrollbar, Grap hicsContext* context, const IntRect& damageRect) 77 bool ScrollbarThemeMacNonOverlayAPI::paint(ScrollbarThemeClient* scrollbar, Grap hicsContext* context, const IntRect& damageRect)
80 { 78 {
81 DisplayItem::Type displayItemType = scrollbar->orientation() == HorizontalSc rollbar ? DisplayItem::ScrollbarHorizontal : DisplayItem::ScrollbarVertical; 79 DisplayItem::Type displayItemType = scrollbar->orientation() == HorizontalSc rollbar ? DisplayItem::ScrollbarHorizontal : DisplayItem::ScrollbarVertical;
82 if (DrawingRecorder::useCachedDrawingIfPossible(*context, *scrollbar, displa yItemType)) 80 if (DrawingRecorder::useCachedDrawingIfPossible(*context, *scrollbar, displa yItemType))
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 return IntRect(scrollbar->x() + startWidth, scrollbar->y(), scrollbar->w idth() - totalWidth, thickness); 316 return IntRect(scrollbar->x() + startWidth, scrollbar->y(), scrollbar->w idth() - totalWidth, thickness);
319 return IntRect(scrollbar->x(), scrollbar->y() + startWidth, thickness, scrol lbar->height() - totalWidth); 317 return IntRect(scrollbar->x(), scrollbar->y() + startWidth, thickness, scrol lbar->height() - totalWidth);
320 } 318 }
321 319
322 int ScrollbarThemeMacNonOverlayAPI::minimumThumbLength(ScrollbarThemeClient* scr ollbar) 320 int ScrollbarThemeMacNonOverlayAPI::minimumThumbLength(ScrollbarThemeClient* scr ollbar)
323 { 321 {
324 return cThumbMinLength[scrollbar->controlSize()]; 322 return cThumbMinLength[scrollbar->controlSize()];
325 } 323 }
326 324
327 } 325 }
OLDNEW
« no previous file with comments | « Source/platform/scroll/ScrollbarThemeMacNonOverlayAPI.h ('k') | Source/web/mac/WebScrollbarTheme.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698