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

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

Issue 144143005: Preserve shape-box order in non-computed values (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updating patch to trunk Created 6 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 | « Source/core/css/parser/CSSPropertyParser.h ('k') | Source/core/rendering/style/BasicShapes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/parser/CSSPropertyParser.cpp
diff --git a/Source/core/css/parser/CSSPropertyParser.cpp b/Source/core/css/parser/CSSPropertyParser.cpp
index 09ce7ac4fa2bb41de1c6190f3f4523392c13f3b7..34adc34b1e321ac9afe0ca12dcf789321040ea3c 100644
--- a/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/Source/core/css/parser/CSSPropertyParser.cpp
@@ -4434,40 +4434,43 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseShapeProperty(CSSProper
return imageValue.release();
}
- if (value->unit == CSSParserValue::Function) {
- shapeValue = parseBasicShape();
- if (!shapeValue)
- return nullptr;
- } else if (isBoxValue(valueId)) {
- boxValue = parseValidPrimitive(valueId, value);
- m_valueList->next();
- } else {
- return nullptr;
- }
+ return parseBasicShapeAndOrBox();
+}
- ASSERT(shapeValue || boxValue);
- value = m_valueList->current();
+PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseBasicShapeAndOrBox()
+{
+ CSSParserValue* value = m_valueList->current();
- if (value) {
+ bool shapeFound = false;
+ bool boxFound = false;
+ CSSValueID valueId;
+
+ RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ for (unsigned i = 0; i < 2; ++i) {
+ if (!value)
+ break;
valueId = value->id;
- if (boxValue && value->unit == CSSParserValue::Function) {
- shapeValue = parseBasicShape();
+ if (value->unit == CSSParserValue::Function && !shapeFound) {
+ // parseBasicShape already asks for the next value list item.
+ RefPtr<CSSPrimitiveValue> shapeValue = parseBasicShape();
if (!shapeValue)
return nullptr;
- } else if (shapeValue && isBoxValue(valueId)) {
- boxValue = parseValidPrimitive(valueId, value);
+ list->append(shapeValue.release());
+ shapeFound = true;
+ } else if (isBoxValue(valueId) && !boxFound) {
+ list->append(parseValidPrimitive(valueId, value));
+ boxFound = true;
m_valueList->next();
} else {
return nullptr;
}
- ASSERT(shapeValue && boxValue);
- shapeValue->getShapeValue()->setLayoutBox(boxValue.release());
+ value = m_valueList->current();
}
- if (shapeValue)
- return shapeValue.release();
- return boxValue.release();
+ if (m_valueList->current())
+ return nullptr;
+ return list.release();
}
PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::parseBasicShape()
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.h ('k') | Source/core/rendering/style/BasicShapes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698