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

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: small nits 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 case PaintOrderFillStrokeMarkers:
fs 2015/07/30 14:39:36 Eep! This looks like large (code) footprint =( - c
Shanmuga Pandi 2015/07/31 08:44:50 Done.
1195 paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueFill) );
1196 paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueStrok e));
1197 paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarke rs));
1198 break;
1199 case PaintOrderFillMarkersStroke:
1200 paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueFill) );
1201 paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarke rs));
1202 paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueStrok e));
1203 break;
1204 case PaintOrderStrokeFillMarkers:
1205 paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueStrok e));
1206 paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueFill) );
1207 paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarke rs));
1208 break;
1209 case PaintOrderStrokeMarkersFill:
1210 paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueStrok e));
1211 paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarke rs));
1212 paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueFill) );
1213 break;
1214 case PaintOrderMarkersFillStroke:
1215 paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarke rs));
1216 paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueFill) );
1217 paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueStrok e));
1218 break;
1219 case PaintOrderMarkersStrokeFill:
1220 paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarke rs));
1221 paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueStrok e));
1222 paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueFill) );
1223 break;
1224 }
1225
1226 return paintOrderList.release();
1207 } 1227 }
1208 1228
1209 static PassRefPtrWillBeRawPtr<CSSValue> adjustSVGPaintForCurrentColor(SVGPaintTy pe paintType, const String& url, const Color& color, const Color& currentColor) 1229 static PassRefPtrWillBeRawPtr<CSSValue> adjustSVGPaintForCurrentColor(SVGPaintTy pe paintType, const String& url, const Color& color, const Color& currentColor)
1210 { 1230 {
1211 if (paintType >= SVG_PAINTTYPE_URI_NONE) { 1231 if (paintType >= SVG_PAINTTYPE_URI_NONE) {
1212 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSepar ated(); 1232 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSepar ated();
1213 values->append(CSSPrimitiveValue::create(url, CSSPrimitiveValue::CSS_URI )); 1233 values->append(CSSPrimitiveValue::create(url, CSSPrimitiveValue::CSS_URI ));
1214 if (paintType == SVG_PAINTTYPE_URI_NONE) 1234 if (paintType == SVG_PAINTTYPE_URI_NONE)
1215 values->append(CSSPrimitiveValue::create(CSSValueNone)); 1235 values->append(CSSPrimitiveValue::create(CSSValueNone));
1216 else if (paintType == SVG_PAINTTYPE_URI_CURRENTCOLOR) 1236 else if (paintType == SVG_PAINTTYPE_URI_CURRENTCOLOR)
(...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after
2705 case CSSPropertyAll: 2725 case CSSPropertyAll:
2706 return nullptr; 2726 return nullptr;
2707 default: 2727 default:
2708 break; 2728 break;
2709 } 2729 }
2710 ASSERT_NOT_REACHED(); 2730 ASSERT_NOT_REACHED();
2711 return nullptr; 2731 return nullptr;
2712 } 2732 }
2713 2733
2714 } 2734 }
OLDNEW
« no previous file with comments | « no previous file | Source/core/css/parser/CSSPropertyParser.cpp » ('j') | Source/core/css/parser/CSSPropertyParser.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698