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

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: Align with review comments 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
« no previous file with comments | « no previous file | Source/core/css/parser/CSSPropertyParser.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1178 if (dashes.isEmpty()) 1178 if (dashes.isEmpty())
1179 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 1179 return CSSPrimitiveValue::createIdentifier(CSSValueNone);
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(const SVGComput edStyle& svgStyle)
1189 { 1189 {
1190 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 1190 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
1191 do { 1191 for (int i = 0; i < 3; i++) {
1192 EPaintOrderType paintOrderType = (EPaintOrderType)(paintorder & ((1 << k PaintOrderBitwidth) - 1)); 1192 EPaintOrderType paintOrderType = svgStyle.paintOrderType(i);
1193 switch (paintOrderType) { 1193 switch (paintOrderType) {
1194 case PT_FILL: 1194 case PT_FILL:
1195 case PT_STROKE: 1195 case PT_STROKE:
1196 case PT_MARKERS: 1196 case PT_MARKERS:
1197 list->append(CSSPrimitiveValue::create(paintOrderType)); 1197 list->append(CSSPrimitiveValue::create(paintOrderType));
1198 break; 1198 break;
1199 case PT_NONE: 1199 case PT_NONE:
1200 default: 1200 default:
1201 ASSERT_NOT_REACHED(); 1201 ASSERT_NOT_REACHED();
1202 break; 1202 break;
1203 } 1203 }
1204 } while (paintorder >>= kPaintOrderBitwidth); 1204 }
1205 1205
1206 return list.release(); 1206 return list.release();
1207 } 1207 }
1208 1208
1209 static PassRefPtrWillBeRawPtr<CSSValue> adjustSVGPaintForCurrentColor(SVGPaintTy pe paintType, const String& url, const Color& color, const Color& currentColor) 1209 static PassRefPtrWillBeRawPtr<CSSValue> adjustSVGPaintForCurrentColor(SVGPaintTy pe paintType, const String& url, const Color& color, const Color& currentColor)
1210 { 1210 {
1211 if (paintType >= SVG_PAINTTYPE_URI_NONE) { 1211 if (paintType >= SVG_PAINTTYPE_URI_NONE) {
1212 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSepar ated(); 1212 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSepar ated();
1213 values->append(CSSPrimitiveValue::create(url, CSSPrimitiveValue::CSS_URI )); 1213 values->append(CSSPrimitiveValue::create(url, CSSPrimitiveValue::CSS_URI ));
1214 if (paintType == SVG_PAINTTYPE_URI_NONE) 1214 if (paintType == SVG_PAINTTYPE_URI_NONE)
(...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after
2612 case CSSPropertyGlyphOrientationHorizontal: 2612 case CSSPropertyGlyphOrientationHorizontal:
2613 return glyphOrientationToCSSPrimitiveValue(svgStyle.glyphOrientationHori zontal()); 2613 return glyphOrientationToCSSPrimitiveValue(svgStyle.glyphOrientationHori zontal());
2614 case CSSPropertyGlyphOrientationVertical: { 2614 case CSSPropertyGlyphOrientationVertical: {
2615 if (RefPtrWillBeRawPtr<CSSPrimitiveValue> value = glyphOrientationToCSSP rimitiveValue(svgStyle.glyphOrientationVertical())) 2615 if (RefPtrWillBeRawPtr<CSSPrimitiveValue> value = glyphOrientationToCSSP rimitiveValue(svgStyle.glyphOrientationVertical()))
2616 return value.release(); 2616 return value.release();
2617 if (svgStyle.glyphOrientationVertical() == GO_AUTO) 2617 if (svgStyle.glyphOrientationVertical() == GO_AUTO)
2618 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); 2618 return CSSPrimitiveValue::createIdentifier(CSSValueAuto);
2619 return nullptr; 2619 return nullptr;
2620 } 2620 }
2621 case CSSPropertyPaintOrder: 2621 case CSSPropertyPaintOrder:
2622 return paintOrderToCSSValueList(svgStyle.paintOrder()); 2622 return paintOrderToCSSValueList(svgStyle);
2623 case CSSPropertyVectorEffect: 2623 case CSSPropertyVectorEffect:
2624 return CSSPrimitiveValue::create(svgStyle.vectorEffect()); 2624 return CSSPrimitiveValue::create(svgStyle.vectorEffect());
2625 case CSSPropertyMaskType: 2625 case CSSPropertyMaskType:
2626 return CSSPrimitiveValue::create(svgStyle.maskType()); 2626 return CSSPrimitiveValue::create(svgStyle.maskType());
2627 case CSSPropertyMarker: 2627 case CSSPropertyMarker:
2628 case CSSPropertyEnableBackground: 2628 case CSSPropertyEnableBackground:
2629 // the above properties are not yet implemented in the engine 2629 // the above properties are not yet implemented in the engine
2630 return nullptr; 2630 return nullptr;
2631 case CSSPropertyCx: 2631 case CSSPropertyCx:
2632 return zoomAdjustedPixelValueForLength(svgStyle.cx(), style); 2632 return zoomAdjustedPixelValueForLength(svgStyle.cx(), style);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
2705 case CSSPropertyAll: 2705 case CSSPropertyAll:
2706 return nullptr; 2706 return nullptr;
2707 default: 2707 default:
2708 break; 2708 break;
2709 } 2709 }
2710 ASSERT_NOT_REACHED(); 2710 ASSERT_NOT_REACHED();
2711 return nullptr; 2711 return nullptr;
2712 } 2712 }
2713 2713
2714 } 2714 }
OLDNEW
« no previous file with comments | « no previous file | Source/core/css/parser/CSSPropertyParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698