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

Side by Side Diff: Source/platform/mac/ThemeMac.mm

Issue 289163003: Fix build with gcc 4.8 and C++11 support enabled (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/platform/ThemeTypes.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2010, 2011, 2012 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008, 2010, 2011, 2012 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 if (size != [cell controlSize]) // Only update if we have to, since AppKit d oes work even if the size is the same. 151 if (size != [cell controlSize]) // Only update if we have to, since AppKit d oes work even if the size is the same.
152 [cell setControlSize:(NSControlSize)size]; 152 [cell setControlSize:(NSControlSize)size];
153 } 153 }
154 154
155 static void updateStates(NSCell* cell, ControlStates states) 155 static void updateStates(NSCell* cell, ControlStates states)
156 { 156 {
157 // Hover state is not supported by Aqua. 157 // Hover state is not supported by Aqua.
158 158
159 // Pressed state 159 // Pressed state
160 bool oldPressed = [cell isHighlighted]; 160 bool oldPressed = [cell isHighlighted];
161 bool pressed = states & PressedState; 161 bool pressed = states & PressedControlState;
162 if (pressed != oldPressed) 162 if (pressed != oldPressed)
163 [cell setHighlighted:pressed]; 163 [cell setHighlighted:pressed];
164 164
165 // Enabled state 165 // Enabled state
166 bool oldEnabled = [cell isEnabled]; 166 bool oldEnabled = [cell isEnabled];
167 bool enabled = states & EnabledState; 167 bool enabled = states & EnabledControlState;
168 if (enabled != oldEnabled) 168 if (enabled != oldEnabled)
169 [cell setEnabled:enabled]; 169 [cell setEnabled:enabled];
170 170
171 #if BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING 171 #if BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING
172 // Focused state 172 // Focused state
173 bool oldFocused = [cell showsFirstResponder]; 173 bool oldFocused = [cell showsFirstResponder];
174 bool focused = states & FocusState; 174 bool focused = states & FocusControlState;
175 if (focused != oldFocused) 175 if (focused != oldFocused)
176 [cell setShowsFirstResponder:focused]; 176 [cell setShowsFirstResponder:focused];
177 #endif 177 #endif
178 178
179 // Checked and Indeterminate 179 // Checked and Indeterminate
180 bool oldIndeterminate = [cell state] == NSMixedState; 180 bool oldIndeterminate = [cell state] == NSMixedState;
181 bool indeterminate = (states & IndeterminateState); 181 bool indeterminate = (states & IndeterminateControlState);
182 bool checked = states & CheckedState; 182 bool checked = states & CheckedControlState;
183 bool oldChecked = [cell state] == NSOnState; 183 bool oldChecked = [cell state] == NSOnState;
184 if (oldIndeterminate != indeterminate || checked != oldChecked) 184 if (oldIndeterminate != indeterminate || checked != oldChecked)
185 [cell setState:indeterminate ? NSMixedState : (checked ? NSOnState : NSO ffState)]; 185 [cell setState:indeterminate ? NSMixedState : (checked ? NSOnState : NSO ffState)];
186 186
187 // Window inactive state does not need to be checked explicitly, since we pa int parented to 187 // Window inactive state does not need to be checked explicitly, since we pa int parented to
188 // a view in a window whose key state can be detected. 188 // a view in a window whose key state can be detected.
189 } 189 }
190 190
191 static ThemeDrawState convertControlStatesToThemeDrawState(ThemeButtonKind kind, ControlStates states) 191 static ThemeDrawState convertControlStatesToThemeDrawState(ThemeButtonKind kind, ControlStates states)
192 { 192 {
193 if (states & ReadOnlyState) 193 if (states & ReadOnlyControlState)
194 return kThemeStateUnavailableInactive; 194 return kThemeStateUnavailableInactive;
195 if (!(states & EnabledState)) 195 if (!(states & EnabledControlState))
196 return kThemeStateUnavailableInactive; 196 return kThemeStateUnavailableInactive;
197 197
198 // Do not process PressedState if !EnabledState or ReadOnlyState. 198 // Do not process PressedState if !EnabledControlState or ReadOnlyControlSta te.
199 if (states & PressedState) { 199 if (states & PressedControlState) {
200 if (kind == kThemeIncDecButton || kind == kThemeIncDecButtonSmall || kin d == kThemeIncDecButtonMini) 200 if (kind == kThemeIncDecButton || kind == kThemeIncDecButtonSmall || kin d == kThemeIncDecButtonMini)
201 return states & SpinUpState ? kThemeStatePressedUp : kThemeStatePres sedDown; 201 return states & SpinUpControlState ? kThemeStatePressedUp : kThemeSt atePressedDown;
202 return kThemeStatePressed; 202 return kThemeStatePressed;
203 } 203 }
204 return kThemeStateActive; 204 return kThemeStateActive;
205 } 205 }
206 206
207 static IntRect inflateRect(const IntRect& zoomedRect, const IntSize& zoomedSize, const int* margins, float zoomFactor) 207 static IntRect inflateRect(const IntRect& zoomedRect, const IntSize& zoomedSize, const int* margins, float zoomFactor)
208 { 208 {
209 // Only do the inflation if the available width/height are too small. Other wise try to 209 // Only do the inflation if the available width/height are too small. Other wise try to
210 // fit the glow/check space into the available box's width/height. 210 // fit the glow/check space into the available box's width/height.
211 int widthDelta = zoomedRect.width() - (zoomedSize.width() + margins[leftMarg in] * zoomFactor + margins[rightMargin] * zoomFactor); 211 int widthDelta = zoomedRect.width() - (zoomedSize.width() + margins[leftMarg in] * zoomFactor + margins[rightMargin] * zoomFactor);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 inflatedRect.setHeight(inflatedRect.height() / zoomFactor); 291 inflatedRect.setHeight(inflatedRect.height() / zoomFactor);
292 context->translate(inflatedRect.x(), inflatedRect.y()); 292 context->translate(inflatedRect.x(), inflatedRect.y());
293 context->scale(FloatSize(zoomFactor, zoomFactor)); 293 context->scale(FloatSize(zoomFactor, zoomFactor));
294 context->translate(-inflatedRect.x(), -inflatedRect.y()); 294 context->translate(-inflatedRect.x(), -inflatedRect.y());
295 } 295 }
296 296
297 LocalCurrentGraphicsContext localContext(context); 297 LocalCurrentGraphicsContext localContext(context);
298 NSView *view = ThemeMac::ensuredView(scrollView); 298 NSView *view = ThemeMac::ensuredView(scrollView);
299 [checkboxCell drawWithFrame:NSRect(inflatedRect) inView:view]; 299 [checkboxCell drawWithFrame:NSRect(inflatedRect) inView:view];
300 #if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING 300 #if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING
301 if (states & FocusState) 301 if (states & FocusControlState)
302 [checkboxCell _web_drawFocusRingWithFrame:NSRect(inflatedRect) inView:vi ew]; 302 [checkboxCell _web_drawFocusRingWithFrame:NSRect(inflatedRect) inView:vi ew];
303 #endif 303 #endif
304 [checkboxCell setControlView:nil]; 304 [checkboxCell setControlView:nil];
305 305
306 END_BLOCK_OBJC_EXCEPTIONS 306 END_BLOCK_OBJC_EXCEPTIONS
307 } 307 }
308 308
309 // Radio Buttons 309 // Radio Buttons
310 310
311 static const IntSize* radioSizes() 311 static const IntSize* radioSizes()
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 context->translate(inflatedRect.x(), inflatedRect.y()); 372 context->translate(inflatedRect.x(), inflatedRect.y());
373 context->scale(FloatSize(zoomFactor, zoomFactor)); 373 context->scale(FloatSize(zoomFactor, zoomFactor));
374 context->translate(-inflatedRect.x(), -inflatedRect.y()); 374 context->translate(-inflatedRect.x(), -inflatedRect.y());
375 } 375 }
376 376
377 LocalCurrentGraphicsContext localContext(context); 377 LocalCurrentGraphicsContext localContext(context);
378 BEGIN_BLOCK_OBJC_EXCEPTIONS 378 BEGIN_BLOCK_OBJC_EXCEPTIONS
379 NSView *view = ThemeMac::ensuredView(scrollView); 379 NSView *view = ThemeMac::ensuredView(scrollView);
380 [radioCell drawWithFrame:NSRect(inflatedRect) inView:view]; 380 [radioCell drawWithFrame:NSRect(inflatedRect) inView:view];
381 #if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING 381 #if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING
382 if (states & FocusState) 382 if (states & FocusControlState)
383 [radioCell _web_drawFocusRingWithFrame:NSRect(inflatedRect) inView:view] ; 383 [radioCell _web_drawFocusRingWithFrame:NSRect(inflatedRect) inView:view] ;
384 #endif 384 #endif
385 [radioCell setControlView:nil]; 385 [radioCell setControlView:nil];
386 END_BLOCK_OBJC_EXCEPTIONS 386 END_BLOCK_OBJC_EXCEPTIONS
387 } 387 }
388 388
389 // Buttons 389 // Buttons
390 390
391 // Buttons really only constrain height. They respect width. 391 // Buttons really only constrain height. They respect width.
392 static const IntSize* buttonSizes() 392 static const IntSize* buttonSizes()
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 break; 719 break;
720 case InnerSpinButtonPart: 720 case InnerSpinButtonPart:
721 paintStepper(states, context, zoomedRect, zoomFactor, scrollView); 721 paintStepper(states, context, zoomedRect, zoomFactor, scrollView);
722 break; 722 break;
723 default: 723 default:
724 break; 724 break;
725 } 725 }
726 } 726 }
727 727
728 } 728 }
OLDNEW
« no previous file with comments | « Source/platform/ThemeTypes.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698