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

Side by Side 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, 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved.
7 * Copyright (C) 2015 Google Inc. All rights reserved. 7 * Copyright (C) 2015 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public 10 * modify it under the terms of the GNU Lesser General Public
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 1180
1181 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ; 1181 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ;
1182 for (const Length& dashLength : dashes.vector()) 1182 for (const Length& dashLength : dashes.vector())
1183 list->append(zoomAdjustedPixelValueForLength(dashLength, style)); 1183 list->append(zoomAdjustedPixelValueForLength(dashLength, style));
1184 1184
1185 return list.release(); 1185 return list.release();
1186 } 1186 }
1187 1187
1188 static PassRefPtrWillBeRawPtr<CSSValue> paintOrderToCSSValueList(EPaintOrder pai ntorder) 1188 static PassRefPtrWillBeRawPtr<CSSValue> paintOrderToCSSValueList(EPaintOrder pai ntorder)
1189 { 1189 {
1190 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 1190 RefPtrWillBeRawPtr<CSSValueList> paintOrderList = CSSValueList::createSpaceS eparated();
1191 do {
1192 EPaintOrderType paintOrderType = (EPaintOrderType)(paintorder & ((1 << k PaintOrderBitwidth) - 1));
1193 switch (paintOrderType) {
1194 case PT_FILL:
1195 case PT_STROKE:
1196 case PT_MARKERS:
1197 list->append(CSSPrimitiveValue::create(paintOrderType));
1198 break;
1199 case PT_NONE:
1200 default:
1201 ASSERT_NOT_REACHED();
1202 break;
1203 }
1204 } while (paintorder >>= kPaintOrderBitwidth);
1205 1191
1206 return list.release(); 1192 switch (paintorder) {
1193 case PaintOrderNormal:
1194 return CSSPrimitiveValue::createIdentifier(CSSValueNormal);
1195 case PaintOrderFill:
1196 paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueFill) );
1197 break;
1198 case PaintOrderFillMarkers:
1199 paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueFill) );
1200 paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarke rs));
1201 break;
1202 case PaintOrderStroke:
1203 paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueStrok e));
1204 break;
1205 case PaintOrderStrokeMarkers:
1206 paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueStrok e));
1207 paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarke rs));
1208 break;
1209 case PaintOrderMarkers:
1210 paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarke rs));
1211 break;
1212 case PaintOrderMarkersStroke:
1213 paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarke rs));
1214 paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueStrok e));
1215 break;
1216 }
1217
1218 return paintOrderList.release();
1207 } 1219 }
1208 1220
1209 static PassRefPtrWillBeRawPtr<CSSValue> adjustSVGPaintForCurrentColor(SVGPaintTy pe paintType, const String& url, const Color& color, const Color& currentColor) 1221 static PassRefPtrWillBeRawPtr<CSSValue> adjustSVGPaintForCurrentColor(SVGPaintTy pe paintType, const String& url, const Color& color, const Color& currentColor)
1210 { 1222 {
1211 if (paintType >= SVG_PAINTTYPE_URI_NONE) { 1223 if (paintType >= SVG_PAINTTYPE_URI_NONE) {
1212 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSepar ated(); 1224 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSepar ated();
1213 values->append(CSSPrimitiveValue::create(url, CSSPrimitiveValue::CSS_URI )); 1225 values->append(CSSPrimitiveValue::create(url, CSSPrimitiveValue::CSS_URI ));
1214 if (paintType == SVG_PAINTTYPE_URI_NONE) 1226 if (paintType == SVG_PAINTTYPE_URI_NONE)
1215 values->append(CSSPrimitiveValue::create(CSSValueNone)); 1227 values->append(CSSPrimitiveValue::create(CSSValueNone));
1216 else if (paintType == SVG_PAINTTYPE_URI_CURRENTCOLOR) 1228 else if (paintType == SVG_PAINTTYPE_URI_CURRENTCOLOR)
(...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after
2705 case CSSPropertyAll: 2717 case CSSPropertyAll:
2706 return nullptr; 2718 return nullptr;
2707 default: 2719 default:
2708 break; 2720 break;
2709 } 2721 }
2710 ASSERT_NOT_REACHED(); 2722 ASSERT_NOT_REACHED();
2711 return nullptr; 2723 return nullptr;
2712 } 2724 }
2713 2725
2714 } 2726 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698