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

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

Issue 2249653002: border-foo WIP Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: V9 Created 4 years, 4 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/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 6ad5b1c4e2d4b13fed9eaac5c9cba9fc914378b1..ed725ad262c0fd08f41491273ce5be89300e6a9a 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -1296,10 +1296,9 @@ bool CSSPropertyParser::consumeAnimationShorthand(const StylePropertyShorthand&
return false;
} while (!m_range.atEnd() && m_range.peek().type() != CommaToken);
- // TODO(timloh): This will make invalid longhands, see crbug.com/386459
for (size_t i = 0; i < longhandCount; ++i) {
if (!parsedLonghand[i])
- longhands[i]->append(*CSSInitialValue::createLegacyImplicit());
+ longhands[i]->append(*CSSPropertyMetadata::initialValue(shorthand.properties()[i]));
parsedLonghand[i] = false;
}
} while (consumeCommaIncludingWhitespace(m_range));
@@ -3930,7 +3929,7 @@ bool CSSPropertyParser::consumeShorthandGreedily(const StylePropertyShorthand& s
if (longhands[i])
addProperty(shorthandProperties[i], shorthand.id(), *longhands[i], important);
else
- addProperty(shorthandProperties[i], shorthand.id(), *CSSInitialValue::createLegacyImplicit(), important);
+ addProperty(shorthandProperties[i], shorthand.id(), *CSSPropertyMetadata::initialValue(shorthandProperties[i]), important);
}
return true;
}
@@ -4018,17 +4017,20 @@ bool CSSPropertyParser::consumeBorder(bool important)
return false;
if (!width)
- width = CSSInitialValue::createLegacyImplicit();
+ width = CSSPropertyMetadata::initialValue(CSSPropertyBorderWidth);
if (!style)
- style = CSSInitialValue::createLegacyImplicit();
+ style = CSSPropertyMetadata::initialValue(CSSPropertyBorderStyle);
if (!color)
- color = CSSInitialValue::createLegacyImplicit();
+ color = CSSPropertyMetadata::initialValue(CSSPropertyBorderColor);
addExpandedPropertyForValue(CSSPropertyBorderWidth, *width, important);
addExpandedPropertyForValue(CSSPropertyBorderStyle, *style, important);
addExpandedPropertyForValue(CSSPropertyBorderColor, *color, important);
- addExpandedPropertyForValue(CSSPropertyBorderImage, *CSSInitialValue::createLegacyImplicit(), important);
-
+ addProperty(CSSPropertyBorderImageSource, CSSPropertyBorderImage, *CSSPropertyMetadata::initialValue(CSSPropertyBorderImageSource), important);
+ addProperty(CSSPropertyBorderImageSlice, CSSPropertyBorderImage, *CSSPropertyMetadata::initialValue(CSSPropertyBorderImageSlice), important);
+ addProperty(CSSPropertyBorderImageWidth, CSSPropertyBorderImage, *CSSPropertyMetadata::initialValue(CSSPropertyBorderImageWidth), important);
+ addProperty(CSSPropertyBorderImageOutset, CSSPropertyBorderImage, *CSSPropertyMetadata::initialValue(CSSPropertyBorderImageOutset), important);
+ addProperty(CSSPropertyBorderImageRepeat, CSSPropertyBorderImage, *CSSPropertyMetadata::initialValue(CSSPropertyBorderImageRepeat), important);
return m_range.atEnd();
}
@@ -4074,18 +4076,18 @@ bool CSSPropertyParser::consumeBorderImage(CSSPropertyID property, bool importan
if (consumeBorderImageComponents(property, m_range, m_context, source, slice, width, outset, repeat)) {
switch (property) {
case CSSPropertyWebkitMaskBoxImage:
- addProperty(CSSPropertyWebkitMaskBoxImageSource, CSSPropertyWebkitMaskBoxImage, source ? *source : *CSSInitialValue::createLegacyImplicit(), important);
- addProperty(CSSPropertyWebkitMaskBoxImageSlice, CSSPropertyWebkitMaskBoxImage, slice ? *slice : *CSSInitialValue::createLegacyImplicit(), important);
- addProperty(CSSPropertyWebkitMaskBoxImageWidth, CSSPropertyWebkitMaskBoxImage, width ? *width : *CSSInitialValue::createLegacyImplicit(), important);
- addProperty(CSSPropertyWebkitMaskBoxImageOutset, CSSPropertyWebkitMaskBoxImage, outset ? *outset : *CSSInitialValue::createLegacyImplicit(), important);
- addProperty(CSSPropertyWebkitMaskBoxImageRepeat, CSSPropertyWebkitMaskBoxImage, repeat ? *repeat : *CSSInitialValue::createLegacyImplicit(), important);
+ addProperty(CSSPropertyWebkitMaskBoxImageSource, CSSPropertyWebkitMaskBoxImage, source ? *source : *CSSPropertyMetadata::initialValue(CSSPropertyWebkitMaskBoxImageSource), important);
+ addProperty(CSSPropertyWebkitMaskBoxImageSlice, CSSPropertyWebkitMaskBoxImage, slice ? *slice : *CSSPropertyMetadata::initialValue(CSSPropertyWebkitMaskBoxImageSlice), important);
+ addProperty(CSSPropertyWebkitMaskBoxImageWidth, CSSPropertyWebkitMaskBoxImage, width ? *width : *CSSPropertyMetadata::initialValue(CSSPropertyWebkitMaskBoxImageWidth), important);
+ addProperty(CSSPropertyWebkitMaskBoxImageOutset, CSSPropertyWebkitMaskBoxImage, outset ? *outset : *CSSPropertyMetadata::initialValue(CSSPropertyWebkitMaskBoxImageOutset), important);
+ addProperty(CSSPropertyWebkitMaskBoxImageRepeat, CSSPropertyWebkitMaskBoxImage, repeat ? *repeat : *CSSPropertyMetadata::initialValue(CSSPropertyWebkitMaskBoxImageRepeat), important);
return true;
case CSSPropertyBorderImage:
- addProperty(CSSPropertyBorderImageSource, CSSPropertyBorderImage, source ? *source : *CSSInitialValue::createLegacyImplicit(), important);
- addProperty(CSSPropertyBorderImageSlice, CSSPropertyBorderImage, slice ? *slice : *CSSInitialValue::createLegacyImplicit(), important);
- addProperty(CSSPropertyBorderImageWidth, CSSPropertyBorderImage, width ? *width : *CSSInitialValue::createLegacyImplicit(), important);
- addProperty(CSSPropertyBorderImageOutset, CSSPropertyBorderImage, outset ? *outset : *CSSInitialValue::createLegacyImplicit(), important);
- addProperty(CSSPropertyBorderImageRepeat, CSSPropertyBorderImage, repeat ? *repeat : *CSSInitialValue::createLegacyImplicit(), important);
+ addProperty(CSSPropertyBorderImageSource, CSSPropertyBorderImage, source ? *source : *CSSPropertyMetadata::initialValue(CSSPropertyBorderImageSource), important);
+ addProperty(CSSPropertyBorderImageSlice, CSSPropertyBorderImage, slice ? *slice : *CSSPropertyMetadata::initialValue(CSSPropertyBorderImageSlice), important);
+ addProperty(CSSPropertyBorderImageWidth, CSSPropertyBorderImage, width ? *width : *CSSPropertyMetadata::initialValue(CSSPropertyBorderImageWidth), important);
+ addProperty(CSSPropertyBorderImageOutset, CSSPropertyBorderImage, outset ? *outset : *CSSPropertyMetadata::initialValue(CSSPropertyBorderImageOutset), important);
+ addProperty(CSSPropertyBorderImageRepeat, CSSPropertyBorderImage, repeat ? *repeat : *CSSPropertyMetadata::initialValue(CSSPropertyBorderImageRepeat), important);
return true;
default:
ASSERT_NOT_REACHED();
@@ -4273,7 +4275,6 @@ bool CSSPropertyParser::consumeBackgroundShorthand(const StylePropertyShorthand&
return false;
} while (!m_range.atEnd() && m_range.peek().type() != CommaToken);
- // TODO(timloh): This will make invalid longhands, see crbug.com/386459
for (size_t i = 0; i < longhandCount; ++i) {
CSSPropertyID property = shorthand.properties()[i];
if (property == CSSPropertyBackgroundColor && !m_range.atEnd()) {
@@ -4286,7 +4287,7 @@ bool CSSPropertyParser::consumeBackgroundShorthand(const StylePropertyShorthand&
continue;
}
if (!parsedLonghand[i])
- addBackgroundValue(longhands[i], CSSInitialValue::createLegacyImplicit());
+ addBackgroundValue(longhands[i], CSSPropertyMetadata::initialValue(property));
}
} while (consumeCommaIncludingWhitespace(m_range));
if (!m_range.atEnd())
@@ -4466,11 +4467,11 @@ bool CSSPropertyParser::consumeGridShorthand(bool important)
if (consumeGridTemplateShorthand(CSSPropertyGrid, important)) {
// It can only be specified the explicit or the implicit grid properties in a single grid declaration.
// The sub-properties not specified are set to their initial value, as normal for shorthands.
- addProperty(CSSPropertyGridAutoFlow, CSSPropertyGrid, *CSSInitialValue::createLegacyImplicit(), important);
- addProperty(CSSPropertyGridAutoColumns, CSSPropertyGrid, *CSSInitialValue::createLegacyImplicit(), important);
- addProperty(CSSPropertyGridAutoRows, CSSPropertyGrid, *CSSInitialValue::createLegacyImplicit(), important);
- addProperty(CSSPropertyGridColumnGap, CSSPropertyGrid, *CSSInitialValue::createLegacyImplicit(), important);
- addProperty(CSSPropertyGridRowGap, CSSPropertyGrid, *CSSInitialValue::createLegacyImplicit(), important);
+ addProperty(CSSPropertyGridAutoFlow, CSSPropertyGrid, *CSSPropertyMetadata::initialValue(CSSPropertyGridAutoFlow), important);
+ addProperty(CSSPropertyGridAutoColumns, CSSPropertyGrid, *CSSPropertyMetadata::initialValue(CSSPropertyGridAutoColumns), important);
+ addProperty(CSSPropertyGridAutoRows, CSSPropertyGrid, *CSSPropertyMetadata::initialValue(CSSPropertyGridAutoRows), important);
+ addProperty(CSSPropertyGridColumnGap, CSSPropertyGrid, *CSSPropertyMetadata::initialValue(CSSPropertyGridColumnGap), important);
+ addProperty(CSSPropertyGridRowGap, CSSPropertyGrid, *CSSPropertyMetadata::initialValue(CSSPropertyGridRowGap), important);
return true;
}
@@ -4497,8 +4498,8 @@ bool CSSPropertyParser::consumeGridShorthand(bool important)
return false;
} else {
// Other omitted values are set to their initial values.
- autoColumnsValue = CSSInitialValue::createLegacyImplicit();
- autoRowsValue = CSSInitialValue::createLegacyImplicit();
+ autoColumnsValue = CSSPropertyMetadata::initialValue(CSSPropertyGridAutoColumns);
+ autoRowsValue = CSSPropertyMetadata::initialValue(CSSPropertyGridAutoRows);
}
// if <grid-auto-columns> value is omitted, it is set to the value specified for grid-auto-rows.
@@ -4507,14 +4508,14 @@ bool CSSPropertyParser::consumeGridShorthand(bool important)
// It can only be specified the explicit or the implicit grid properties in a single grid declaration.
// The sub-properties not specified are set to their initial value, as normal for shorthands.
- addProperty(CSSPropertyGridTemplateColumns, CSSPropertyGrid, *CSSInitialValue::createLegacyImplicit(), important);
- addProperty(CSSPropertyGridTemplateRows, CSSPropertyGrid, *CSSInitialValue::createLegacyImplicit(), important);
- addProperty(CSSPropertyGridTemplateAreas, CSSPropertyGrid, *CSSInitialValue::createLegacyImplicit(), important);
+ addProperty(CSSPropertyGridTemplateColumns, CSSPropertyGrid, *CSSPropertyMetadata::initialValue(CSSPropertyGridTemplateColumns), important);
+ addProperty(CSSPropertyGridTemplateRows, CSSPropertyGrid, *CSSPropertyMetadata::initialValue(CSSPropertyGridTemplateRows), important);
+ addProperty(CSSPropertyGridTemplateAreas, CSSPropertyGrid, *CSSPropertyMetadata::initialValue(CSSPropertyGridTemplateAreas), important);
addProperty(CSSPropertyGridAutoFlow, CSSPropertyGrid, *gridAutoFlow, important);
addProperty(CSSPropertyGridAutoColumns, CSSPropertyGrid, *autoColumnsValue, important);
addProperty(CSSPropertyGridAutoRows, CSSPropertyGrid, *autoRowsValue, important);
- addProperty(CSSPropertyGridColumnGap, CSSPropertyGrid, *CSSInitialValue::createLegacyImplicit(), important);
- addProperty(CSSPropertyGridRowGap, CSSPropertyGrid, *CSSInitialValue::createLegacyImplicit(), important);
+ addProperty(CSSPropertyGridColumnGap, CSSPropertyGrid, *CSSPropertyMetadata::initialValue(CSSPropertyGridColumnGap), important);
+ addProperty(CSSPropertyGridRowGap, CSSPropertyGrid, *CSSPropertyMetadata::initialValue(CSSPropertyGridRowGap), important);
return true;
}
« no previous file with comments | « third_party/WebKit/Source/core/css/StylePropertySerializer.cpp ('k') | third_party/WebKit/Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698