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

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

Issue 14907011: Support 'paint-order' from SVG2. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix review issues and add paint-order for text too Created 7 years, 5 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: Source/core/css/SVGCSSStyleSelector.cpp
diff --git a/Source/core/css/SVGCSSStyleSelector.cpp b/Source/core/css/SVGCSSStyleSelector.cpp
index ace386b1d82f1836ba744f118f40f302e5a2f231..ffb9a22d366449045586d78106ac8b5b920581ab 100644
--- a/Source/core/css/SVGCSSStyleSelector.cpp
+++ b/Source/core/css/SVGCSSStyleSelector.cpp
@@ -98,6 +98,38 @@ static Color colorFromSVGColorCSSValue(SVGColor* svgColor, const Color& fgColor)
return color;
}
+static EPaintOrder paintOrderFlattened(CSSValue* cssPaintOrder)
+{
+ if (cssPaintOrder->isValueList()) {
+ int paintOrder = 0;
+ CSSValueListInspector iter(cssPaintOrder);
+ for (size_t i = 0; i < iter.length(); i++) {
+ CSSPrimitiveValue* value = static_cast<CSSPrimitiveValue*>(iter.item(i));
+
+ EPaintOrderType paintOrderType = PT_NONE;
+ switch (value->getIdent()) {
+ case CSSValueFill:
+ paintOrderType = PT_FILL;
+ break;
+ case CSSValueStroke:
+ paintOrderType = PT_STROKE;
+ break;
+ case CSSValueMarkers:
+ paintOrderType = PT_MARKERS;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+
+ paintOrder |= (paintOrderType << kPaintOrderBitwidth*i);
+ }
+ return (EPaintOrder)paintOrder;
+ }
+
+ return PO_NORMAL;
+}
+
void StyleResolver::applySVGProperty(CSSPropertyID id, CSSValue* value)
{
ASSERT(value);
@@ -600,6 +632,13 @@ void StyleResolver::applySVGProperty(CSSPropertyID id, CSSValue* value)
svgstyle->setMaskType(*primitiveValue);
break;
}
+ case CSSPropertyPaintOrder: {
+ HANDLE_INHERIT_AND_INITIAL(paintOrder, PaintOrder)
+
+ svgstyle->setPaintOrder(paintOrderFlattened(value));
+
+ break;
+ }
default:
// If you crash here, it's because you added a css property and are not handling it
// in either this switch statement or the one in StyleResolver::applyProperty

Powered by Google App Engine
This is Rietveld 408576698