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

Side by Side Diff: Source/core/style/SVGComputedStyle.h

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
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 static float initialFloodOpacity() { return 1; } 85 static float initialFloodOpacity() { return 1; }
86 static Color initialFloodColor() { return Color(0, 0, 0); } 86 static Color initialFloodColor() { return Color(0, 0, 0); }
87 static Color initialLightingColor() { return Color(255, 255, 255); } 87 static Color initialLightingColor() { return Color(255, 255, 255); }
88 static const AtomicString& initialClipperResource() { return nullAtom; } 88 static const AtomicString& initialClipperResource() { return nullAtom; }
89 static const AtomicString& initialFilterResource() { return nullAtom; } 89 static const AtomicString& initialFilterResource() { return nullAtom; }
90 static const AtomicString& initialMaskerResource() { return nullAtom; } 90 static const AtomicString& initialMaskerResource() { return nullAtom; }
91 static const AtomicString& initialMarkerStartResource() { return nullAtom; } 91 static const AtomicString& initialMarkerStartResource() { return nullAtom; }
92 static const AtomicString& initialMarkerMidResource() { return nullAtom; } 92 static const AtomicString& initialMarkerMidResource() { return nullAtom; }
93 static const AtomicString& initialMarkerEndResource() { return nullAtom; } 93 static const AtomicString& initialMarkerEndResource() { return nullAtom; }
94 static EMaskType initialMaskType() { return MT_LUMINANCE; } 94 static EMaskType initialMaskType() { return MT_LUMINANCE; }
95 static EPaintOrder initialPaintOrder() { return PO_NORMAL; } 95 static EPaintOrder initialPaintOrder() { return PaintOrderNormal; }
96 static Length initialCx() { return Length(Fixed); } 96 static Length initialCx() { return Length(Fixed); }
97 static Length initialCy() { return Length(Fixed); } 97 static Length initialCy() { return Length(Fixed); }
98 static Length initialX() { return Length(Fixed); } 98 static Length initialX() { return Length(Fixed); }
99 static Length initialY() { return Length(Fixed); } 99 static Length initialY() { return Length(Fixed); }
100 static Length initialR() { return Length(Fixed); } 100 static Length initialR() { return Length(Fixed); }
101 static Length initialRx() { return Length(Fixed); } 101 static Length initialRx() { return Length(Fixed); }
102 static Length initialRy() { return Length(Fixed); } 102 static Length initialRy() { return Length(Fixed); }
103 103
104 // SVG CSS Property setters 104 // SVG CSS Property setters
105 void setAlignmentBaseline(EAlignmentBaseline val) { svg_noninherited_flags.f ._alignmentBaseline = val; } 105 void setAlignmentBaseline(EAlignmentBaseline val) { svg_noninherited_flags.f ._alignmentBaseline = val; }
106 void setDominantBaseline(EDominantBaseline val) { svg_noninherited_flags.f._ dominantBaseline = val; } 106 void setDominantBaseline(EDominantBaseline val) { svg_noninherited_flags.f._ dominantBaseline = val; }
107 void setBaselineShift(EBaselineShift val) { svg_noninherited_flags.f._baseli neShift = val; } 107 void setBaselineShift(EBaselineShift val) { svg_noninherited_flags.f._baseli neShift = val; }
108 void setVectorEffect(EVectorEffect val) { svg_noninherited_flags.f._vectorEf fect = val; } 108 void setVectorEffect(EVectorEffect val) { svg_noninherited_flags.f._vectorEf fect = val; }
109 void setBufferedRendering(EBufferedRendering val) { svg_noninherited_flags.f .bufferedRendering = val; } 109 void setBufferedRendering(EBufferedRendering val) { svg_noninherited_flags.f .bufferedRendering = val; }
110 void setCapStyle(LineCap val) { svg_inherited_flags._capStyle = val; } 110 void setCapStyle(LineCap val) { svg_inherited_flags._capStyle = val; }
111 void setClipRule(WindRule val) { svg_inherited_flags._clipRule = val; } 111 void setClipRule(WindRule val) { svg_inherited_flags._clipRule = val; }
112 void setColorInterpolation(EColorInterpolation val) { svg_inherited_flags._c olorInterpolation = val; } 112 void setColorInterpolation(EColorInterpolation val) { svg_inherited_flags._c olorInterpolation = val; }
113 void setColorInterpolationFilters(EColorInterpolation val) { svg_inherited_f lags._colorInterpolationFilters = val; } 113 void setColorInterpolationFilters(EColorInterpolation val) { svg_inherited_f lags._colorInterpolationFilters = val; }
114 void setColorRendering(EColorRendering val) { svg_inherited_flags._colorRend ering = val; } 114 void setColorRendering(EColorRendering val) { svg_inherited_flags._colorRend ering = val; }
115 void setFillRule(WindRule val) { svg_inherited_flags._fillRule = val; } 115 void setFillRule(WindRule val) { svg_inherited_flags._fillRule = val; }
116 void setJoinStyle(LineJoin val) { svg_inherited_flags._joinStyle = val; } 116 void setJoinStyle(LineJoin val) { svg_inherited_flags._joinStyle = val; }
117 void setShapeRendering(EShapeRendering val) { svg_inherited_flags._shapeRend ering = val; } 117 void setShapeRendering(EShapeRendering val) { svg_inherited_flags._shapeRend ering = val; }
118 void setTextAnchor(ETextAnchor val) { svg_inherited_flags._textAnchor = val; } 118 void setTextAnchor(ETextAnchor val) { svg_inherited_flags._textAnchor = val; }
119 void setWritingMode(SVGWritingMode val) { svg_inherited_flags._writingMode = val; } 119 void setWritingMode(SVGWritingMode val) { svg_inherited_flags._writingMode = val; }
120 void setGlyphOrientationHorizontal(EGlyphOrientation val) { svg_inherited_fl ags._glyphOrientationHorizontal = val; } 120 void setGlyphOrientationHorizontal(EGlyphOrientation val) { svg_inherited_fl ags._glyphOrientationHorizontal = val; }
121 void setGlyphOrientationVertical(EGlyphOrientation val) { svg_inherited_flag s._glyphOrientationVertical = val; } 121 void setGlyphOrientationVertical(EGlyphOrientation val) { svg_inherited_flag s._glyphOrientationVertical = val; }
122 void setMaskType(EMaskType val) { svg_noninherited_flags.f.maskType = val; } 122 void setMaskType(EMaskType val) { svg_noninherited_flags.f.maskType = val; }
123 void setPaintOrder(EPaintOrder val) { svg_inherited_flags._paintOrder = (int )val; } 123 void setPaintOrder(EPaintOrder val) { svg_inherited_flags.paintOrder = (int) val; }
124 void setCx(const Length& obj) 124 void setCx(const Length& obj)
125 { 125 {
126 if (!(layout->cx == obj)) 126 if (!(layout->cx == obj))
127 layout.access()->cx = obj; 127 layout.access()->cx = obj;
128 } 128 }
129 void setCy(const Length& obj) 129 void setCy(const Length& obj)
130 { 130 {
131 if (!(layout->cy == obj)) 131 if (!(layout->cy == obj))
132 layout.access()->cy = obj; 132 layout.access()->cy = obj;
133 } 133 }
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 const Length& r() const { return layout->r; } 349 const Length& r() const { return layout->r; }
350 const Length& rx() const { return layout->rx; } 350 const Length& rx() const { return layout->rx; }
351 const Length& ry() const { return layout->ry; } 351 const Length& ry() const { return layout->ry; }
352 const AtomicString& clipperResource() const { return resources->clipper; } 352 const AtomicString& clipperResource() const { return resources->clipper; }
353 const AtomicString& filterResource() const { return resources->filter; } 353 const AtomicString& filterResource() const { return resources->filter; }
354 const AtomicString& maskerResource() const { return resources->masker; } 354 const AtomicString& maskerResource() const { return resources->masker; }
355 const AtomicString& markerStartResource() const { return inheritedResources- >markerStart; } 355 const AtomicString& markerStartResource() const { return inheritedResources- >markerStart; }
356 const AtomicString& markerMidResource() const { return inheritedResources->m arkerMid; } 356 const AtomicString& markerMidResource() const { return inheritedResources->m arkerMid; }
357 const AtomicString& markerEndResource() const { return inheritedResources->m arkerEnd; } 357 const AtomicString& markerEndResource() const { return inheritedResources->m arkerEnd; }
358 EMaskType maskType() const { return (EMaskType) svg_noninherited_flags.f.mas kType; } 358 EMaskType maskType() const { return (EMaskType) svg_noninherited_flags.f.mas kType; }
359 EPaintOrder paintOrder() const { return (EPaintOrder) svg_inherited_flags._p aintOrder; } 359 EPaintOrder paintOrder() const { return (EPaintOrder) svg_inherited_flags.pa intOrder; }
360 EPaintOrderType paintOrderType(unsigned index) const; 360 EPaintOrderType paintOrderType(unsigned index) const;
361 361
362 const SVGPaintType& visitedLinkFillPaintType() const { return fill->visitedL inkPaintType; } 362 const SVGPaintType& visitedLinkFillPaintType() const { return fill->visitedL inkPaintType; }
363 const Color& visitedLinkFillPaintColor() const { return fill->visitedLinkPai ntColor; } 363 const Color& visitedLinkFillPaintColor() const { return fill->visitedLinkPai ntColor; }
364 const String& visitedLinkFillPaintUri() const { return fill->visitedLinkPain tUri; } 364 const String& visitedLinkFillPaintUri() const { return fill->visitedLinkPain tUri; }
365 const SVGPaintType& visitedLinkStrokePaintType() const { return stroke->visi tedLinkPaintType; } 365 const SVGPaintType& visitedLinkStrokePaintType() const { return stroke->visi tedLinkPaintType; }
366 const Color& visitedLinkStrokePaintColor() const { return stroke->visitedLin kPaintColor; } 366 const Color& visitedLinkStrokePaintColor() const { return stroke->visitedLin kPaintColor; }
367 const String& visitedLinkStrokePaintUri() const { return stroke->visitedLink PaintUri; } 367 const String& visitedLinkStrokePaintUri() const { return stroke->visitedLink PaintUri; }
368 368
369 // convenience 369 // convenience
(...skipping 18 matching lines...) Expand all
388 && (_clipRule == other._clipRule) 388 && (_clipRule == other._clipRule)
389 && (_fillRule == other._fillRule) 389 && (_fillRule == other._fillRule)
390 && (_capStyle == other._capStyle) 390 && (_capStyle == other._capStyle)
391 && (_joinStyle == other._joinStyle) 391 && (_joinStyle == other._joinStyle)
392 && (_textAnchor == other._textAnchor) 392 && (_textAnchor == other._textAnchor)
393 && (_colorInterpolation == other._colorInterpolation) 393 && (_colorInterpolation == other._colorInterpolation)
394 && (_colorInterpolationFilters == other._colorInterpolationFilte rs) 394 && (_colorInterpolationFilters == other._colorInterpolationFilte rs)
395 && (_writingMode == other._writingMode) 395 && (_writingMode == other._writingMode)
396 && (_glyphOrientationHorizontal == other._glyphOrientationHorizo ntal) 396 && (_glyphOrientationHorizontal == other._glyphOrientationHorizo ntal)
397 && (_glyphOrientationVertical == other._glyphOrientationVertical ) 397 && (_glyphOrientationVertical == other._glyphOrientationVertical )
398 && (_paintOrder == other._paintOrder); 398 && (paintOrder == other.paintOrder);
399 } 399 }
400 400
401 bool operator!=(const InheritedFlags& other) const 401 bool operator!=(const InheritedFlags& other) const
402 { 402 {
403 return !(*this == other); 403 return !(*this == other);
404 } 404 }
405 405
406 unsigned _colorRendering : 2; // EColorRendering 406 unsigned _colorRendering : 2; // EColorRendering
407 unsigned _shapeRendering : 2; // EShapeRendering 407 unsigned _shapeRendering : 2; // EShapeRendering
408 unsigned _clipRule : 1; // WindRule 408 unsigned _clipRule : 1; // WindRule
409 unsigned _fillRule : 1; // WindRule 409 unsigned _fillRule : 1; // WindRule
410 unsigned _capStyle : 2; // LineCap 410 unsigned _capStyle : 2; // LineCap
411 unsigned _joinStyle : 2; // LineJoin 411 unsigned _joinStyle : 2; // LineJoin
412 unsigned _textAnchor : 2; // ETextAnchor 412 unsigned _textAnchor : 2; // ETextAnchor
413 unsigned _colorInterpolation : 2; // EColorInterpolation 413 unsigned _colorInterpolation : 2; // EColorInterpolation
414 unsigned _colorInterpolationFilters : 2; // EColorInterpolation 414 unsigned _colorInterpolationFilters : 2; // EColorInterpolation
415 unsigned _writingMode : 3; // SVGWritingMode 415 unsigned _writingMode : 3; // SVGWritingMode
416 unsigned _glyphOrientationHorizontal : 3; // EGlyphOrientation 416 unsigned _glyphOrientationHorizontal : 3; // EGlyphOrientation
417 unsigned _glyphOrientationVertical : 3; // EGlyphOrientation 417 unsigned _glyphOrientationVertical : 3; // EGlyphOrientation
418 unsigned _paintOrder : 6; // EPaintOrder 418 unsigned paintOrder : 3; // EPaintOrder
419 } svg_inherited_flags; 419 } svg_inherited_flags;
420 420
421 // don't inherit 421 // don't inherit
422 struct NonInheritedFlags { 422 struct NonInheritedFlags {
423 // 32 bit non-inherited, don't add to the struct, or the operator will b reak. 423 // 32 bit non-inherited, don't add to the struct, or the operator will b reak.
424 bool operator==(const NonInheritedFlags &other) const { return _niflags == other._niflags; } 424 bool operator==(const NonInheritedFlags &other) const { return _niflags == other._niflags; }
425 bool operator!=(const NonInheritedFlags &other) const { return _niflags != other._niflags; } 425 bool operator!=(const NonInheritedFlags &other) const { return _niflags != other._niflags; }
426 426
427 union { 427 union {
428 struct { 428 struct {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 svg_inherited_flags._fillRule = initialFillRule(); 466 svg_inherited_flags._fillRule = initialFillRule();
467 svg_inherited_flags._shapeRendering = initialShapeRendering(); 467 svg_inherited_flags._shapeRendering = initialShapeRendering();
468 svg_inherited_flags._textAnchor = initialTextAnchor(); 468 svg_inherited_flags._textAnchor = initialTextAnchor();
469 svg_inherited_flags._capStyle = initialCapStyle(); 469 svg_inherited_flags._capStyle = initialCapStyle();
470 svg_inherited_flags._joinStyle = initialJoinStyle(); 470 svg_inherited_flags._joinStyle = initialJoinStyle();
471 svg_inherited_flags._colorInterpolation = initialColorInterpolation(); 471 svg_inherited_flags._colorInterpolation = initialColorInterpolation();
472 svg_inherited_flags._colorInterpolationFilters = initialColorInterpolati onFilters(); 472 svg_inherited_flags._colorInterpolationFilters = initialColorInterpolati onFilters();
473 svg_inherited_flags._writingMode = initialWritingMode(); 473 svg_inherited_flags._writingMode = initialWritingMode();
474 svg_inherited_flags._glyphOrientationHorizontal = initialGlyphOrientatio nHorizontal(); 474 svg_inherited_flags._glyphOrientationHorizontal = initialGlyphOrientatio nHorizontal();
475 svg_inherited_flags._glyphOrientationVertical = initialGlyphOrientationV ertical(); 475 svg_inherited_flags._glyphOrientationVertical = initialGlyphOrientationV ertical();
476 svg_inherited_flags._paintOrder = initialPaintOrder(); 476 svg_inherited_flags.paintOrder = initialPaintOrder();
477 477
478 svg_noninherited_flags._niflags = 0; 478 svg_noninherited_flags._niflags = 0;
479 svg_noninherited_flags.f._alignmentBaseline = initialAlignmentBaseline() ; 479 svg_noninherited_flags.f._alignmentBaseline = initialAlignmentBaseline() ;
480 svg_noninherited_flags.f._dominantBaseline = initialDominantBaseline(); 480 svg_noninherited_flags.f._dominantBaseline = initialDominantBaseline();
481 svg_noninherited_flags.f._baselineShift = initialBaselineShift(); 481 svg_noninherited_flags.f._baselineShift = initialBaselineShift();
482 svg_noninherited_flags.f._vectorEffect = initialVectorEffect(); 482 svg_noninherited_flags.f._vectorEffect = initialVectorEffect();
483 svg_noninherited_flags.f.bufferedRendering = initialBufferedRendering(); 483 svg_noninherited_flags.f.bufferedRendering = initialBufferedRendering();
484 svg_noninherited_flags.f.maskType = initialMaskType(); 484 svg_noninherited_flags.f.maskType = initialMaskType();
485 } 485 }
486 }; 486 };
487 487
488 } // namespace blink 488 } // namespace blink
489 489
490 #endif // SVGComputedStyle_h 490 #endif // SVGComputedStyle_h
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleBuilderConverter.cpp ('k') | Source/core/style/SVGComputedStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698