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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 | 231 |
232 NSFontManager *fontManager = [NSFontManager sharedFontManager]; | 232 NSFontManager *fontManager = [NSFontManager sharedFontManager]; |
233 fontStyle = ([fontManager traitsOfFont:font] & NSItalicFontMask) ? FontStyle
Italic : FontStyleNormal; | 233 fontStyle = ([fontManager traitsOfFont:font] & NSItalicFontMask) ? FontStyle
Italic : FontStyleNormal; |
234 fontWeight = toFontWeight([fontManager weightOfFont:font]); | 234 fontWeight = toFontWeight([fontManager weightOfFont:font]); |
235 fontSize = [font pointSize]; | 235 fontSize = [font pointSize]; |
236 fontFamily = @"BlinkMacSystemFont"; | 236 fontFamily = @"BlinkMacSystemFont"; |
237 } | 237 } |
238 | 238 |
239 bool LayoutThemeMac::needsHackForTextControlWithFontFamily(const AtomicString& f
amily) const | 239 bool LayoutThemeMac::needsHackForTextControlWithFontFamily(const AtomicString& f
amily) const |
240 { | 240 { |
241 // This hack is only applied on OSX 10.9 and earlier. | 241 // This hack is only applied on OSX 10.9. |
242 // https://code.google.com/p/chromium/issues/detail?id=515989#c8 | 242 // https://code.google.com/p/chromium/issues/detail?id=515989#c8 |
243 return IsOSMavericksOrEarlier() && family == "BlinkMacSystemFont"; | 243 return IsOSMavericks() && family == "BlinkMacSystemFont"; |
244 } | 244 } |
245 | 245 |
246 static RGBA32 convertNSColorToColor(NSColor *color) | 246 static RGBA32 convertNSColorToColor(NSColor *color) |
247 { | 247 { |
248 NSColor *colorInColorSpace = [color colorUsingColorSpaceName:NSDeviceRGBColo
rSpace]; | 248 NSColor *colorInColorSpace = [color colorUsingColorSpaceName:NSDeviceRGBColo
rSpace]; |
249 if (colorInColorSpace) { | 249 if (colorInColorSpace) { |
250 static const double scaleFactor = nextafter(256.0, 0.0); | 250 static const double scaleFactor = nextafter(256.0, 0.0); |
251 return makeRGB(static_cast<int>(scaleFactor * [colorInColorSpace redComp
onent]), | 251 return makeRGB(static_cast<int>(scaleFactor * [colorInColorSpace redComp
onent]), |
252 static_cast<int>(scaleFactor * [colorInColorSpace greenComponent]), | 252 static_cast<int>(scaleFactor * [colorInColorSpace greenComponent]), |
253 static_cast<int>(scaleFactor * [colorInColorSpace blueComponent])); | 253 static_cast<int>(scaleFactor * [colorInColorSpace blueComponent])); |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 NSPopUpButtonCell* popupButton = this->popupButton(); | 786 NSPopUpButtonCell* popupButton = this->popupButton(); |
787 | 787 |
788 // Set the control size based off the rectangle we're painting into. | 788 // Set the control size based off the rectangle we're painting into. |
789 setControlSize(popupButton, popupButtonSizes(), rect.size(), object.styleRef
().effectiveZoom()); | 789 setControlSize(popupButton, popupButtonSizes(), rect.size(), object.styleRef
().effectiveZoom()); |
790 | 790 |
791 // Update the various states we respond to. | 791 // Update the various states we respond to. |
792 updateActiveState(popupButton, object); | 792 updateActiveState(popupButton, object); |
793 updateCheckedState(popupButton, object); | 793 updateCheckedState(popupButton, object); |
794 updateEnabledState(popupButton, object); | 794 updateEnabledState(popupButton, object); |
795 updatePressedState(popupButton, object); | 795 updatePressedState(popupButton, object); |
796 if (ThemeMac::drawWithFrameDrawsFocusRing()) | |
797 updateFocusedState(popupButton, object); | |
798 } | 796 } |
799 | 797 |
800 const IntSize* LayoutThemeMac::menuListSizes() const | 798 const IntSize* LayoutThemeMac::menuListSizes() const |
801 { | 799 { |
802 static const IntSize sizes[3] = { IntSize(9, 0), IntSize(5, 0), IntSize(0, 0
) }; | 800 static const IntSize sizes[3] = { IntSize(9, 0), IntSize(5, 0), IntSize(0, 0
) }; |
803 return sizes; | 801 return sizes; |
804 } | 802 } |
805 | 803 |
806 int LayoutThemeMac::minimumMenuListSize(const ComputedStyle& style) const | 804 int LayoutThemeMac::minimumMenuListSize(const ComputedStyle& style) const |
807 { | 805 { |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 | 1078 |
1081 bool LayoutThemeMac::shouldUseFallbackTheme(const ComputedStyle& style) const | 1079 bool LayoutThemeMac::shouldUseFallbackTheme(const ComputedStyle& style) const |
1082 { | 1080 { |
1083 ControlPart part = style.appearance(); | 1081 ControlPart part = style.appearance(); |
1084 if (part == CheckboxPart || part == RadioPart) | 1082 if (part == CheckboxPart || part == RadioPart) |
1085 return style.effectiveZoom() != 1; | 1083 return style.effectiveZoom() != 1; |
1086 return false; | 1084 return false; |
1087 } | 1085 } |
1088 | 1086 |
1089 } // namespace blink | 1087 } // namespace blink |
OLD | NEW |