OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008, 2009 Google, Inc. | 3 * Copyright (C) 2008, 2009 Google, Inc. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 @interface BlinkTextFieldCell : NSTextFieldCell | 80 @interface BlinkTextFieldCell : NSTextFieldCell |
81 - (CFDictionaryRef)_coreUIDrawOptionsWithFrame:(NSRect)cellFrame | 81 - (CFDictionaryRef)_coreUIDrawOptionsWithFrame:(NSRect)cellFrame |
82 inView:(NSView*)controlView | 82 inView:(NSView*)controlView |
83 includeFocus:(BOOL)includeFocus; | 83 includeFocus:(BOOL)includeFocus; |
84 @end | 84 @end |
85 | 85 |
86 @implementation BlinkTextFieldCell | 86 @implementation BlinkTextFieldCell |
87 - (CFDictionaryRef)_coreUIDrawOptionsWithFrame:(NSRect)cellFrame | 87 - (CFDictionaryRef)_coreUIDrawOptionsWithFrame:(NSRect)cellFrame |
88 inView:(NSView*)controlView | 88 inView:(NSView*)controlView |
89 includeFocus:(BOOL)includeFocus { | 89 includeFocus:(BOOL)includeFocus { |
90 // FIXME: This is a post-Lion-only workaround for <rdar://problem/11385461>. W
hen that bug is resolved, we should remove this code. | 90 // FIXME: This is a post-Lion-only workaround for <rdar://problem/11385461>. |
| 91 // When that bug is resolved, we should remove this code. |
91 CFMutableDictionaryRef coreUIDrawOptions = CFDictionaryCreateMutableCopy( | 92 CFMutableDictionaryRef coreUIDrawOptions = CFDictionaryCreateMutableCopy( |
92 NULL, 0, [super _coreUIDrawOptionsWithFrame:cellFrame | 93 NULL, 0, [super _coreUIDrawOptionsWithFrame:cellFrame |
93 inView:controlView | 94 inView:controlView |
94 includeFocus:includeFocus]); | 95 includeFocus:includeFocus]); |
95 CFDictionarySetValue(coreUIDrawOptions, @"borders only", kCFBooleanTrue); | 96 CFDictionarySetValue(coreUIDrawOptions, @"borders only", kCFBooleanTrue); |
96 return (CFDictionaryRef)[NSMakeCollectable(coreUIDrawOptions) autorelease]; | 97 return (CFDictionaryRef)[NSMakeCollectable(coreUIDrawOptions) autorelease]; |
97 } | 98 } |
98 @end | 99 @end |
99 | 100 |
100 @interface BlinkFlippedView : NSView | 101 @interface BlinkFlippedView : NSView |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 NSColor* colorInColorSpace = | 264 NSColor* colorInColorSpace = |
264 [color colorUsingColorSpaceName:NSDeviceRGBColorSpace]; | 265 [color colorUsingColorSpaceName:NSDeviceRGBColorSpace]; |
265 if (colorInColorSpace) { | 266 if (colorInColorSpace) { |
266 static const double scaleFactor = nextafter(256.0, 0.0); | 267 static const double scaleFactor = nextafter(256.0, 0.0); |
267 return makeRGB( | 268 return makeRGB( |
268 static_cast<int>(scaleFactor * [colorInColorSpace redComponent]), | 269 static_cast<int>(scaleFactor * [colorInColorSpace redComponent]), |
269 static_cast<int>(scaleFactor * [colorInColorSpace greenComponent]), | 270 static_cast<int>(scaleFactor * [colorInColorSpace greenComponent]), |
270 static_cast<int>(scaleFactor * [colorInColorSpace blueComponent])); | 271 static_cast<int>(scaleFactor * [colorInColorSpace blueComponent])); |
271 } | 272 } |
272 | 273 |
273 // This conversion above can fail if the NSColor in question is an NSPatternCo
lor | 274 // This conversion above can fail if the NSColor in question is an |
| 275 // NSPatternColor |
274 // (as many system colors are). These colors are actually a repeating pattern | 276 // (as many system colors are). These colors are actually a repeating pattern |
275 // not just a solid color. To work around this we simply draw a 1x1 image of | 277 // not just a solid color. To work around this we simply draw a 1x1 image of |
276 // the color and use that pixel's color. It might be better to use an average
of | 278 // the color and use that pixel's color. It might be better to use an average |
| 279 // of |
277 // the colors in the pattern instead. | 280 // the colors in the pattern instead. |
278 NSBitmapImageRep* offscreenRep = | 281 NSBitmapImageRep* offscreenRep = |
279 [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:nil | 282 [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:nil |
280 pixelsWide:1 | 283 pixelsWide:1 |
281 pixelsHigh:1 | 284 pixelsHigh:1 |
282 bitsPerSample:8 | 285 bitsPerSample:8 |
283 samplesPerPixel:4 | 286 samplesPerPixel:4 |
284 hasAlpha:YES | 287 hasAlpha:YES |
285 isPlanar:NO | 288 isPlanar:NO |
286 colorSpaceName:NSDeviceRGBColorSpace | 289 colorSpaceName:NSDeviceRGBColorSpace |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 | 1062 |
1060 if (tint != oldTint) | 1063 if (tint != oldTint) |
1061 [cell setControlTint:tint]; | 1064 [cell setControlTint:tint]; |
1062 } | 1065 } |
1063 | 1066 |
1064 void LayoutThemeMac::adjustMediaSliderThumbSize(ComputedStyle& style) const { | 1067 void LayoutThemeMac::adjustMediaSliderThumbSize(ComputedStyle& style) const { |
1065 MediaControlsPainter::adjustMediaSliderThumbSize(style); | 1068 MediaControlsPainter::adjustMediaSliderThumbSize(style); |
1066 } | 1069 } |
1067 | 1070 |
1068 String LayoutThemeMac::extraFullscreenStyleSheet() { | 1071 String LayoutThemeMac::extraFullscreenStyleSheet() { |
1069 // FIXME: Chromium may wish to style its default media controls differently in
fullscreen. | 1072 // FIXME: Chromium may wish to style its default media controls differently in |
| 1073 // fullscreen. |
1070 return String(); | 1074 return String(); |
1071 } | 1075 } |
1072 | 1076 |
1073 String LayoutThemeMac::extraDefaultStyleSheet() { | 1077 String LayoutThemeMac::extraDefaultStyleSheet() { |
1074 return LayoutTheme::extraDefaultStyleSheet() + | 1078 return LayoutTheme::extraDefaultStyleSheet() + |
1075 loadResourceAsASCIIString("themeInputMultipleFields.css") + | 1079 loadResourceAsASCIIString("themeInputMultipleFields.css") + |
1076 loadResourceAsASCIIString("themeMac.css"); | 1080 loadResourceAsASCIIString("themeMac.css"); |
1077 } | 1081 } |
1078 | 1082 |
1079 bool LayoutThemeMac::themeDrawsFocusRing(const ComputedStyle& style) const { | 1083 bool LayoutThemeMac::themeDrawsFocusRing(const ComputedStyle& style) const { |
(...skipping 24 matching lines...) Expand all Loading... |
1104 } | 1108 } |
1105 | 1109 |
1106 bool LayoutThemeMac::shouldUseFallbackTheme(const ComputedStyle& style) const { | 1110 bool LayoutThemeMac::shouldUseFallbackTheme(const ComputedStyle& style) const { |
1107 ControlPart part = style.appearance(); | 1111 ControlPart part = style.appearance(); |
1108 if (part == CheckboxPart || part == RadioPart) | 1112 if (part == CheckboxPart || part == RadioPart) |
1109 return style.effectiveZoom() != 1; | 1113 return style.effectiveZoom() != 1; |
1110 return false; | 1114 return false; |
1111 } | 1115 } |
1112 | 1116 |
1113 } // namespace blink | 1117 } // namespace blink |
OLD | NEW |