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

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

Issue 368003002: Check if drawFocusRingMaskWithFrame:inView: exists when drawing focus ring (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Removed BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING Created 6 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 | Annotate | Revision Log
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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 bool pressed = states & PressedControlState; 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 & EnabledControlState; 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 (![cell respondsToSelector:@selector(drawFocusRingMaskWithFrame:inView:)] ) {
Robert Sesek 2014/07/21 21:14:38 … and copy that comment here
172 // Focused state 172 // Focused state
173 bool oldFocused = [cell showsFirstResponder]; 173 bool oldFocused = [cell showsFirstResponder];
174 bool focused = states & FocusControlState; 174 bool focused = states & FocusControlState;
175 if (focused != oldFocused) 175 if (focused != oldFocused)
176 [cell setShowsFirstResponder:focused]; 176 [cell setShowsFirstResponder:focused];
177 #endif 177 }
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 & IndeterminateControlState); 181 bool indeterminate = (states & IndeterminateControlState);
182 bool checked = states & CheckedControlState; 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
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 inflatedRect.setWidth(inflatedRect.width() / zoomFactor); 290 inflatedRect.setWidth(inflatedRect.width() / zoomFactor);
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(zoomFactor, zoomFactor); 293 context->scale(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
301 if (states & FocusControlState) 300 if (states & FocusControlState)
302 [checkboxCell _web_drawFocusRingWithFrame:NSRect(inflatedRect) inView:vi ew]; 301 [checkboxCell _web_drawFocusRingWithFrame:NSRect(inflatedRect) inView:vi ew];
303 #endif
304 [checkboxCell setControlView:nil]; 302 [checkboxCell setControlView:nil];
305 303
306 END_BLOCK_OBJC_EXCEPTIONS 304 END_BLOCK_OBJC_EXCEPTIONS
307 } 305 }
308 306
309 // Radio Buttons 307 // Radio Buttons
310 308
311 static const IntSize* radioSizes() 309 static const IntSize* radioSizes()
312 { 310 {
313 static const IntSize sizes[3] = { IntSize(14, 15), IntSize(12, 13), IntSize( 10, 10) }; 311 static const IntSize sizes[3] = { IntSize(14, 15), IntSize(12, 13), IntSize( 10, 10) };
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 inflatedRect.setHeight(inflatedRect.height() / zoomFactor); 369 inflatedRect.setHeight(inflatedRect.height() / zoomFactor);
372 context->translate(inflatedRect.x(), inflatedRect.y()); 370 context->translate(inflatedRect.x(), inflatedRect.y());
373 context->scale(zoomFactor, zoomFactor); 371 context->scale(zoomFactor, zoomFactor);
374 context->translate(-inflatedRect.x(), -inflatedRect.y()); 372 context->translate(-inflatedRect.x(), -inflatedRect.y());
375 } 373 }
376 374
377 LocalCurrentGraphicsContext localContext(context); 375 LocalCurrentGraphicsContext localContext(context);
378 BEGIN_BLOCK_OBJC_EXCEPTIONS 376 BEGIN_BLOCK_OBJC_EXCEPTIONS
379 NSView *view = ThemeMac::ensuredView(scrollView); 377 NSView *view = ThemeMac::ensuredView(scrollView);
380 [radioCell drawWithFrame:NSRect(inflatedRect) inView:view]; 378 [radioCell drawWithFrame:NSRect(inflatedRect) inView:view];
381 #if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING
382 if (states & FocusControlState) 379 if (states & FocusControlState)
383 [radioCell _web_drawFocusRingWithFrame:NSRect(inflatedRect) inView:view] ; 380 [radioCell _web_drawFocusRingWithFrame:NSRect(inflatedRect) inView:view] ;
384 #endif
385 [radioCell setControlView:nil]; 381 [radioCell setControlView:nil];
386 END_BLOCK_OBJC_EXCEPTIONS 382 END_BLOCK_OBJC_EXCEPTIONS
387 } 383 }
388 384
389 // Buttons 385 // Buttons
390 386
391 // Buttons really only constrain height. They respect width. 387 // Buttons really only constrain height. They respect width.
392 static const IntSize* buttonSizes() 388 static const IntSize* buttonSizes()
393 { 389 {
394 static const IntSize sizes[3] = { IntSize(0, 21), IntSize(0, 18), IntSize(0, 15) }; 390 static const IntSize sizes[3] = { IntSize(0, 21), IntSize(0, 18), IntSize(0, 15) };
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 context->translate(inflatedRect.x(), inflatedRect.y()); 460 context->translate(inflatedRect.x(), inflatedRect.y());
465 context->scale(zoomFactor, zoomFactor); 461 context->scale(zoomFactor, zoomFactor);
466 context->translate(-inflatedRect.x(), -inflatedRect.y()); 462 context->translate(-inflatedRect.x(), -inflatedRect.y());
467 } 463 }
468 } 464 }
469 465
470 LocalCurrentGraphicsContext localContext(context); 466 LocalCurrentGraphicsContext localContext(context);
471 NSView *view = ThemeMac::ensuredView(scrollView); 467 NSView *view = ThemeMac::ensuredView(scrollView);
472 468
473 [buttonCell drawWithFrame:NSRect(inflatedRect) inView:view]; 469 [buttonCell drawWithFrame:NSRect(inflatedRect) inView:view];
474 #if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING
475 if (states & FocusControlState) 470 if (states & FocusControlState)
476 [buttonCell _web_drawFocusRingWithFrame:NSRect(inflatedRect) inView:view ]; 471 [buttonCell _web_drawFocusRingWithFrame:NSRect(inflatedRect) inView:view ];
477 #endif
478 [buttonCell setControlView:nil]; 472 [buttonCell setControlView:nil];
479 473
480 END_BLOCK_OBJC_EXCEPTIONS 474 END_BLOCK_OBJC_EXCEPTIONS
481 } 475 }
482 476
483 // Stepper 477 // Stepper
484 478
485 static const IntSize* stepperSizes() 479 static const IntSize* stepperSizes()
486 { 480 {
487 static const IntSize sizes[3] = { IntSize(19, 27), IntSize(15, 22), IntSize( 13, 15) }; 481 static const IntSize sizes[3] = { IntSize(19, 27), IntSize(15, 22), IntSize( 13, 15) };
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 break; 713 break;
720 case InnerSpinButtonPart: 714 case InnerSpinButtonPart:
721 paintStepper(states, context, zoomedRect, zoomFactor, scrollView); 715 paintStepper(states, context, zoomedRect, zoomFactor, scrollView);
722 break; 716 break;
723 default: 717 default:
724 break; 718 break;
725 } 719 }
726 } 720 }
727 721
728 } 722 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698