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

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

Issue 1399003004: Move columns related properties into CSSPropertyParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch for landing Created 5 years, 2 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.cpp ('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/LegacyCSSPropertyParser.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp
index 06e5e82998f531cb7d9f8bbdaaf77a31f4b98b26..517c613b80c6d2adfd9e949c4732c3016a0d1ef6 100644
--- a/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp
@@ -1067,21 +1067,6 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
return parseGridShorthand(important);
- case CSSPropertyWebkitColumnCount:
- parsedValue = parseColumnCount();
- break;
- case CSSPropertyWebkitColumnGap: // normal | <length>
- if (id == CSSValueNormal)
- validPrimitive = true;
- else
- validPrimitive = validUnit(value, FLength | FNonNeg);
- break;
- case CSSPropertyWebkitColumnSpan: // none | all | 1 (will be dropped in the unprefixed property)
- validPrimitive = id == CSSValueAll || id == CSSValueNone || (value->unit() == CSSPrimitiveValue::UnitType::Number && value->fValue == 1);
- break;
- case CSSPropertyWebkitColumnWidth: // auto | <length>
- parsedValue = parseColumnWidth();
- break;
// End of CSS3 properties
case CSSPropertyWebkitAppRegion:
@@ -1162,8 +1147,6 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
return parseShorthand(propId, flexFlowShorthand(), important);
case CSSPropertyListStyle:
return parseShorthand(propId, listStyleShorthand(), important);
- case CSSPropertyWebkitColumns:
- return parseColumnsShorthand(important);
case CSSPropertyWebkitColumnRule:
return parseShorthand(propId, webkitColumnRuleShorthand(), important);
case CSSPropertyWebkitTextStroke:
@@ -1279,6 +1262,11 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
case CSSPropertyWebkitFontSizeDelta:
case CSSPropertyWebkitHyphenateCharacter:
case CSSPropertyWebkitLocale:
+ case CSSPropertyWebkitColumnWidth:
+ case CSSPropertyWebkitColumnCount:
+ case CSSPropertyWebkitColumns:
+ case CSSPropertyWebkitColumnGap:
+ case CSSPropertyWebkitColumnSpan:
validPrimitive = false;
break;
@@ -1621,65 +1609,6 @@ bool CSSPropertyParser::parseTransitionShorthand(bool important)
return true;
}
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseColumnWidth()
-{
- CSSParserValue* value = m_valueList->current();
- // Always parse lengths in strict mode here, since it would be ambiguous otherwise when used in
- // the 'columns' shorthand property.
- if (value->id == CSSValueAuto || (validUnit(value, FLength | FNonNeg, HTMLStandardMode) && (m_parsedCalculation || value->fValue != 0))) {
- RefPtrWillBeRawPtr<CSSValue> parsedValue = parseValidPrimitive(value->id, value);
- m_valueList->next();
- return parsedValue;
- }
- return nullptr;
-}
-
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseColumnCount()
-{
- CSSParserValue* value = m_valueList->current();
- if (value->id == CSSValueAuto || validUnit(value, FPositiveInteger)) {
- RefPtrWillBeRawPtr<CSSValue> parsedValue = parseValidPrimitive(value->id, value);
- m_valueList->next();
- return parsedValue;
- }
- return nullptr;
-}
-
-bool CSSPropertyParser::parseColumnsShorthand(bool important)
-{
- RefPtrWillBeRawPtr<CSSValue> columnWidth = nullptr;
- RefPtrWillBeRawPtr<CSSValue> columnCount = nullptr;
-
- for (unsigned propertiesParsed = 0; CSSParserValue* value = m_valueList->current(); propertiesParsed++) {
- if (propertiesParsed >= 2)
- return false; // Too many values for this shorthand. Invalid declaration.
- if (value->id == CSSValueAuto) {
- // Skip 'auto' as we will use it for initial value if no width/count was parsed.
- m_valueList->next();
- } else {
- if (!columnWidth) {
- if ((columnWidth = parseColumnWidth()))
- continue;
- }
- if (!columnCount) {
- if ((columnCount = parseColumnCount()))
- continue;
- }
- // If we didn't find at least one match, this is an
- // invalid shorthand and we have to ignore it.
- return false;
- }
- }
-
- if (!columnWidth)
- columnWidth = cssValuePool().createIdentifierValue(CSSValueAuto);
- addProperty(CSSPropertyWebkitColumnWidth, columnWidth, important);
- if (!columnCount)
- columnCount = cssValuePool().createIdentifierValue(CSSValueAuto);
- addProperty(CSSPropertyWebkitColumnCount, columnCount, important);
- return true;
-}
-
bool CSSPropertyParser::parseShorthand(CSSPropertyID propId, const StylePropertyShorthand& shorthand, bool important)
{
// We try to match as many properties as possible
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698