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

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: Rebase 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
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 78094f5f6c33dcea4836ec7e065b2ed1060fe94a..fce6616eab5e282054d98f3951d97adee5c7059e 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
// Apple specific properties. These will never be standardized and are purely to
@@ -1186,8 +1171,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:
@@ -1299,6 +1282,11 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
case CSSPropertyWebkitLogicalHeight:
case CSSPropertyClip:
case CSSPropertyTouchAction:
+ case CSSPropertyWebkitColumnWidth:
+ case CSSPropertyWebkitColumnCount:
+ case CSSPropertyWebkitColumns:
+ case CSSPropertyWebkitColumnGap:
+ case CSSPropertyWebkitColumnSpan:
validPrimitive = false;
break;
@@ -1641,65 +1629,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

Powered by Google App Engine
This is Rietveld 408576698