Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: Source/core/css/parser/CSSPropertyParser.cpp

Issue 677103002: Expand system font values during property parsing. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove isExpandedShorthandForAll. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.h ('k') | Source/core/css/resolver/FontBuilder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. 9 * Copyright (C) 2012 Intel Corporation. All rights reserved.
10 * 10 *
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "core/css/CSSGridLineNamesValue.h" 42 #include "core/css/CSSGridLineNamesValue.h"
43 #include "core/css/CSSGridTemplateAreasValue.h" 43 #include "core/css/CSSGridTemplateAreasValue.h"
44 #include "core/css/CSSImageSetValue.h" 44 #include "core/css/CSSImageSetValue.h"
45 #include "core/css/CSSImageValue.h" 45 #include "core/css/CSSImageValue.h"
46 #include "core/css/CSSInheritedValue.h" 46 #include "core/css/CSSInheritedValue.h"
47 #include "core/css/CSSInitialValue.h" 47 #include "core/css/CSSInitialValue.h"
48 #include "core/css/CSSKeyframeRule.h" 48 #include "core/css/CSSKeyframeRule.h"
49 #include "core/css/CSSKeyframesRule.h" 49 #include "core/css/CSSKeyframesRule.h"
50 #include "core/css/CSSLineBoxContainValue.h" 50 #include "core/css/CSSLineBoxContainValue.h"
51 #include "core/css/CSSPrimitiveValue.h" 51 #include "core/css/CSSPrimitiveValue.h"
52 #include "core/css/CSSPrimitiveValueMappings.h"
52 #include "core/css/CSSPropertyMetadata.h" 53 #include "core/css/CSSPropertyMetadata.h"
53 #include "core/css/CSSPropertySourceData.h" 54 #include "core/css/CSSPropertySourceData.h"
54 #include "core/css/CSSReflectValue.h" 55 #include "core/css/CSSReflectValue.h"
55 #include "core/css/CSSSVGDocumentValue.h" 56 #include "core/css/CSSSVGDocumentValue.h"
56 #include "core/css/CSSSelector.h" 57 #include "core/css/CSSSelector.h"
57 #include "core/css/CSSShadowValue.h" 58 #include "core/css/CSSShadowValue.h"
58 #include "core/css/CSSTimingFunctionValue.h" 59 #include "core/css/CSSTimingFunctionValue.h"
59 #include "core/css/CSSTransformValue.h" 60 #include "core/css/CSSTransformValue.h"
60 #include "core/css/CSSUnicodeRangeValue.h" 61 #include "core/css/CSSUnicodeRangeValue.h"
61 #include "core/css/CSSValueList.h" 62 #include "core/css/CSSValueList.h"
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1390 // <margin-width>{1,4} | inherit 1391 // <margin-width>{1,4} | inherit
1391 return parse4Values(propId, marginShorthand().properties(), important); 1392 return parse4Values(propId, marginShorthand().properties(), important);
1392 case CSSPropertyPadding: 1393 case CSSPropertyPadding:
1393 // <padding-width>{1,4} | inherit 1394 // <padding-width>{1,4} | inherit
1394 return parse4Values(propId, paddingShorthand().properties(), important); 1395 return parse4Values(propId, paddingShorthand().properties(), important);
1395 case CSSPropertyFlexFlow: 1396 case CSSPropertyFlexFlow:
1396 return parseShorthand(propId, flexFlowShorthand(), important); 1397 return parseShorthand(propId, flexFlowShorthand(), important);
1397 case CSSPropertyFont: 1398 case CSSPropertyFont:
1398 // [ [ 'font-style' || 'font-variant' || 'font-weight' ]? 'font-size' [ / 'line-height' ]? 1399 // [ [ 'font-style' || 'font-variant' || 'font-weight' ]? 'font-size' [ / 'line-height' ]?
1399 // 'font-family' ] | caption | icon | menu | message-box | small-caption | status-bar | inherit 1400 // 'font-family' ] | caption | icon | menu | message-box | small-caption | status-bar | inherit
1400 if (id >= CSSValueCaption && id <= CSSValueStatusBar) 1401 if (num == 1 && id >= CSSValueCaption && id <= CSSValueStatusBar) {
1401 validPrimitive = true; 1402 parseSystemFont(important);
1402 else 1403 return true;
1403 return parseFont(important); 1404 }
1404 break; 1405 return parseFont(important);
1405 case CSSPropertyListStyle: 1406 case CSSPropertyListStyle:
1406 return parseShorthand(propId, listStyleShorthand(), important); 1407 return parseShorthand(propId, listStyleShorthand(), important);
1407 case CSSPropertyWebkitColumns: 1408 case CSSPropertyWebkitColumns:
1408 return parseColumnsShorthand(important); 1409 return parseColumnsShorthand(important);
1409 case CSSPropertyWebkitColumnRule: 1410 case CSSPropertyWebkitColumnRule:
1410 return parseShorthand(propId, webkitColumnRuleShorthand(), important); 1411 return parseShorthand(propId, webkitColumnRuleShorthand(), important);
1411 case CSSPropertyWebkitTextStroke: 1412 case CSSPropertyWebkitTextStroke:
1412 return parseShorthand(propId, webkitTextStrokeShorthand(), important); 1413 return parseShorthand(propId, webkitTextStrokeShorthand(), important);
1413 case CSSPropertyAnimation: 1414 case CSSPropertyAnimation:
1414 ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled()); 1415 ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled());
(...skipping 3016 matching lines...) Expand 10 before | Expand all | Expand 10 after
4431 4432
4432 // FIXME: http://www.w3.org/TR/2011/WD-css3-fonts-20110324/#font-prop requir es that 4433 // FIXME: http://www.w3.org/TR/2011/WD-css3-fonts-20110324/#font-prop requir es that
4433 // "font-stretch", "font-size-adjust", and "font-kerning" be reset to their initial values 4434 // "font-stretch", "font-size-adjust", and "font-kerning" be reset to their initial values
4434 // but we don't seem to support them at the moment. They should also be adde d here once implemented. 4435 // but we don't seem to support them at the moment. They should also be adde d here once implemented.
4435 if (m_valueList->current()) 4436 if (m_valueList->current())
4436 return false; 4437 return false;
4437 4438
4438 return true; 4439 return true;
4439 } 4440 }
4440 4441
4442 void CSSPropertyParser::parseSystemFont(bool important)
4443 {
4444 ASSERT(m_valueList->size() == 1);
4445 CSSValueID systemFontID = m_valueList->valueAt(0)->id;
4446 ASSERT(systemFontID >= CSSValueCaption && systemFontID <= CSSValueStatusBar) ;
4447 m_valueList->next();
4448
4449 FontStyle fontStyle = FontStyleNormal;
4450 FontWeight fontWeight = FontWeightNormal;
4451 float fontSize = 0;
4452 AtomicString fontFamily;
4453 RenderTheme::theme().systemFont(systemFontID, fontStyle, fontWeight, fontSiz e, fontFamily);
4454
4455 ShorthandScope scope(this, CSSPropertyFont);
4456 addProperty(CSSPropertyFontStyle, cssValuePool().createIdentifierValue(fontS tyle == FontStyleItalic ? CSSValueItalic : CSSValueNormal), important);
4457 addProperty(CSSPropertyFontWeight, cssValuePool().createValue(fontWeight), i mportant);
4458 addProperty(CSSPropertyFontSize, cssValuePool().createValue(fontSize, CSSPri mitiveValue::CSS_PX), important);
4459 RefPtr<CSSValueList> fontFamilyList = CSSValueList::createCommaSeparated();
4460 fontFamilyList->append(cssValuePool().createFontFamilyValue(fontFamily));
4461 addProperty(CSSPropertyFontFamily, fontFamilyList.release(), important);
4462 addProperty(CSSPropertyFontVariant, cssValuePool().createIdentifierValue(CSS ValueNormal), important);
4463 addProperty(CSSPropertyLineHeight, cssValuePool().createIdentifierValue(CSSV alueNormal), important);
4464 }
4465
4441 class FontFamilyValueBuilder { 4466 class FontFamilyValueBuilder {
4442 DISALLOW_ALLOCATION(); 4467 DISALLOW_ALLOCATION();
4443 public: 4468 public:
4444 FontFamilyValueBuilder(CSSValueList* list) 4469 FontFamilyValueBuilder(CSSValueList* list)
4445 : m_list(list) 4470 : m_list(list)
4446 { 4471 {
4447 } 4472 }
4448 4473
4449 void add(const CSSParserString& string) 4474 void add(const CSSParserString& string)
4450 { 4475 {
(...skipping 3885 matching lines...) Expand 10 before | Expand all | Expand 10 after
8336 return nullptr; 8361 return nullptr;
8337 a = args->next(); 8362 a = args->next();
8338 8363
8339 argNumber++; 8364 argNumber++;
8340 } 8365 }
8341 8366
8342 return transformValue.release(); 8367 return transformValue.release();
8343 } 8368 }
8344 8369
8345 } // namespace blink 8370 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.h ('k') | Source/core/css/resolver/FontBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698