| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 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 13 matching lines...) Expand all Loading... |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #import "platform/mac/WebCoreNSCellExtras.h" | 26 #import "platform/mac/WebCoreNSCellExtras.h" |
| 27 | 27 |
| 28 #if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING | 28 #if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING |
| 29 | 29 |
| 30 @implementation NSCell (WebCoreFocusRingDrawing) | 30 @implementation NSCell (WebCoreFocusRingDrawing) |
| 31 | 31 |
| 32 - (void)_web_drawFocusRingWithFrame:(NSRect)cellFrame inView:(NSView *)controlVi
ew | 32 - (void)_web_drawFocusRingWithFrame:(NSRect)cellFrame inView:(NSView *)controlVi
ew |
| 33 { | 33 { |
| 34 // FIXME: Remove this check when we drop support for Mac OS X 10.6 |
| 35 if (![self respondsToSelector:@selector(drawFocusRingMaskWithFrame:inView:)]
) |
| 36 return; |
| 34 CGContextRef cgContext = (CGContextRef)[[NSGraphicsContext currentContext] g
raphicsPort]; | 37 CGContextRef cgContext = (CGContextRef)[[NSGraphicsContext currentContext] g
raphicsPort]; |
| 35 CGContextSaveGState(cgContext); | 38 CGContextSaveGState(cgContext); |
| 36 NSSetFocusRingStyle(NSFocusRingOnly); | 39 NSSetFocusRingStyle(NSFocusRingOnly); |
| 37 CGContextBeginTransparencyLayerWithRect(cgContext, NSRectToCGRect(cellFrame)
, 0); | 40 CGContextBeginTransparencyLayerWithRect(cgContext, NSRectToCGRect(cellFrame)
, 0); |
| 38 [self drawFocusRingMaskWithFrame:cellFrame inView:controlView]; | 41 [self drawFocusRingMaskWithFrame:cellFrame inView:controlView]; |
| 39 CGContextEndTransparencyLayer(cgContext); | 42 CGContextEndTransparencyLayer(cgContext); |
| 40 CGContextRestoreGState(cgContext); | 43 CGContextRestoreGState(cgContext); |
| 41 } | 44 } |
| 42 | 45 |
| 43 @end | 46 @end |
| 44 | 47 |
| 45 #endif // !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING | 48 #endif // !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING |
| OLD | NEW |