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

Side by Side Diff: Source/core/css/SVGCSSComputedStyleDeclaration.cpp

Issue 14907011: Support 'paint-order' from SVG2. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: codereview fixes Created 7 years, 6 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) 2007 Eric Seidel <eric@webkit.org> 2 Copyright (C) 2007 Eric Seidel <eric@webkit.org>
3 Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 3 Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 52 return CSSPrimitiveValue::createIdentifier(CSSValueNone);
53 53
54 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 54 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
55 const Vector<SVGLength>::const_iterator end = dashes.end(); 55 const Vector<SVGLength>::const_iterator end = dashes.end();
56 for (Vector<SVGLength>::const_iterator it = dashes.begin(); it != end; ++it) 56 for (Vector<SVGLength>::const_iterator it = dashes.begin(); it != end; ++it)
57 list->append(SVGLength::toCSSPrimitiveValue(*it)); 57 list->append(SVGLength::toCSSPrimitiveValue(*it));
58 58
59 return list.release(); 59 return list.release();
60 } 60 }
61 61
62 static PassRefPtr<CSSValue> paintOrderToCSSValueList(EPaintOrder paintorder)
63 {
64 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
65 do {
66 EPaintOrderType paintOrderType = (EPaintOrderType)(paintorder & (1 << kP aintOrderBitwidth - 1));
67 switch (paintOrderType) {
pdr. 2013/06/25 15:30:45 Nit: indent inside the switch statement.
68 case PT_FILL:
69 case PT_STROKE:
70 case PT_MARKERS:
71 list->append(CSSPrimitiveValue::create(paintOrderType));
72 break;
73 case PT_NONE:
74 default:
75 ASSERT_NOT_REACHED();
76 break;
77 }
78 }
pdr. 2013/06/25 15:30:45 Nit: Our style is to leave the while loop on the s
79 while (paintorder <<= kPaintOrderBitwidth);
80
81 return list.release();
82 }
83
62 PassRefPtr<SVGPaint> CSSComputedStyleDeclaration::adjustSVGPaintForCurrentColor( PassRefPtr<SVGPaint> newPaint, RenderStyle* style) const 84 PassRefPtr<SVGPaint> CSSComputedStyleDeclaration::adjustSVGPaintForCurrentColor( PassRefPtr<SVGPaint> newPaint, RenderStyle* style) const
63 { 85 {
64 RefPtr<SVGPaint> paint = newPaint; 86 RefPtr<SVGPaint> paint = newPaint;
65 if (paint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR || paint->pai ntType() == SVGPaint::SVG_PAINTTYPE_URI_CURRENTCOLOR) 87 if (paint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR || paint->pai ntType() == SVGPaint::SVG_PAINTTYPE_URI_CURRENTCOLOR)
66 paint->setColor(style->color()); 88 paint->setColor(style->color());
67 return paint.release(); 89 return paint.release();
68 } 90 }
69 91
70 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSValue(CSSProp ertyID propertyID, EUpdateLayout updateLayout) const 92 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSValue(CSSProp ertyID propertyID, EUpdateLayout updateLayout) const
71 { 93 {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 if (RefPtr<CSSPrimitiveValue> value = glyphOrientationToCSSPrimitive Value(svgStyle->glyphOrientationVertical())) 206 if (RefPtr<CSSPrimitiveValue> value = glyphOrientationToCSSPrimitive Value(svgStyle->glyphOrientationVertical()))
185 return value.release(); 207 return value.release();
186 208
187 if (svgStyle->glyphOrientationVertical() == GO_AUTO) 209 if (svgStyle->glyphOrientationVertical() == GO_AUTO)
188 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); 210 return CSSPrimitiveValue::createIdentifier(CSSValueAuto);
189 211
190 return 0; 212 return 0;
191 } 213 }
192 case CSSPropertyWebkitSvgShadow: 214 case CSSPropertyWebkitSvgShadow:
193 return valueForShadow(svgStyle->shadow(), propertyID, style); 215 return valueForShadow(svgStyle->shadow(), propertyID, style);
216 case CSSPropertyPaintOrder:
217 return paintOrderToCSSValueList(svgStyle->paintOrder());
194 case CSSPropertyVectorEffect: 218 case CSSPropertyVectorEffect:
195 return CSSPrimitiveValue::create(svgStyle->vectorEffect()); 219 return CSSPrimitiveValue::create(svgStyle->vectorEffect());
196 case CSSPropertyMaskType: 220 case CSSPropertyMaskType:
197 return CSSPrimitiveValue::create(svgStyle->maskType()); 221 return CSSPrimitiveValue::create(svgStyle->maskType());
198 case CSSPropertyMarker: 222 case CSSPropertyMarker:
199 case CSSPropertyEnableBackground: 223 case CSSPropertyEnableBackground:
200 case CSSPropertyColorProfile: 224 case CSSPropertyColorProfile:
201 // the above properties are not yet implemented in the engine 225 // the above properties are not yet implemented in the engine
202 break; 226 break;
203 default: 227 default:
204 // If you crash here, it's because you added a css property and are not handling it 228 // If you crash here, it's because you added a css property and are not handling it
205 // in either this switch statement or the one in CSSComputedStyleDelcara tion::getPropertyCSSValue 229 // in either this switch statement or the one in CSSComputedStyleDelcara tion::getPropertyCSSValue
206 ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", propertyID); 230 ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", propertyID);
207 } 231 }
208 LOG_ERROR("unimplemented propertyID: %d", propertyID); 232 LOG_ERROR("unimplemented propertyID: %d", propertyID);
209 return 0; 233 return 0;
210 } 234 }
211 235
212 } 236 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698