| Index: third_party/WebKit/Source/core/layout/LayoutThemeMac.mm
|
| diff --git a/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm b/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm
|
| index 302425907212e563ceb2d6ee58f703ddaacac476..bbce38e9ec8ab05867d6557c7a066bad6a3e0f4e 100644
|
| --- a/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm
|
| +++ b/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm
|
| @@ -176,63 +176,31 @@ Color LayoutThemeMac::platformInactiveListBoxSelectionBackgroundColor() const
|
| return platformInactiveSelectionBackgroundColor();
|
| }
|
|
|
| -static FontWeight toFontWeight(NSInteger appKitFontWeight)
|
| -{
|
| - ASSERT(appKitFontWeight > 0 && appKitFontWeight < 15);
|
| - if (appKitFontWeight > 14)
|
| - appKitFontWeight = 14;
|
| - else if (appKitFontWeight < 1)
|
| - appKitFontWeight = 1;
|
| -
|
| - static FontWeight fontWeights[] = {
|
| - FontWeight100,
|
| - FontWeight100,
|
| - FontWeight200,
|
| - FontWeight300,
|
| - FontWeight400,
|
| - FontWeight500,
|
| - FontWeight600,
|
| - FontWeight600,
|
| - FontWeight700,
|
| - FontWeight800,
|
| - FontWeight800,
|
| - FontWeight900,
|
| - FontWeight900,
|
| - FontWeight900
|
| - };
|
| - return fontWeights[appKitFontWeight - 1];
|
| -}
|
| -
|
| -static inline NSFont* systemNSFont(CSSValueID systemFontID)
|
| +static inline CGFloat systemNSFontSize(CSSValueID systemFontID)
|
| {
|
| switch (systemFontID) {
|
| case CSSValueSmallCaption:
|
| - return [NSFont systemFontOfSize:[NSFont smallSystemFontSize]];
|
| + return [NSFont smallSystemFontSize];
|
| case CSSValueMenu:
|
| - return [NSFont menuFontOfSize:[NSFont systemFontSize]];
|
| + return [NSFont systemFontSize];
|
| case CSSValueStatusBar:
|
| - return [NSFont labelFontOfSize:[NSFont labelFontSize]];
|
| + return [NSFont labelFontSize];
|
| case CSSValueWebkitMiniControl:
|
| - return [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSMiniControlSize]];
|
| + return [NSFont systemFontSizeForControlSize:NSMiniControlSize];
|
| case CSSValueWebkitSmallControl:
|
| - return [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]];
|
| + return [NSFont systemFontSizeForControlSize:NSSmallControlSize];
|
| case CSSValueWebkitControl:
|
| - return [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSRegularControlSize]];
|
| + return [NSFont systemFontSizeForControlSize:NSRegularControlSize];
|
| default:
|
| - return [NSFont systemFontOfSize:[NSFont systemFontSize]];
|
| + return [NSFont systemFontSize];
|
| }
|
| }
|
|
|
| void LayoutThemeMac::systemFont(CSSValueID systemFontID, FontStyle& fontStyle, FontWeight& fontWeight, float& fontSize, AtomicString& fontFamily) const
|
| {
|
| - NSFont* font = systemNSFont(systemFontID);
|
| - if (!font)
|
| - return;
|
| -
|
| - NSFontManager *fontManager = [NSFontManager sharedFontManager];
|
| - fontStyle = ([fontManager traitsOfFont:font] & NSItalicFontMask) ? FontStyleItalic : FontStyleNormal;
|
| - fontWeight = toFontWeight([fontManager weightOfFont:font]);
|
| - fontSize = [font pointSize];
|
| + fontStyle = FontStyleNormal;
|
| + fontWeight = FontWeightNormal;
|
| + fontSize = systemNSFontSize(systemFontID);
|
| fontFamily = @"BlinkMacSystemFont";
|
| }
|
|
|
| @@ -601,10 +569,10 @@ void LayoutThemeMac::setFontFromControlSize(ComputedStyle& style, NSControlSize
|
| fontDescription.setIsAbsoluteSize(true);
|
| fontDescription.setGenericFamily(FontDescription::SerifFamily);
|
|
|
| - NSFont* font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:controlSize]];
|
| + CGFloat pointSize = [NSFont systemFontSizeForControlSize:controlSize];
|
| fontDescription.firstFamily().setFamily(@"BlinkMacSystemFont");
|
| - fontDescription.setComputedSize([font pointSize] * style.effectiveZoom());
|
| - fontDescription.setSpecifiedSize([font pointSize] * style.effectiveZoom());
|
| + fontDescription.setComputedSize(pointSize * style.effectiveZoom());
|
| + fontDescription.setSpecifiedSize(pointSize * style.effectiveZoom());
|
|
|
| // Reset line height.
|
| style.setLineHeight(ComputedStyle::initialLineHeight());
|
|
|