| 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 void LayoutThemeMac::systemFont(CSSValueID systemFontID, FontStyle& fontStyle, F
ontWeight& fontWeight, float& fontSize, AtomicString& fontFamily) const | 231 void LayoutThemeMac::systemFont(CSSValueID systemFontID, FontStyle& fontStyle, F
ontWeight& fontWeight, float& fontSize, AtomicString& fontFamily) const |
| 232 { | 232 { |
| 233 NSFont* font = systemNSFont(systemFontID); | 233 NSFont* font = systemNSFont(systemFontID); |
| 234 if (!font) | 234 if (!font) |
| 235 return; | 235 return; |
| 236 | 236 |
| 237 NSFontManager *fontManager = [NSFontManager sharedFontManager]; | 237 NSFontManager *fontManager = [NSFontManager sharedFontManager]; |
| 238 fontStyle = ([fontManager traitsOfFont:font] & NSItalicFontMask) ? FontStyle
Italic : FontStyleNormal; | 238 fontStyle = ([fontManager traitsOfFont:font] & NSItalicFontMask) ? FontStyle
Italic : FontStyleNormal; |
| 239 fontWeight = toFontWeight([fontManager weightOfFont:font]); | 239 fontWeight = toFontWeight([fontManager weightOfFont:font]); |
| 240 fontSize = [font pointSize]; | 240 fontSize = [font pointSize]; |
| 241 fontFamily = [font webCoreFamilyName]; | 241 fontFamily = @"BlinkMacSystemFont"; |
| 242 } | 242 } |
| 243 | 243 |
| 244 static RGBA32 convertNSColorToColor(NSColor *color) | 244 static RGBA32 convertNSColorToColor(NSColor *color) |
| 245 { | 245 { |
| 246 NSColor *colorInColorSpace = [color colorUsingColorSpaceName:NSDeviceRGBColo
rSpace]; | 246 NSColor *colorInColorSpace = [color colorUsingColorSpaceName:NSDeviceRGBColo
rSpace]; |
| 247 if (colorInColorSpace) { | 247 if (colorInColorSpace) { |
| 248 static const double scaleFactor = nextafter(256.0, 0.0); | 248 static const double scaleFactor = nextafter(256.0, 0.0); |
| 249 return makeRGB(static_cast<int>(scaleFactor * [colorInColorSpace redComp
onent]), | 249 return makeRGB(static_cast<int>(scaleFactor * [colorInColorSpace redComp
onent]), |
| 250 static_cast<int>(scaleFactor * [colorInColorSpace greenComponent]), | 250 static_cast<int>(scaleFactor * [colorInColorSpace greenComponent]), |
| 251 static_cast<int>(scaleFactor * [colorInColorSpace blueComponent])); | 251 static_cast<int>(scaleFactor * [colorInColorSpace blueComponent])); |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 style.setHeight(Length(size.height(), Fixed)); | 585 style.setHeight(Length(size.height(), Fixed)); |
| 586 } | 586 } |
| 587 | 587 |
| 588 void LayoutThemeMac::setFontFromControlSize(ComputedStyle& style, NSControlSize
controlSize) const | 588 void LayoutThemeMac::setFontFromControlSize(ComputedStyle& style, NSControlSize
controlSize) const |
| 589 { | 589 { |
| 590 FontDescription fontDescription; | 590 FontDescription fontDescription; |
| 591 fontDescription.setIsAbsoluteSize(true); | 591 fontDescription.setIsAbsoluteSize(true); |
| 592 fontDescription.setGenericFamily(FontDescription::SerifFamily); | 592 fontDescription.setGenericFamily(FontDescription::SerifFamily); |
| 593 | 593 |
| 594 NSFont* font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize
:controlSize]]; | 594 NSFont* font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize
:controlSize]]; |
| 595 fontDescription.firstFamily().setFamily([font webCoreFamilyName]); | 595 fontDescription.firstFamily().setFamily(@"BlinkMacSystemFont"); |
| 596 fontDescription.setComputedSize([font pointSize] * style.effectiveZoom()); | 596 fontDescription.setComputedSize([font pointSize] * style.effectiveZoom()); |
| 597 fontDescription.setSpecifiedSize([font pointSize] * style.effectiveZoom()); | 597 fontDescription.setSpecifiedSize([font pointSize] * style.effectiveZoom()); |
| 598 | 598 |
| 599 // Reset line height. | 599 // Reset line height. |
| 600 style.setLineHeight(ComputedStyle::initialLineHeight()); | 600 style.setLineHeight(ComputedStyle::initialLineHeight()); |
| 601 | 601 |
| 602 // TODO(esprehn): The fontSelector manual management is buggy and error pron
e. | 602 // TODO(esprehn): The fontSelector manual management is buggy and error pron
e. |
| 603 FontSelector* fontSelector = style.font().fontSelector(); | 603 FontSelector* fontSelector = style.font().fontSelector(); |
| 604 if (style.setFontDescription(fontDescription)) | 604 if (style.setFontDescription(fontDescription)) |
| 605 style.font().update(fontSelector); | 605 style.font().update(fontSelector); |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1158 | 1158 |
| 1159 bool LayoutThemeMac::shouldUseFallbackTheme(const ComputedStyle& style) const | 1159 bool LayoutThemeMac::shouldUseFallbackTheme(const ComputedStyle& style) const |
| 1160 { | 1160 { |
| 1161 ControlPart part = style.appearance(); | 1161 ControlPart part = style.appearance(); |
| 1162 if (part == CheckboxPart || part == RadioPart) | 1162 if (part == CheckboxPart || part == RadioPart) |
| 1163 return style.effectiveZoom() != 1; | 1163 return style.effectiveZoom() != 1; |
| 1164 return false; | 1164 return false; |
| 1165 } | 1165 } |
| 1166 | 1166 |
| 1167 } // namespace blink | 1167 } // namespace blink |
| OLD | NEW |