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

Unified Diff: Source/core/css/parser/CSSPropertyParser.cpp

Issue 203523002: Reland "Add plumbing for font-stretch" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: w/fix for ASSERT Created 6 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.h ('k') | Source/core/css/resolver/AnimatedStyleBuilder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/parser/CSSPropertyParser.cpp
diff --git a/Source/core/css/parser/CSSPropertyParser.cpp b/Source/core/css/parser/CSSPropertyParser.cpp
index 7ca9e185a809bc99bfd4f577b9c3d53151ea0e07..9184b4eb5a3a0bcc63e2db3ab57886d4867a4a64 100644
--- a/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/Source/core/css/parser/CSSPropertyParser.cpp
@@ -530,6 +530,13 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important)
return false;
return parseFontWeight(important);
}
+
+ case CSSPropertyFontStretch: { // normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded
+ if (m_valueList->size() != 1)
+ return false;
+ return parseFontStretch(important);
+ }
+
case CSSPropertyBorderSpacing: {
if (num == 1) {
ShorthandScope scope(this, CSSPropertyBorderSpacing);
@@ -1444,8 +1451,6 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important)
return false;
case CSSPropertyPage:
return parsePage(propId, important);
- case CSSPropertyFontStretch:
- return false;
// CSS Text Layout Module Level 3: Vertical writing support
case CSSPropertyWebkitTextEmphasis:
return parseShorthand(propId, webkitTextEmphasisShorthand(), important);
@@ -4537,6 +4542,7 @@ bool CSSPropertyParser::parseFont(bool important)
bool fontStyleParsed = false;
bool fontVariantParsed = false;
bool fontWeightParsed = false;
+ bool fontStretchParsed = false;
CSSParserValue* value = m_valueList->current();
for (; value; value = m_valueList->next()) {
if (!fontStyleParsed && isValidKeywordPropertyAndValue(CSSPropertyFontStyle, value->id, m_context)) {
@@ -4546,10 +4552,13 @@ bool CSSPropertyParser::parseFont(bool important)
// Font variant in the shorthand is particular, it only accepts normal or small-caps.
addProperty(CSSPropertyFontVariant, cssValuePool().createIdentifierValue(value->id), important);
fontVariantParsed = true;
- } else if (!fontWeightParsed && parseFontWeight(important))
+ } else if (!fontWeightParsed && parseFontWeight(important)) {
fontWeightParsed = true;
- else
+ } else if (!fontStretchParsed && parseFontStretch(important)) {
+ fontStretchParsed = true;
+ } else {
break;
+ }
}
if (!value)
@@ -4561,6 +4570,8 @@ bool CSSPropertyParser::parseFont(bool important)
addProperty(CSSPropertyFontVariant, cssValuePool().createIdentifierValue(CSSValueNormal), important, true);
if (!fontWeightParsed)
addProperty(CSSPropertyFontWeight, cssValuePool().createIdentifierValue(CSSValueNormal), important, true);
+ if (!fontStretchParsed)
+ addProperty(CSSPropertyFontStretch, cssValuePool().createIdentifierValue(CSSValueNormal), important, true);
// Now a font size _must_ come.
// <absolute-size> | <relative-size> | <length> | <percentage> | inherit
@@ -4801,6 +4812,16 @@ bool CSSPropertyParser::parseFontWeight(bool important)
return false;
}
+bool CSSPropertyParser::parseFontStretch(bool important)
+{
+ CSSParserValue* value = m_valueList->current();
+ if (value->id == CSSValueNormal || (value->id >= CSSValueUltraCondensed && value->id <= CSSValueUltraExpanded)) {
+ addProperty(CSSPropertyFontStretch, cssValuePool().createIdentifierValue(value->id), important);
+ return true;
+ }
+ return false;
+}
+
bool CSSPropertyParser::parseFontFaceSrcURI(CSSValueList* valueList)
{
RefPtrWillBeRawPtr<CSSFontFaceSrcValue> uriValue(CSSFontFaceSrcValue::create(completeURL(m_valueList->current()->string)));
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.h ('k') | Source/core/css/resolver/AnimatedStyleBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698