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

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

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) 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 static Color initialFloodColor() { return Color(0, 0, 0); } 87 static Color initialFloodColor() { return Color(0, 0, 0); }
88 static Color initialLightingColor() { return Color(255, 255, 255); } 88 static Color initialLightingColor() { return Color(255, 255, 255); }
89 static ShadowData* initialShadow() { return 0; } 89 static ShadowData* initialShadow() { return 0; }
90 static String initialClipperResource() { return String(); } 90 static String initialClipperResource() { return String(); }
91 static String initialFilterResource() { return String(); } 91 static String initialFilterResource() { return String(); }
92 static String initialMaskerResource() { return String(); } 92 static String initialMaskerResource() { return String(); }
93 static String initialMarkerStartResource() { return String(); } 93 static String initialMarkerStartResource() { return String(); }
94 static String initialMarkerMidResource() { return String(); } 94 static String initialMarkerMidResource() { return String(); }
95 static String initialMarkerEndResource() { return String(); } 95 static String initialMarkerEndResource() { return String(); }
96 static EMaskType initialMaskType() { return MT_LUMINANCE; } 96 static EMaskType initialMaskType() { return MT_LUMINANCE; }
97 static EPaintOrder initialPaintOrder() { return PO_NORMAL; }
97 98
98 static SVGLength initialBaselineShiftValue() 99 static SVGLength initialBaselineShiftValue()
99 { 100 {
100 SVGLength length; 101 SVGLength length;
101 length.newValueSpecifiedUnits(LengthTypeNumber, 0, ASSERT_NO_EXCEPTION); 102 length.newValueSpecifiedUnits(LengthTypeNumber, 0, ASSERT_NO_EXCEPTION);
102 return length; 103 return length;
103 } 104 }
104 105
105 static SVGLength initialKerning() 106 static SVGLength initialKerning()
106 { 107 {
(...skipping 28 matching lines...) Expand all
135 void setColorInterpolationFilters(EColorInterpolation val) { svg_inherited_f lags._colorInterpolationFilters = val; } 136 void setColorInterpolationFilters(EColorInterpolation val) { svg_inherited_f lags._colorInterpolationFilters = val; }
136 void setColorRendering(EColorRendering val) { svg_inherited_flags._colorRend ering = val; } 137 void setColorRendering(EColorRendering val) { svg_inherited_flags._colorRend ering = val; }
137 void setFillRule(WindRule val) { svg_inherited_flags._fillRule = val; } 138 void setFillRule(WindRule val) { svg_inherited_flags._fillRule = val; }
138 void setJoinStyle(LineJoin val) { svg_inherited_flags._joinStyle = val; } 139 void setJoinStyle(LineJoin val) { svg_inherited_flags._joinStyle = val; }
139 void setShapeRendering(EShapeRendering val) { svg_inherited_flags._shapeRend ering = val; } 140 void setShapeRendering(EShapeRendering val) { svg_inherited_flags._shapeRend ering = val; }
140 void setTextAnchor(ETextAnchor val) { svg_inherited_flags._textAnchor = val; } 141 void setTextAnchor(ETextAnchor val) { svg_inherited_flags._textAnchor = val; }
141 void setWritingMode(SVGWritingMode val) { svg_inherited_flags._writingMode = val; } 142 void setWritingMode(SVGWritingMode val) { svg_inherited_flags._writingMode = val; }
142 void setGlyphOrientationHorizontal(EGlyphOrientation val) { svg_inherited_fl ags._glyphOrientationHorizontal = val; } 143 void setGlyphOrientationHorizontal(EGlyphOrientation val) { svg_inherited_fl ags._glyphOrientationHorizontal = val; }
143 void setGlyphOrientationVertical(EGlyphOrientation val) { svg_inherited_flag s._glyphOrientationVertical = val; } 144 void setGlyphOrientationVertical(EGlyphOrientation val) { svg_inherited_flag s._glyphOrientationVertical = val; }
144 void setMaskType(EMaskType val) { svg_noninherited_flags.f.maskType = val; } 145 void setMaskType(EMaskType val) { svg_noninherited_flags.f.maskType = val; }
146 void setPaintOrder(EPaintOrder val) { svg_inherited_flags._paintOrder = (int )val; }
145 147
146 void setFillOpacity(float obj) 148 void setFillOpacity(float obj)
147 { 149 {
148 if (!(fill->opacity == obj)) 150 if (!(fill->opacity == obj))
149 fill.access()->opacity = obj; 151 fill.access()->opacity = obj;
150 } 152 }
151 153
152 void setFillPaint(SVGPaint::SVGPaintType type, const Color& color, const Str ing& uri, bool applyToRegularStyle = true, bool applyToVisitedLinkStyle = false) 154 void setFillPaint(SVGPaint::SVGPaintType type, const Color& color, const Str ing& uri, bool applyToRegularStyle = true, bool applyToVisitedLinkStyle = false)
153 { 155 {
154 if (applyToRegularStyle) { 156 if (applyToRegularStyle) {
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 const Color& lightingColor() const { return misc->lightingColor; } 341 const Color& lightingColor() const { return misc->lightingColor; }
340 SVGLength baselineShiftValue() const { return misc->baselineShiftValue; } 342 SVGLength baselineShiftValue() const { return misc->baselineShiftValue; }
341 ShadowData* shadow() const { return shadowSVG->shadow.get(); } 343 ShadowData* shadow() const { return shadowSVG->shadow.get(); }
342 String clipperResource() const { return resources->clipper; } 344 String clipperResource() const { return resources->clipper; }
343 String filterResource() const { return resources->filter; } 345 String filterResource() const { return resources->filter; }
344 String maskerResource() const { return resources->masker; } 346 String maskerResource() const { return resources->masker; }
345 String markerStartResource() const { return inheritedResources->markerStart; } 347 String markerStartResource() const { return inheritedResources->markerStart; }
346 String markerMidResource() const { return inheritedResources->markerMid; } 348 String markerMidResource() const { return inheritedResources->markerMid; }
347 String markerEndResource() const { return inheritedResources->markerEnd; } 349 String markerEndResource() const { return inheritedResources->markerEnd; }
348 EMaskType maskType() const { return (EMaskType) svg_noninherited_flags.f.mas kType; } 350 EMaskType maskType() const { return (EMaskType) svg_noninherited_flags.f.mas kType; }
351 EPaintOrder paintOrder() const { return (EPaintOrder) svg_inherited_flags._p aintOrder; }
352 EPaintOrderType paintOrderType(unsigned index) const;
349 353
350 const SVGPaint::SVGPaintType& visitedLinkFillPaintType() const { return fill ->visitedLinkPaintType; } 354 const SVGPaint::SVGPaintType& visitedLinkFillPaintType() const { return fill ->visitedLinkPaintType; }
351 const Color& visitedLinkFillPaintColor() const { return fill->visitedLinkPai ntColor; } 355 const Color& visitedLinkFillPaintColor() const { return fill->visitedLinkPai ntColor; }
352 const String& visitedLinkFillPaintUri() const { return fill->visitedLinkPain tUri; } 356 const String& visitedLinkFillPaintUri() const { return fill->visitedLinkPain tUri; }
353 const SVGPaint::SVGPaintType& visitedLinkStrokePaintType() const { return st roke->visitedLinkPaintType; } 357 const SVGPaint::SVGPaintType& visitedLinkStrokePaintType() const { return st roke->visitedLinkPaintType; }
354 const Color& visitedLinkStrokePaintColor() const { return stroke->visitedLin kPaintColor; } 358 const Color& visitedLinkStrokePaintColor() const { return stroke->visitedLin kPaintColor; }
355 const String& visitedLinkStrokePaintUri() const { return stroke->visitedLink PaintUri; } 359 const String& visitedLinkStrokePaintUri() const { return stroke->visitedLink PaintUri; }
356 360
357 // convenience 361 // convenience
358 bool hasClipper() const { return !clipperResource().isEmpty(); } 362 bool hasClipper() const { return !clipperResource().isEmpty(); }
(...skipping 14 matching lines...) Expand all
373 && (_shapeRendering == other._shapeRendering) 377 && (_shapeRendering == other._shapeRendering)
374 && (_clipRule == other._clipRule) 378 && (_clipRule == other._clipRule)
375 && (_fillRule == other._fillRule) 379 && (_fillRule == other._fillRule)
376 && (_capStyle == other._capStyle) 380 && (_capStyle == other._capStyle)
377 && (_joinStyle == other._joinStyle) 381 && (_joinStyle == other._joinStyle)
378 && (_textAnchor == other._textAnchor) 382 && (_textAnchor == other._textAnchor)
379 && (_colorInterpolation == other._colorInterpolation) 383 && (_colorInterpolation == other._colorInterpolation)
380 && (_colorInterpolationFilters == other._colorInterpolationFilte rs) 384 && (_colorInterpolationFilters == other._colorInterpolationFilte rs)
381 && (_writingMode == other._writingMode) 385 && (_writingMode == other._writingMode)
382 && (_glyphOrientationHorizontal == other._glyphOrientationHorizo ntal) 386 && (_glyphOrientationHorizontal == other._glyphOrientationHorizo ntal)
383 && (_glyphOrientationVertical == other._glyphOrientationVertical ); 387 && (_glyphOrientationVertical == other._glyphOrientationVertical )
388 && (_paintOrder == other._paintOrder);
384 } 389 }
385 390
386 bool operator!=(const InheritedFlags& other) const 391 bool operator!=(const InheritedFlags& other) const
387 { 392 {
388 return !(*this == other); 393 return !(*this == other);
389 } 394 }
390 395
391 unsigned _colorRendering : 2; // EColorRendering 396 unsigned _colorRendering : 2; // EColorRendering
392 unsigned _shapeRendering : 2; // EShapeRendering 397 unsigned _shapeRendering : 2; // EShapeRendering
393 unsigned _clipRule : 1; // WindRule 398 unsigned _clipRule : 1; // WindRule
394 unsigned _fillRule : 1; // WindRule 399 unsigned _fillRule : 1; // WindRule
395 unsigned _capStyle : 2; // LineCap 400 unsigned _capStyle : 2; // LineCap
396 unsigned _joinStyle : 2; // LineJoin 401 unsigned _joinStyle : 2; // LineJoin
397 unsigned _textAnchor : 2; // ETextAnchor 402 unsigned _textAnchor : 2; // ETextAnchor
398 unsigned _colorInterpolation : 2; // EColorInterpolation 403 unsigned _colorInterpolation : 2; // EColorInterpolation
399 unsigned _colorInterpolationFilters : 2; // EColorInterpolation 404 unsigned _colorInterpolationFilters : 2; // EColorInterpolation
400 unsigned _writingMode : 3; // SVGWritingMode 405 unsigned _writingMode : 3; // SVGWritingMode
401 unsigned _glyphOrientationHorizontal : 3; // EGlyphOrientation 406 unsigned _glyphOrientationHorizontal : 3; // EGlyphOrientation
402 unsigned _glyphOrientationVertical : 3; // EGlyphOrientation 407 unsigned _glyphOrientationVertical : 3; // EGlyphOrientation
408 unsigned _paintOrder : 6; // EPaintOrder
403 } svg_inherited_flags; 409 } svg_inherited_flags;
404 410
405 // don't inherit 411 // don't inherit
406 struct NonInheritedFlags { 412 struct NonInheritedFlags {
407 // 32 bit non-inherited, don't add to the struct, or the operator will b reak. 413 // 32 bit non-inherited, don't add to the struct, or the operator will b reak.
408 bool operator==(const NonInheritedFlags &other) const { return _niflags == other._niflags; } 414 bool operator==(const NonInheritedFlags &other) const { return _niflags == other._niflags; }
409 bool operator!=(const NonInheritedFlags &other) const { return _niflags != other._niflags; } 415 bool operator!=(const NonInheritedFlags &other) const { return _niflags != other._niflags; }
410 416
411 union { 417 union {
412 struct { 418 struct {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 svg_inherited_flags._fillRule = initialFillRule(); 454 svg_inherited_flags._fillRule = initialFillRule();
449 svg_inherited_flags._shapeRendering = initialShapeRendering(); 455 svg_inherited_flags._shapeRendering = initialShapeRendering();
450 svg_inherited_flags._textAnchor = initialTextAnchor(); 456 svg_inherited_flags._textAnchor = initialTextAnchor();
451 svg_inherited_flags._capStyle = initialCapStyle(); 457 svg_inherited_flags._capStyle = initialCapStyle();
452 svg_inherited_flags._joinStyle = initialJoinStyle(); 458 svg_inherited_flags._joinStyle = initialJoinStyle();
453 svg_inherited_flags._colorInterpolation = initialColorInterpolation(); 459 svg_inherited_flags._colorInterpolation = initialColorInterpolation();
454 svg_inherited_flags._colorInterpolationFilters = initialColorInterpolati onFilters(); 460 svg_inherited_flags._colorInterpolationFilters = initialColorInterpolati onFilters();
455 svg_inherited_flags._writingMode = initialWritingMode(); 461 svg_inherited_flags._writingMode = initialWritingMode();
456 svg_inherited_flags._glyphOrientationHorizontal = initialGlyphOrientatio nHorizontal(); 462 svg_inherited_flags._glyphOrientationHorizontal = initialGlyphOrientatio nHorizontal();
457 svg_inherited_flags._glyphOrientationVertical = initialGlyphOrientationV ertical(); 463 svg_inherited_flags._glyphOrientationVertical = initialGlyphOrientationV ertical();
464 svg_inherited_flags._paintOrder = initialPaintOrder();
458 465
459 svg_noninherited_flags._niflags = 0; 466 svg_noninherited_flags._niflags = 0;
460 svg_noninherited_flags.f._alignmentBaseline = initialAlignmentBaseline() ; 467 svg_noninherited_flags.f._alignmentBaseline = initialAlignmentBaseline() ;
461 svg_noninherited_flags.f._dominantBaseline = initialDominantBaseline(); 468 svg_noninherited_flags.f._dominantBaseline = initialDominantBaseline();
462 svg_noninherited_flags.f._baselineShift = initialBaselineShift(); 469 svg_noninherited_flags.f._baselineShift = initialBaselineShift();
463 svg_noninherited_flags.f._vectorEffect = initialVectorEffect(); 470 svg_noninherited_flags.f._vectorEffect = initialVectorEffect();
464 svg_noninherited_flags.f.bufferedRendering = initialBufferedRendering(); 471 svg_noninherited_flags.f.bufferedRendering = initialBufferedRendering();
465 svg_noninherited_flags.f.maskType = initialMaskType(); 472 svg_noninherited_flags.f.maskType = initialMaskType();
466 } 473 }
467 }; 474 };
468 475
469 } // namespace WebCore 476 } // namespace WebCore
470 477
471 #endif // SVGRenderStyle_h 478 #endif // SVGRenderStyle_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698