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

Unified Diff: third_party/WebKit/Source/core/css/cssom/InlineStylePropertyMap.cpp

Issue 2722503002: [CSS Typed OM] Specify and check separators for repeated properties (Closed)
Patch Set: Don't generate function Created 3 years, 10 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/CSSPropertyMetadata.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/cssom/InlineStylePropertyMap.cpp
diff --git a/third_party/WebKit/Source/core/css/cssom/InlineStylePropertyMap.cpp b/third_party/WebKit/Source/core/css/cssom/InlineStylePropertyMap.cpp
index edcc24f27a5ad1b347a3db02bbcf382fcdc0a92e..0374b759a3b3ef3cfc532eff05b8bf688eb2dc64 100644
--- a/third_party/WebKit/Source/core/css/cssom/InlineStylePropertyMap.cpp
+++ b/third_party/WebKit/Source/core/css/cssom/InlineStylePropertyMap.cpp
@@ -21,6 +21,21 @@ namespace blink {
namespace {
+CSSValueList* cssValueListForPropertyID(CSSPropertyID propertyID) {
+ char separator = CSSPropertyMetadata::repetitionSeparator(propertyID);
+ switch (separator) {
+ case ' ':
+ return CSSValueList::createSpaceSeparated();
+ case ',':
+ return CSSValueList::createCommaSeparated();
+ case '/':
+ return CSSValueList::createSlashSeparated();
+ default:
+ NOTREACHED();
+ return nullptr;
+ }
+}
+
const CSSValue* styleValueToCSSValue(CSSPropertyID propertyID,
const CSSStyleValue& styleValue) {
if (!CSSOMTypes::propertyCanTake(propertyID, styleValue))
@@ -38,16 +53,15 @@ const CSSValue* singleStyleValueAsCSSValue(CSSPropertyID propertyID,
cssValue->isCSSWideKeyword())
return cssValue;
- // TODO(meade): Determine the correct separator for each property.
- CSSValueList* valueList = CSSValueList::createSpaceSeparated();
+ CSSValueList* valueList = cssValueListForPropertyID(propertyID);
valueList->append(*cssValue);
return valueList;
}
-CSSValueList* asCSSValueList(CSSPropertyID propertyID,
- const CSSStyleValueVector& styleValueVector) {
- // TODO(meade): Determine the correct separator for each property.
- CSSValueList* valueList = CSSValueList::createSpaceSeparated();
+const CSSValueList* asCSSValueList(
+ CSSPropertyID propertyID,
+ const CSSStyleValueVector& styleValueVector) {
+ CSSValueList* valueList = cssValueListForPropertyID(propertyID);
for (const CSSStyleValue* value : styleValueVector) {
const CSSValue* cssValue = styleValueToCSSValue(propertyID, *value);
if (!cssValue) {
@@ -151,8 +165,7 @@ void InlineStylePropertyMap::append(
propertyID);
CSSValueList* cssValueList = nullptr;
if (!cssValue) {
- // TODO(meade): Determine the correct separator for each property.
- cssValueList = CSSValueList::createSpaceSeparated();
+ cssValueList = cssValueListForPropertyID(propertyID);
} else if (cssValue->isValueList()) {
cssValueList = toCSSValueList(cssValue)->copy();
} else {
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSPropertyMetadata.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698