Chromium Code Reviews| Index: Source/core/css/parser/CSSPropertyParser.cpp |
| diff --git a/Source/core/css/parser/CSSPropertyParser.cpp b/Source/core/css/parser/CSSPropertyParser.cpp |
| index 44d4a11799e1f3955d745b6643d136329b31d4bf..1abfd36b8962618982e433bc717496db4b4ac5d2 100644 |
| --- a/Source/core/css/parser/CSSPropertyParser.cpp |
| +++ b/Source/core/css/parser/CSSPropertyParser.cpp |
| @@ -55,6 +55,7 @@ |
| #include "core/css/CSSLineBoxContainValue.h" |
| #include "core/css/CSSParserValues.h" |
| #include "core/css/CSSPrimitiveValue.h" |
| +#include "core/css/CSSPrimitiveValueMappings.h" |
| #include "core/css/CSSPropertySourceData.h" |
| #include "core/css/CSSReflectValue.h" |
| #include "core/css/CSSSVGDocumentValue.h" |
| @@ -1413,11 +1414,11 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important) |
| case CSSPropertyFont: |
| // [ [ 'font-style' || 'font-variant' || 'font-weight' ]? 'font-size' [ / 'line-height' ]? |
| // 'font-family' ] | caption | icon | menu | message-box | small-caption | status-bar | inherit |
| - if (id >= CSSValueCaption && id <= CSSValueStatusBar) |
| - validPrimitive = true; |
| - else |
| - return parseFont(important); |
| - break; |
| + if (id >= CSSValueCaption && id <= CSSValueStatusBar) { |
|
apavlov
2014/03/20 15:27:49
This condition is missing "num == 1" - otherwise w
|
| + parseSystemFont(id, important); |
| + return true; |
| + } |
| + return parseFont(important); |
| case CSSPropertyListStyle: |
| return parseShorthand(propId, listStyleShorthand(), important); |
| case CSSPropertyWebkitColumns: |
| @@ -4519,6 +4520,23 @@ PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::parseBasicShape() |
| return cssValuePool().createValue(shape.release()); |
| } |
| +void CSSPropertyParser::parseSystemFont(CSSValueID systemFontID, bool important) |
| +{ |
| + FontStyle fontStyle = FontStyleNormal; |
| + FontWeight fontWeight = FontWeightNormal; |
| + float fontSize = 0; |
| + AtomicString fontFamily; |
| + RenderTheme::theme().systemFont(systemFontID, fontStyle, fontWeight, fontSize, fontFamily); |
| + addProperty(CSSPropertyFontStyle, cssValuePool().createValue(fontStyle), important); |
| + addProperty(CSSPropertyFontWeight, cssValuePool().createValue(fontWeight), important); |
| + addProperty(CSSPropertyFontSize, cssValuePool().createValue(fontSize, CSSPrimitiveValue::CSS_PX), important); |
| + RefPtr<CSSValueList> fontFamilyList = CSSValueList::createCommaSeparated(); |
| + fontFamilyList->append(cssValuePool().createFontFamilyValue(fontFamily)); |
| + addProperty(CSSPropertyFontFamily, fontFamilyList.release(), important); |
| + addProperty(CSSPropertyFontVariant, cssValuePool().createIdentifierValue(CSSValueNormal), important); |
| + addProperty(CSSPropertyLineHeight, cssValuePool().createIdentifierValue(CSSValueNormal), important); |
| +} |
| + |
| // [ 'font-style' || 'font-variant' || 'font-weight' ]? 'font-size' [ / 'line-height' ]? 'font-family' |
| bool CSSPropertyParser::parseFont(bool important) |
| { |