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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 fontStyle = ([fontManager traitsOfFont:font] & NSItalicFontMask) ? FontStyle
Italic : FontStyleNormal; | 249 fontStyle = ([fontManager traitsOfFont:font] & NSItalicFontMask) ? FontStyle
Italic : FontStyleNormal; |
250 fontWeight = toFontWeight([fontManager weightOfFont:font]); | 250 fontWeight = toFontWeight([fontManager weightOfFont:font]); |
251 fontSize = [font pointSize]; | 251 fontSize = [font pointSize]; |
252 fontFamily = @"BlinkMacSystemFont"; | 252 fontFamily = @"BlinkMacSystemFont"; |
253 } | 253 } |
254 | 254 |
255 bool LayoutThemeMac::needsHackForTextControlWithFontFamily(const AtomicString& f
amily) const | 255 bool LayoutThemeMac::needsHackForTextControlWithFontFamily(const AtomicString& f
amily) const |
256 { | 256 { |
257 // This hack is only applied on OSX 10.9. | 257 // This hack is only applied on OSX 10.9. |
258 // https://code.google.com/p/chromium/issues/detail?id=515989#c8 | 258 // https://code.google.com/p/chromium/issues/detail?id=515989#c8 |
259 return IsOSMavericks() && family == "BlinkMacSystemFont"; | 259 return IsOS10_9() && family == "BlinkMacSystemFont"; |
260 } | 260 } |
261 | 261 |
262 static RGBA32 convertNSColorToColor(NSColor *color) | 262 static RGBA32 convertNSColorToColor(NSColor *color) |
263 { | 263 { |
264 NSColor *colorInColorSpace = [color colorUsingColorSpaceName:NSDeviceRGBColo
rSpace]; | 264 NSColor *colorInColorSpace = [color colorUsingColorSpaceName:NSDeviceRGBColo
rSpace]; |
265 if (colorInColorSpace) { | 265 if (colorInColorSpace) { |
266 static const double scaleFactor = nextafter(256.0, 0.0); | 266 static const double scaleFactor = nextafter(256.0, 0.0); |
267 return makeRGB(static_cast<int>(scaleFactor * [colorInColorSpace redComp
onent]), | 267 return makeRGB(static_cast<int>(scaleFactor * [colorInColorSpace redComp
onent]), |
268 static_cast<int>(scaleFactor * [colorInColorSpace greenComponent]), | 268 static_cast<int>(scaleFactor * [colorInColorSpace greenComponent]), |
269 static_cast<int>(scaleFactor * [colorInColorSpace blueComponent])); | 269 static_cast<int>(scaleFactor * [colorInColorSpace blueComponent])); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 if (style.effectiveZoom() != 1.0f) | 471 if (style.effectiveZoom() != 1.0f) |
472 return true; | 472 return true; |
473 if (!fontSizeMatchesToControlSize(style)) | 473 if (!fontSizeMatchesToControlSize(style)) |
474 return true; | 474 return true; |
475 if (style.getFontDescription().family().family() != "BlinkMacSystemFont"
) | 475 if (style.getFontDescription().family().family() != "BlinkMacSystemFont"
) |
476 return true; | 476 return true; |
477 if (!style.height().isIntrinsicOrAuto()) | 477 if (!style.height().isIntrinsicOrAuto()) |
478 return true; | 478 return true; |
479 // NSPopUpButtonCell on macOS 10.9 doesn't support | 479 // NSPopUpButtonCell on macOS 10.9 doesn't support |
480 // NSUserInterfaceLayoutDirectionRightToLeft. | 480 // NSUserInterfaceLayoutDirectionRightToLeft. |
481 if (IsOSMavericks() && style.direction() == RTL) | 481 if (IsOS10_9() && style.direction() == RTL) |
482 return true; | 482 return true; |
483 } | 483 } |
484 // Some other cells don't work well when scaled. | 484 // Some other cells don't work well when scaled. |
485 if (style.effectiveZoom() != 1) { | 485 if (style.effectiveZoom() != 1) { |
486 switch (style.appearance()) { | 486 switch (style.appearance()) { |
487 case ButtonPart: | 487 case ButtonPart: |
488 case PushButtonPart: | 488 case PushButtonPart: |
489 case SearchFieldPart: | 489 case SearchFieldPart: |
490 case SquareButtonPart: | 490 case SquareButtonPart: |
491 return true; | 491 return true; |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 | 1106 |
1107 bool LayoutThemeMac::shouldUseFallbackTheme(const ComputedStyle& style) const | 1107 bool LayoutThemeMac::shouldUseFallbackTheme(const ComputedStyle& style) const |
1108 { | 1108 { |
1109 ControlPart part = style.appearance(); | 1109 ControlPart part = style.appearance(); |
1110 if (part == CheckboxPart || part == RadioPart) | 1110 if (part == CheckboxPart || part == RadioPart) |
1111 return style.effectiveZoom() != 1; | 1111 return style.effectiveZoom() != 1; |
1112 return false; | 1112 return false; |
1113 } | 1113 } |
1114 | 1114 |
1115 } // namespace blink | 1115 } // namespace blink |
OLD | NEW |