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

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

Issue 1252933003: Shrink SVG paint-order to take less bits (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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/ComputedStyleCSSValueMapping.cpp
diff --git a/Source/core/css/ComputedStyleCSSValueMapping.cpp b/Source/core/css/ComputedStyleCSSValueMapping.cpp
index 06fa017c5f3c2e22a1b6f5a94e67795d9a40c9b7..29d38601b7329a898c190cc37745c4a28d0659c6 100644
--- a/Source/core/css/ComputedStyleCSSValueMapping.cpp
+++ b/Source/core/css/ComputedStyleCSSValueMapping.cpp
@@ -1187,23 +1187,35 @@ static PassRefPtrWillBeRawPtr<CSSValue> strokeDashArrayToCSSValueList(const SVGD
static PassRefPtrWillBeRawPtr<CSSValue> paintOrderToCSSValueList(EPaintOrder paintorder)
{
- RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
- do {
- EPaintOrderType paintOrderType = (EPaintOrderType)(paintorder & ((1 << kPaintOrderBitwidth) - 1));
- switch (paintOrderType) {
- case PT_FILL:
- case PT_STROKE:
- case PT_MARKERS:
- list->append(CSSPrimitiveValue::create(paintOrderType));
- break;
- case PT_NONE:
- default:
- ASSERT_NOT_REACHED();
- break;
- }
- } while (paintorder >>= kPaintOrderBitwidth);
+ RefPtrWillBeRawPtr<CSSValueList> paintOrderList = CSSValueList::createSpaceSeparated();
- return list.release();
+ switch (paintorder) {
+ case PaintOrderNormal:
+ return CSSPrimitiveValue::createIdentifier(CSSValueNormal);
+ case PaintOrderFill:
+ paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueFill));
+ break;
+ case PaintOrderFillMarkers:
+ paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueFill));
+ paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers));
+ break;
+ case PaintOrderStroke:
+ paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke));
+ break;
+ case PaintOrderStrokeMarkers:
+ paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke));
+ paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers));
+ break;
+ case PaintOrderMarkers:
+ paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers));
+ break;
+ case PaintOrderMarkersStroke:
+ paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers));
+ paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke));
+ break;
+ }
+
+ return paintOrderList.release();
}
static PassRefPtrWillBeRawPtr<CSSValue> adjustSVGPaintForCurrentColor(SVGPaintType paintType, const String& url, const Color& color, const Color& currentColor)

Powered by Google App Engine
This is Rietveld 408576698