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

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: Fix review issues and add paint-order for text too Created 7 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 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 << k PaintOrderBitwidth) - 1));
67 switch (paintOrderType) {
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 } while (paintorder >>= kPaintOrderBitwidth);
79
80 return list.release();
81 }
82
62 PassRefPtr<SVGPaint> CSSComputedStyleDeclaration::adjustSVGPaintForCurrentColor( PassRefPtr<SVGPaint> newPaint, RenderStyle* style) const 83 PassRefPtr<SVGPaint> CSSComputedStyleDeclaration::adjustSVGPaintForCurrentColor( PassRefPtr<SVGPaint> newPaint, RenderStyle* style) const
63 { 84 {
64 RefPtr<SVGPaint> paint = newPaint; 85 RefPtr<SVGPaint> paint = newPaint;
65 if (paint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR || paint->pai ntType() == SVGPaint::SVG_PAINTTYPE_URI_CURRENTCOLOR) 86 if (paint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR || paint->pai ntType() == SVGPaint::SVG_PAINTTYPE_URI_CURRENTCOLOR)
66 paint->setColor(style->color()); 87 paint->setColor(style->color());
67 return paint.release(); 88 return paint.release();
68 } 89 }
69 90
70 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSValue(CSSProp ertyID propertyID, EUpdateLayout updateLayout) const 91 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSValue(CSSProp ertyID propertyID, EUpdateLayout updateLayout) const
71 { 92 {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 if (RefPtr<CSSPrimitiveValue> value = glyphOrientationToCSSPrimitive Value(svgStyle->glyphOrientationVertical())) 205 if (RefPtr<CSSPrimitiveValue> value = glyphOrientationToCSSPrimitive Value(svgStyle->glyphOrientationVertical()))
185 return value.release(); 206 return value.release();
186 207
187 if (svgStyle->glyphOrientationVertical() == GO_AUTO) 208 if (svgStyle->glyphOrientationVertical() == GO_AUTO)
188 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); 209 return CSSPrimitiveValue::createIdentifier(CSSValueAuto);
189 210
190 return 0; 211 return 0;
191 } 212 }
192 case CSSPropertyWebkitSvgShadow: 213 case CSSPropertyWebkitSvgShadow:
193 return valueForShadow(svgStyle->shadow(), propertyID, style); 214 return valueForShadow(svgStyle->shadow(), propertyID, style);
215 case CSSPropertyPaintOrder:
216 return paintOrderToCSSValueList(svgStyle->paintOrder());
194 case CSSPropertyVectorEffect: 217 case CSSPropertyVectorEffect:
195 return CSSPrimitiveValue::create(svgStyle->vectorEffect()); 218 return CSSPrimitiveValue::create(svgStyle->vectorEffect());
196 case CSSPropertyMaskType: 219 case CSSPropertyMaskType:
197 return CSSPrimitiveValue::create(svgStyle->maskType()); 220 return CSSPrimitiveValue::create(svgStyle->maskType());
198 case CSSPropertyMarker: 221 case CSSPropertyMarker:
199 case CSSPropertyEnableBackground: 222 case CSSPropertyEnableBackground:
200 case CSSPropertyColorProfile: 223 case CSSPropertyColorProfile:
201 // the above properties are not yet implemented in the engine 224 // the above properties are not yet implemented in the engine
202 break; 225 break;
203 default: 226 default:
204 // If you crash here, it's because you added a css property and are not handling it 227 // 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 228 // in either this switch statement or the one in CSSComputedStyleDelcara tion::getPropertyCSSValue
206 ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", propertyID); 229 ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", propertyID);
207 } 230 }
208 LOG_ERROR("unimplemented propertyID: %d", propertyID); 231 LOG_ERROR("unimplemented propertyID: %d", propertyID);
209 return 0; 232 return 0;
210 } 233 }
211 234
212 } 235 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698