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

Unified Diff: Source/core/css/SVGCSSParser.cpp

Issue 22482004: Add support for the object-fit CSS property. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase for landing Created 7 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
« no previous file with comments | « Source/core/css/SVGCSSComputedStyleDeclaration.cpp ('k') | Source/core/css/SVGCSSPropertyNames.in » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/SVGCSSParser.cpp
diff --git a/Source/core/css/SVGCSSParser.cpp b/Source/core/css/SVGCSSParser.cpp
index 6595cf7f546424d268f55aa9d7836eec5fd0d62b..ba70fcb51b420ae01875035317eb1ffea26cb4ce 100644
--- a/Source/core/css/SVGCSSParser.cpp
+++ b/Source/core/css/SVGCSSParser.cpp
@@ -24,6 +24,7 @@
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
+#include "RuntimeEnabledFeatures.h"
#include "core/css/CSSParser.h"
#include "core/css/CSSValueList.h"
#include "core/rendering/RenderTheme.h"
@@ -225,6 +226,16 @@ bool CSSParser::parseSVGValue(CSSPropertyID propId, bool important)
break;
+ case CSSPropertyPaintOrder:
+ if (!RuntimeEnabledFeatures::svgPaintOrderEnabled())
+ return false;
+
+ if (m_valueList->size() == 1 && id == CSSValueNormal)
+ valid_primitive = true;
+ else if ((parsedValue = parsePaintOrder()))
+ m_valueList->next();
+ break;
+
case CSSPropertyVectorEffect: // none | non-scaling-stroke | inherit
if (id == CSSValueNone || id == CSSValueNonScalingStroke)
valid_primitive = true;
@@ -355,4 +366,62 @@ PassRefPtr<CSSValue> CSSParser::parseSVGColor()
return SVGColor::createFromColor(Color(c));
}
+// normal | [ fill || stroke || markers ]
+PassRefPtr<CSSValue> CSSParser::parsePaintOrder() const
+{
+ if (m_valueList->size() > 3)
+ return 0;
+
+ CSSParserValue* value = m_valueList->current();
+ if (!value)
+ return 0;
+
+ RefPtr<CSSValueList> parsedValues = CSSValueList::createSpaceSeparated();
+
+ // The default paint-order is: Fill, Stroke, Markers.
+ bool seenFill = false,
+ seenStroke = false,
+ seenMarkers = false;
+
+ do {
+ switch (value->id) {
+ case CSSValueNormal:
+ // normal inside [fill || stroke || markers] not valid
+ return 0;
+ case CSSValueFill:
+ if (seenFill)
+ return 0;
+
+ seenFill = true;
+ break;
+ case CSSValueStroke:
+ if (seenStroke)
+ return 0;
+
+ seenStroke = true;
+ break;
+ case CSSValueMarkers:
+ if (seenMarkers)
+ return 0;
+
+ seenMarkers = true;
+ break;
+ default:
+ return 0;
+ }
+
+ parsedValues->append(CSSPrimitiveValue::createIdentifier(value->id));
+ } while ((value = m_valueList->next()));
+
+ // fill out the rest of the paint order
+ if (!seenFill)
+ parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill));
+ if (!seenStroke)
+ parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke));
+ if (!seenMarkers)
+ parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers));
+
+ return parsedValues.release();
+}
+
}
« no previous file with comments | « Source/core/css/SVGCSSComputedStyleDeclaration.cpp ('k') | Source/core/css/SVGCSSPropertyNames.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698