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

Side by Side Diff: Source/core/rendering/style/SVGRenderStyle.h

Issue 361543002: Remove SVGPaint (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address issues Created 6 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) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 2004, 2005 Rob Buis <buis@kde.org> 3 2004, 2005 Rob Buis <buis@kde.org>
4 Copyright (C) 2005, 2006 Apple Computer, Inc. 4 Copyright (C) 2005, 2006 Apple Computer, Inc.
5 Copyright (C) Research In Motion Limited 2010. All rights reserved. 5 Copyright (C) Research In Motion Limited 2010. All rights reserved.
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
(...skipping 11 matching lines...) Expand all
22 22
23 #ifndef SVGRenderStyle_h 23 #ifndef SVGRenderStyle_h
24 #define SVGRenderStyle_h 24 #define SVGRenderStyle_h
25 25
26 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 26 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
27 #include "core/css/CSSValueList.h" 27 #include "core/css/CSSValueList.h"
28 #include "core/rendering/style/DataRef.h" 28 #include "core/rendering/style/DataRef.h"
29 #include "core/rendering/style/RenderStyleConstants.h" 29 #include "core/rendering/style/RenderStyleConstants.h"
30 #include "core/rendering/style/SVGRenderStyleDefs.h" 30 #include "core/rendering/style/SVGRenderStyleDefs.h"
31 #include "core/rendering/style/StyleDifference.h" 31 #include "core/rendering/style/StyleDifference.h"
32 #include "core/svg/SVGPaint.h"
33 #include "platform/graphics/GraphicsTypes.h" 32 #include "platform/graphics/GraphicsTypes.h"
34 #include "platform/graphics/Path.h" 33 #include "platform/graphics/Path.h"
35 34
36 namespace WebCore { 35 namespace WebCore {
37 36
38 class SVGRenderStyle : public RefCounted<SVGRenderStyle> { 37 class SVGRenderStyle : public RefCounted<SVGRenderStyle> {
39 public: 38 public:
40 static PassRefPtr<SVGRenderStyle> create() { return adoptRef(new SVGRenderSt yle); } 39 static PassRefPtr<SVGRenderStyle> create() { return adoptRef(new SVGRenderSt yle); }
41 PassRefPtr<SVGRenderStyle> copy() const { return adoptRef(new SVGRenderStyle (*this));} 40 PassRefPtr<SVGRenderStyle> copy() const { return adoptRef(new SVGRenderStyle (*this));}
42 ~SVGRenderStyle(); 41 ~SVGRenderStyle();
(...skipping 19 matching lines...) Expand all
62 static EColorInterpolation initialColorInterpolationFilters() { return CI_LI NEARRGB; } 61 static EColorInterpolation initialColorInterpolationFilters() { return CI_LI NEARRGB; }
63 static EColorRendering initialColorRendering() { return CR_AUTO; } 62 static EColorRendering initialColorRendering() { return CR_AUTO; }
64 static WindRule initialFillRule() { return RULE_NONZERO; } 63 static WindRule initialFillRule() { return RULE_NONZERO; }
65 static LineJoin initialJoinStyle() { return MiterJoin; } 64 static LineJoin initialJoinStyle() { return MiterJoin; }
66 static EShapeRendering initialShapeRendering() { return SR_AUTO; } 65 static EShapeRendering initialShapeRendering() { return SR_AUTO; }
67 static ETextAnchor initialTextAnchor() { return TA_START; } 66 static ETextAnchor initialTextAnchor() { return TA_START; }
68 static SVGWritingMode initialWritingMode() { return WM_LRTB; } 67 static SVGWritingMode initialWritingMode() { return WM_LRTB; }
69 static EGlyphOrientation initialGlyphOrientationHorizontal() { return GO_0DE G; } 68 static EGlyphOrientation initialGlyphOrientationHorizontal() { return GO_0DE G; }
70 static EGlyphOrientation initialGlyphOrientationVertical() { return GO_AUTO; } 69 static EGlyphOrientation initialGlyphOrientationVertical() { return GO_AUTO; }
71 static float initialFillOpacity() { return 1; } 70 static float initialFillOpacity() { return 1; }
72 static SVGPaint::SVGPaintType initialFillPaintType() { return SVGPaint::SVG_ PAINTTYPE_RGBCOLOR; } 71 static SVGPaintType initialFillPaintType() { return SVG_PAINTTYPE_RGBCOLOR; }
73 static Color initialFillPaintColor() { return Color::black; } 72 static Color initialFillPaintColor() { return Color::black; }
74 static String initialFillPaintUri() { return String(); } 73 static String initialFillPaintUri() { return String(); }
75 static float initialStrokeOpacity() { return 1; } 74 static float initialStrokeOpacity() { return 1; }
76 static SVGPaint::SVGPaintType initialStrokePaintType() { return SVGPaint::SV G_PAINTTYPE_NONE; } 75 static SVGPaintType initialStrokePaintType() { return SVG_PAINTTYPE_NONE; }
77 static Color initialStrokePaintColor() { return Color(); } 76 static Color initialStrokePaintColor() { return Color(); }
78 static String initialStrokePaintUri() { return String(); } 77 static String initialStrokePaintUri() { return String(); }
79 static PassRefPtr<SVGLengthList> initialStrokeDashArray() { return SVGLength List::create(); } 78 static PassRefPtr<SVGLengthList> initialStrokeDashArray() { return SVGLength List::create(); }
80 static float initialStrokeMiterLimit() { return 4; } 79 static float initialStrokeMiterLimit() { return 4; }
81 static float initialStopOpacity() { return 1; } 80 static float initialStopOpacity() { return 1; }
82 static Color initialStopColor() { return Color(0, 0, 0); } 81 static Color initialStopColor() { return Color(0, 0, 0); }
83 static float initialFloodOpacity() { return 1; } 82 static float initialFloodOpacity() { return 1; }
84 static Color initialFloodColor() { return Color(0, 0, 0); } 83 static Color initialFloodColor() { return Color(0, 0, 0); }
85 static Color initialLightingColor() { return Color(255, 255, 255); } 84 static Color initialLightingColor() { return Color(255, 255, 255); }
86 static const AtomicString& initialClipperResource() { return nullAtom; } 85 static const AtomicString& initialClipperResource() { return nullAtom; }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 void setGlyphOrientationVertical(EGlyphOrientation val) { svg_inherited_flag s._glyphOrientationVertical = val; } 132 void setGlyphOrientationVertical(EGlyphOrientation val) { svg_inherited_flag s._glyphOrientationVertical = val; }
134 void setMaskType(EMaskType val) { svg_noninherited_flags.f.maskType = val; } 133 void setMaskType(EMaskType val) { svg_noninherited_flags.f.maskType = val; }
135 void setPaintOrder(EPaintOrder val) { svg_inherited_flags._paintOrder = (int )val; } 134 void setPaintOrder(EPaintOrder val) { svg_inherited_flags._paintOrder = (int )val; }
136 135
137 void setFillOpacity(float obj) 136 void setFillOpacity(float obj)
138 { 137 {
139 if (!(fill->opacity == obj)) 138 if (!(fill->opacity == obj))
140 fill.access()->opacity = obj; 139 fill.access()->opacity = obj;
141 } 140 }
142 141
143 void setFillPaint(SVGPaint::SVGPaintType type, const Color& color, const Str ing& uri, bool applyToRegularStyle = true, bool applyToVisitedLinkStyle = false) 142 void setFillPaint(SVGPaintType type, const Color& color, const String& uri, bool applyToRegularStyle = true, bool applyToVisitedLinkStyle = false)
144 { 143 {
145 if (applyToRegularStyle) { 144 if (applyToRegularStyle) {
146 if (!(fill->paintType == type)) 145 if (!(fill->paintType == type))
147 fill.access()->paintType = type; 146 fill.access()->paintType = type;
148 if (!(fill->paintColor == color)) 147 if (!(fill->paintColor == color))
149 fill.access()->paintColor = color; 148 fill.access()->paintColor = color;
150 if (!(fill->paintUri == uri)) 149 if (!(fill->paintUri == uri))
151 fill.access()->paintUri = uri; 150 fill.access()->paintUri = uri;
152 } 151 }
153 if (applyToVisitedLinkStyle) { 152 if (applyToVisitedLinkStyle) {
154 if (!(fill->visitedLinkPaintType == type)) 153 if (!(fill->visitedLinkPaintType == type))
155 fill.access()->visitedLinkPaintType = type; 154 fill.access()->visitedLinkPaintType = type;
156 if (!(fill->visitedLinkPaintColor == color)) 155 if (!(fill->visitedLinkPaintColor == color))
157 fill.access()->visitedLinkPaintColor = color; 156 fill.access()->visitedLinkPaintColor = color;
158 if (!(fill->visitedLinkPaintUri == uri)) 157 if (!(fill->visitedLinkPaintUri == uri))
159 fill.access()->visitedLinkPaintUri = uri; 158 fill.access()->visitedLinkPaintUri = uri;
160 } 159 }
161 } 160 }
162 161
163 void setStrokeOpacity(float obj) 162 void setStrokeOpacity(float obj)
164 { 163 {
165 if (!(stroke->opacity == obj)) 164 if (!(stroke->opacity == obj))
166 stroke.access()->opacity = obj; 165 stroke.access()->opacity = obj;
167 } 166 }
168 167
169 void setStrokePaint(SVGPaint::SVGPaintType type, const Color& color, const S tring& uri, bool applyToRegularStyle = true, bool applyToVisitedLinkStyle = fals e) 168 void setStrokePaint(SVGPaintType type, const Color& color, const String& uri , bool applyToRegularStyle = true, bool applyToVisitedLinkStyle = false)
170 { 169 {
171 if (applyToRegularStyle) { 170 if (applyToRegularStyle) {
172 if (!(stroke->paintType == type)) 171 if (!(stroke->paintType == type))
173 stroke.access()->paintType = type; 172 stroke.access()->paintType = type;
174 if (!(stroke->paintColor == color)) 173 if (!(stroke->paintColor == color))
175 stroke.access()->paintColor = color; 174 stroke.access()->paintColor = color;
176 if (!(stroke->paintUri == uri)) 175 if (!(stroke->paintUri == uri))
177 stroke.access()->paintUri = uri; 176 stroke.access()->paintUri = uri;
178 } 177 }
179 if (applyToVisitedLinkStyle) { 178 if (applyToVisitedLinkStyle) {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 EColorInterpolation colorInterpolationFilters() const { return (EColorInterp olation) svg_inherited_flags._colorInterpolationFilters; } 295 EColorInterpolation colorInterpolationFilters() const { return (EColorInterp olation) svg_inherited_flags._colorInterpolationFilters; }
297 EColorRendering colorRendering() const { return (EColorRendering) svg_inheri ted_flags._colorRendering; } 296 EColorRendering colorRendering() const { return (EColorRendering) svg_inheri ted_flags._colorRendering; }
298 WindRule fillRule() const { return (WindRule) svg_inherited_flags._fillRule; } 297 WindRule fillRule() const { return (WindRule) svg_inherited_flags._fillRule; }
299 LineJoin joinStyle() const { return (LineJoin) svg_inherited_flags._joinStyl e; } 298 LineJoin joinStyle() const { return (LineJoin) svg_inherited_flags._joinStyl e; }
300 EShapeRendering shapeRendering() const { return (EShapeRendering) svg_inheri ted_flags._shapeRendering; } 299 EShapeRendering shapeRendering() const { return (EShapeRendering) svg_inheri ted_flags._shapeRendering; }
301 ETextAnchor textAnchor() const { return (ETextAnchor) svg_inherited_flags._t extAnchor; } 300 ETextAnchor textAnchor() const { return (ETextAnchor) svg_inherited_flags._t extAnchor; }
302 SVGWritingMode writingMode() const { return (SVGWritingMode) svg_inherited_f lags._writingMode; } 301 SVGWritingMode writingMode() const { return (SVGWritingMode) svg_inherited_f lags._writingMode; }
303 EGlyphOrientation glyphOrientationHorizontal() const { return (EGlyphOrienta tion) svg_inherited_flags._glyphOrientationHorizontal; } 302 EGlyphOrientation glyphOrientationHorizontal() const { return (EGlyphOrienta tion) svg_inherited_flags._glyphOrientationHorizontal; }
304 EGlyphOrientation glyphOrientationVertical() const { return (EGlyphOrientati on) svg_inherited_flags._glyphOrientationVertical; } 303 EGlyphOrientation glyphOrientationVertical() const { return (EGlyphOrientati on) svg_inherited_flags._glyphOrientationVertical; }
305 float fillOpacity() const { return fill->opacity; } 304 float fillOpacity() const { return fill->opacity; }
306 const SVGPaint::SVGPaintType& fillPaintType() const { return fill->paintType ; } 305 const SVGPaintType& fillPaintType() const { return fill->paintType; }
307 const Color& fillPaintColor() const { return fill->paintColor; } 306 const Color& fillPaintColor() const { return fill->paintColor; }
308 const String& fillPaintUri() const { return fill->paintUri; } 307 const String& fillPaintUri() const { return fill->paintUri; }
309 float strokeOpacity() const { return stroke->opacity; } 308 float strokeOpacity() const { return stroke->opacity; }
310 const SVGPaint::SVGPaintType& strokePaintType() const { return stroke->paint Type; } 309 const SVGPaintType& strokePaintType() const { return stroke->paintType; }
311 const Color& strokePaintColor() const { return stroke->paintColor; } 310 const Color& strokePaintColor() const { return stroke->paintColor; }
312 const String& strokePaintUri() const { return stroke->paintUri; } 311 const String& strokePaintUri() const { return stroke->paintUri; }
313 SVGLengthList* strokeDashArray() const { return stroke->dashArray.get(); } 312 SVGLengthList* strokeDashArray() const { return stroke->dashArray.get(); }
314 float strokeMiterLimit() const { return stroke->miterLimit; } 313 float strokeMiterLimit() const { return stroke->miterLimit; }
315 SVGLength* strokeWidth() const { return stroke->width.get(); } 314 SVGLength* strokeWidth() const { return stroke->width.get(); }
316 SVGLength* strokeDashOffset() const { return stroke->dashOffset.get(); } 315 SVGLength* strokeDashOffset() const { return stroke->dashOffset.get(); }
317 float stopOpacity() const { return stops->opacity; } 316 float stopOpacity() const { return stops->opacity; }
318 const Color& stopColor() const { return stops->color; } 317 const Color& stopColor() const { return stops->color; }
319 float floodOpacity() const { return misc->floodOpacity; } 318 float floodOpacity() const { return misc->floodOpacity; }
320 const Color& floodColor() const { return misc->floodColor; } 319 const Color& floodColor() const { return misc->floodColor; }
321 const Color& lightingColor() const { return misc->lightingColor; } 320 const Color& lightingColor() const { return misc->lightingColor; }
322 SVGLength* baselineShiftValue() const { return misc->baselineShiftValue.get( ); } 321 SVGLength* baselineShiftValue() const { return misc->baselineShiftValue.get( ); }
323 const AtomicString& clipperResource() const { return resources->clipper; } 322 const AtomicString& clipperResource() const { return resources->clipper; }
324 const AtomicString& filterResource() const { return resources->filter; } 323 const AtomicString& filterResource() const { return resources->filter; }
325 const AtomicString& maskerResource() const { return resources->masker; } 324 const AtomicString& maskerResource() const { return resources->masker; }
326 const AtomicString& markerStartResource() const { return inheritedResources- >markerStart; } 325 const AtomicString& markerStartResource() const { return inheritedResources- >markerStart; }
327 const AtomicString& markerMidResource() const { return inheritedResources->m arkerMid; } 326 const AtomicString& markerMidResource() const { return inheritedResources->m arkerMid; }
328 const AtomicString& markerEndResource() const { return inheritedResources->m arkerEnd; } 327 const AtomicString& markerEndResource() const { return inheritedResources->m arkerEnd; }
329 EMaskType maskType() const { return (EMaskType) svg_noninherited_flags.f.mas kType; } 328 EMaskType maskType() const { return (EMaskType) svg_noninherited_flags.f.mas kType; }
330 EPaintOrder paintOrder() const { return (EPaintOrder) svg_inherited_flags._p aintOrder; } 329 EPaintOrder paintOrder() const { return (EPaintOrder) svg_inherited_flags._p aintOrder; }
331 EPaintOrderType paintOrderType(unsigned index) const; 330 EPaintOrderType paintOrderType(unsigned index) const;
332 331
333 const SVGPaint::SVGPaintType& visitedLinkFillPaintType() const { return fill ->visitedLinkPaintType; } 332 const SVGPaintType& visitedLinkFillPaintType() const { return fill->visitedL inkPaintType; }
334 const Color& visitedLinkFillPaintColor() const { return fill->visitedLinkPai ntColor; } 333 const Color& visitedLinkFillPaintColor() const { return fill->visitedLinkPai ntColor; }
335 const String& visitedLinkFillPaintUri() const { return fill->visitedLinkPain tUri; } 334 const String& visitedLinkFillPaintUri() const { return fill->visitedLinkPain tUri; }
336 const SVGPaint::SVGPaintType& visitedLinkStrokePaintType() const { return st roke->visitedLinkPaintType; } 335 const SVGPaintType& visitedLinkStrokePaintType() const { return stroke->visi tedLinkPaintType; }
337 const Color& visitedLinkStrokePaintColor() const { return stroke->visitedLin kPaintColor; } 336 const Color& visitedLinkStrokePaintColor() const { return stroke->visitedLin kPaintColor; }
338 const String& visitedLinkStrokePaintUri() const { return stroke->visitedLink PaintUri; } 337 const String& visitedLinkStrokePaintUri() const { return stroke->visitedLink PaintUri; }
339 338
340 // convenience 339 // convenience
341 bool hasClipper() const { return !clipperResource().isEmpty(); } 340 bool hasClipper() const { return !clipperResource().isEmpty(); }
342 bool hasMasker() const { return !maskerResource().isEmpty(); } 341 bool hasMasker() const { return !maskerResource().isEmpty(); }
343 bool hasFilter() const { return !filterResource().isEmpty(); } 342 bool hasFilter() const { return !filterResource().isEmpty(); }
344 bool hasMarkers() const { return !markerStartResource().isEmpty() || !marker MidResource().isEmpty() || !markerEndResource().isEmpty(); } 343 bool hasMarkers() const { return !markerStartResource().isEmpty() || !marker MidResource().isEmpty() || !markerEndResource().isEmpty(); }
345 bool hasStroke() const { return strokePaintType() != SVGPaint::SVG_PAINTTYPE _NONE; } 344 bool hasStroke() const { return strokePaintType() != SVG_PAINTTYPE_NONE; }
346 bool hasVisibleStroke() const { return hasStroke() && !strokeWidth()->isZero (); } 345 bool hasVisibleStroke() const { return hasStroke() && !strokeWidth()->isZero (); }
347 bool hasFill() const { return fillPaintType() != SVGPaint::SVG_PAINTTYPE_NON E; } 346 bool hasFill() const { return fillPaintType() != SVG_PAINTTYPE_NONE; }
348 bool isVerticalWritingMode() const { return writingMode() == WM_TBRL || writ ingMode() == WM_TB; } 347 bool isVerticalWritingMode() const { return writingMode() == WM_TBRL || writ ingMode() == WM_TB; }
349 348
350 protected: 349 protected:
351 // inherit 350 // inherit
352 struct InheritedFlags { 351 struct InheritedFlags {
353 bool operator==(const InheritedFlags& other) const 352 bool operator==(const InheritedFlags& other) const
354 { 353 {
355 return (_colorRendering == other._colorRendering) 354 return (_colorRendering == other._colorRendering)
356 && (_shapeRendering == other._shapeRendering) 355 && (_shapeRendering == other._shapeRendering)
357 && (_clipRule == other._clipRule) 356 && (_clipRule == other._clipRule)
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 svg_noninherited_flags.f._baselineShift = initialBaselineShift(); 448 svg_noninherited_flags.f._baselineShift = initialBaselineShift();
450 svg_noninherited_flags.f._vectorEffect = initialVectorEffect(); 449 svg_noninherited_flags.f._vectorEffect = initialVectorEffect();
451 svg_noninherited_flags.f.bufferedRendering = initialBufferedRendering(); 450 svg_noninherited_flags.f.bufferedRendering = initialBufferedRendering();
452 svg_noninherited_flags.f.maskType = initialMaskType(); 451 svg_noninherited_flags.f.maskType = initialMaskType();
453 } 452 }
454 }; 453 };
455 454
456 } // namespace WebCore 455 } // namespace WebCore
457 456
458 #endif // SVGRenderStyle_h 457 #endif // SVGRenderStyle_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698