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

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

Issue 1374353003: Refactor consumeFontVariant (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 | « third_party/WebKit/Source/core/css/parser/CSSPropertyParser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
index 4aef4cf533e6dc8aca53d88dba46458b8d7be27f..498e3bf9420ff5fece2dfc2e1ed8915c62b9abc8 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -428,27 +428,30 @@ static PassRefPtrWillBeRawPtr<CSSValue> consumeFontVariantLigatures(CSSParserTok
return ligatureValues.release();
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::consumeFontVariant()
+static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeFontVariant(CSSParserTokenRange& range)
+{
+ if (range.peek().id() == CSSValueNormal || range.peek().id() == CSSValueSmallCaps)
+ return consumeIdent(range);
+ return nullptr;
+}
+
+static PassRefPtrWillBeRawPtr<CSSValue> consumeFontVariantList(CSSParserTokenRange& range)
{
- if (m_ruleType != StyleRule::FontFace) {
- if (m_range.peek().id() != CSSValueNormal && m_range.peek().id() != CSSValueSmallCaps)
- return nullptr;
- return consumeIdent(m_range);
- }
RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated();
do {
- if (m_range.peek().id() == CSSValueAll) {
+ if (range.peek().id() == CSSValueAll) {
// FIXME: CSSPropertyParser::parseFontVariant() implements
// the old css3 draft:
// http://www.w3.org/TR/2002/WD-css3-webfonts-20020802/#font-variant
// 'all' is only allowed in @font-face and with no other values.
if (values->length())
return nullptr;
- return consumeIdent(m_range);
+ return consumeIdent(range);
}
- if (m_range.peek().id() == CSSValueNormal || m_range.peek().id() == CSSValueSmallCaps)
- values->append(consumeIdent(m_range));
- } while (consumeCommaIncludingWhitespace(m_range));
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> fontVariant = consumeFontVariant(range);
+ if (fontVariant)
+ values->append(fontVariant.release());
+ } while (consumeCommaIncludingWhitespace(range));
if (values->length())
return values.release();
@@ -562,7 +565,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty
case CSSPropertyWebkitFontFeatureSettings:
return consumeFontFeatureSettings(m_range);
case CSSPropertyFontVariant:
- return consumeFontVariant();
+ return consumeFontVariant(m_range);
case CSSPropertyFontFamily:
return consumeFontFamily(m_range);
case CSSPropertyFontWeight:
@@ -683,9 +686,13 @@ bool CSSPropertyParser::parseFontFaceDescriptor(CSSPropertyID propId)
break;
}
case CSSPropertyFontVariant:
+ parsedValue = consumeFontVariantList(m_range);
+ break;
case CSSPropertyFontWeight:
+ parsedValue = consumeFontWeight(m_range);
+ break;
case CSSPropertyWebkitFontFeatureSettings:
- parsedValue = parseSingleValue(propId);
+ parsedValue = consumeFontFeatureSettings(m_range);
break;
default:
break;
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698