1 /*
2     Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3                   2004, 2005 Rob Buis <buis@kde.org>
4     Copyright (C) 2005, 2006 Apple Computer, Inc.
5     Copyright (C) Research In Motion Limited 2010. All rights reserved.
6 
7     This library is free software; you can redistribute it and/or
8     modify it under the terms of the GNU Library General Public
9     License as published by the Free Software Foundation; either
10     version 2 of the License, or (at your option) any later version.
11 
12     This library is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15     Library General Public License for more details.
16 
17     You should have received a copy of the GNU Library General Public License
18     along with this library; see the file COPYING.LIB.  If not, write to
19     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20     Boston, MA 02110-1301, USA.
21 */
22 
23 #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_SVG_COMPUTED_STYLE_H_
24 #define THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_SVG_COMPUTED_STYLE_H_
25 
26 #include "third_party/blink/renderer/core/core_export.h"
27 #include "third_party/blink/renderer/core/css/style_color.h"
28 #include "third_party/blink/renderer/core/style/computed_style_constants.h"
29 #include "third_party/blink/renderer/core/style/data_ref.h"
30 #include "third_party/blink/renderer/core/style/svg_computed_style_defs.h"
31 #include "third_party/blink/renderer/platform/geometry/length.h"
32 #include "third_party/blink/renderer/platform/graphics/graphics_types.h"
33 #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
34 #include "third_party/blink/renderer/platform/wtf/forward.h"
35 #include "third_party/blink/renderer/platform/wtf/ref_counted.h"
36 
37 namespace blink {
38 
39 class StyleDifference;
40 
41 // TODO(sashab): Move this into a private class on ComputedStyle, and remove
42 // all methods on it, merging them into copy/creation methods on ComputedStyle
43 // instead. Keep the allocation logic, only allocating a new object if needed.
44 class SVGComputedStyle : public RefCounted<SVGComputedStyle> {
45   USING_FAST_MALLOC(SVGComputedStyle);
46 
47  public:
Create()48   static scoped_refptr<SVGComputedStyle> Create() {
49     return base::AdoptRef(new SVGComputedStyle);
50   }
Copy()51   scoped_refptr<SVGComputedStyle> Copy() const {
52     return base::AdoptRef(new SVGComputedStyle(*this));
53   }
54   CORE_EXPORT ~SVGComputedStyle();
55 
56   bool InheritedEqual(const SVGComputedStyle&) const;
57   bool NonInheritedEqual(const SVGComputedStyle&) const;
58   void InheritFrom(const SVGComputedStyle&);
59   void CopyNonInheritedFromCached(const SVGComputedStyle&);
60 
61   CORE_EXPORT StyleDifference Diff(const SVGComputedStyle&) const;
62 
63   bool operator==(const SVGComputedStyle&) const;
64   bool operator!=(const SVGComputedStyle& o) const { return !(*this == o); }
65 
66   // Initial values for all the properties
InitialAlignmentBaseline()67   static EAlignmentBaseline InitialAlignmentBaseline() { return AB_AUTO; }
InitialDominantBaseline()68   static EDominantBaseline InitialDominantBaseline() { return DB_AUTO; }
InitialBaselineShift()69   static EBaselineShift InitialBaselineShift() { return BS_LENGTH; }
InitialBaselineShiftValue()70   static Length InitialBaselineShiftValue() { return Length::Fixed(); }
InitialVectorEffect()71   static EVectorEffect InitialVectorEffect() { return VE_NONE; }
InitialBufferedRendering()72   static EBufferedRendering InitialBufferedRendering() { return BR_AUTO; }
InitialCapStyle()73   static LineCap InitialCapStyle() { return kButtCap; }
InitialClipRule()74   static WindRule InitialClipRule() { return RULE_NONZERO; }
InitialColorInterpolation()75   static EColorInterpolation InitialColorInterpolation() { return CI_SRGB; }
InitialColorInterpolationFilters()76   static EColorInterpolation InitialColorInterpolationFilters() {
77     return CI_LINEARRGB;
78   }
InitialColorRendering()79   static EColorRendering InitialColorRendering() { return CR_AUTO; }
InitialFillRule()80   static WindRule InitialFillRule() { return RULE_NONZERO; }
InitialJoinStyle()81   static LineJoin InitialJoinStyle() { return kMiterJoin; }
InitialShapeRendering()82   static EShapeRendering InitialShapeRendering() { return SR_AUTO; }
InitialTextAnchor()83   static ETextAnchor InitialTextAnchor() { return TA_START; }
InitialFillOpacity()84   static float InitialFillOpacity() { return 1; }
InitialFillPaint()85   static SVGPaint InitialFillPaint() { return SVGPaint(Color::kBlack); }
InitialStrokeOpacity()86   static float InitialStrokeOpacity() { return 1; }
InitialStrokePaint()87   static SVGPaint InitialStrokePaint() { return SVGPaint(); }
88   static scoped_refptr<SVGDashArray> InitialStrokeDashArray();
InitialStrokeDashOffset()89   static Length InitialStrokeDashOffset() { return Length::Fixed(); }
InitialStrokeMiterLimit()90   static float InitialStrokeMiterLimit() { return 4; }
InitialStrokeWidth()91   static UnzoomedLength InitialStrokeWidth() {
92     return UnzoomedLength(Length::Fixed(1));
93   }
InitialStopOpacity()94   static float InitialStopOpacity() { return 1; }
InitialStopColor()95   static Color InitialStopColor() { return Color::kBlack; }
InitialFloodOpacity()96   static float InitialFloodOpacity() { return 1; }
InitialFloodColor()97   static Color InitialFloodColor() { return Color::kBlack; }
InitialLightingColor()98   static Color InitialLightingColor() { return Color::kWhite; }
InitialMaskerResource()99   static StyleSVGResource* InitialMaskerResource() { return nullptr; }
InitialMarkerStartResource()100   static StyleSVGResource* InitialMarkerStartResource() { return nullptr; }
InitialMarkerMidResource()101   static StyleSVGResource* InitialMarkerMidResource() { return nullptr; }
InitialMarkerEndResource()102   static StyleSVGResource* InitialMarkerEndResource() { return nullptr; }
InitialMaskType()103   static EMaskType InitialMaskType() { return MT_LUMINANCE; }
InitialPaintOrder()104   static EPaintOrder InitialPaintOrder() { return kPaintOrderNormal; }
InitialD()105   static StylePath* InitialD() { return nullptr; }
InitialCx()106   static Length InitialCx() { return Length::Fixed(); }
InitialCy()107   static Length InitialCy() { return Length::Fixed(); }
InitialX()108   static Length InitialX() { return Length::Fixed(); }
InitialY()109   static Length InitialY() { return Length::Fixed(); }
InitialR()110   static Length InitialR() { return Length::Fixed(); }
InitialRx()111   static Length InitialRx() { return Length::Auto(); }
InitialRy()112   static Length InitialRy() { return Length::Auto(); }
113 
114   // SVG CSS Property setters
SetAlignmentBaseline(EAlignmentBaseline val)115   void SetAlignmentBaseline(EAlignmentBaseline val) {
116     svg_noninherited_flags.f.alignment_baseline = val;
117   }
SetDominantBaseline(EDominantBaseline val)118   void SetDominantBaseline(EDominantBaseline val) {
119     svg_inherited_flags.dominant_baseline = val;
120   }
SetBaselineShift(EBaselineShift val)121   void SetBaselineShift(EBaselineShift val) {
122     svg_noninherited_flags.f.baseline_shift = val;
123   }
SetVectorEffect(EVectorEffect val)124   void SetVectorEffect(EVectorEffect val) {
125     svg_noninherited_flags.f.vector_effect = val;
126   }
SetBufferedRendering(EBufferedRendering val)127   void SetBufferedRendering(EBufferedRendering val) {
128     svg_noninherited_flags.f.buffered_rendering = val;
129   }
SetCapStyle(LineCap val)130   void SetCapStyle(LineCap val) { svg_inherited_flags.cap_style = val; }
SetClipRule(WindRule val)131   void SetClipRule(WindRule val) { svg_inherited_flags.clip_rule = val; }
SetColorInterpolation(EColorInterpolation val)132   void SetColorInterpolation(EColorInterpolation val) {
133     svg_inherited_flags.color_interpolation = val;
134   }
SetColorInterpolationFilters(EColorInterpolation val)135   void SetColorInterpolationFilters(EColorInterpolation val) {
136     svg_inherited_flags.color_interpolation_filters = val;
137   }
SetColorRendering(EColorRendering val)138   void SetColorRendering(EColorRendering val) {
139     svg_inherited_flags.color_rendering = val;
140   }
SetFillRule(WindRule val)141   void SetFillRule(WindRule val) { svg_inherited_flags.fill_rule = val; }
SetJoinStyle(LineJoin val)142   void SetJoinStyle(LineJoin val) { svg_inherited_flags.join_style = val; }
SetShapeRendering(EShapeRendering val)143   void SetShapeRendering(EShapeRendering val) {
144     svg_inherited_flags.shape_rendering = val;
145   }
SetTextAnchor(ETextAnchor val)146   void SetTextAnchor(ETextAnchor val) { svg_inherited_flags.text_anchor = val; }
SetMaskType(EMaskType val)147   void SetMaskType(EMaskType val) { svg_noninherited_flags.f.mask_type = val; }
SetPaintOrder(EPaintOrder val)148   void SetPaintOrder(EPaintOrder val) {
149     svg_inherited_flags.paint_order = (int)val;
150   }
SetD(scoped_refptr<StylePath> d)151   void SetD(scoped_refptr<StylePath> d) {
152     if (!(geometry->d == d))
153       geometry.Access()->d = std::move(d);
154   }
SetCx(const Length & obj)155   void SetCx(const Length& obj) {
156     if (!(geometry->cx == obj))
157       geometry.Access()->cx = obj;
158   }
SetCy(const Length & obj)159   void SetCy(const Length& obj) {
160     if (!(geometry->cy == obj))
161       geometry.Access()->cy = obj;
162   }
SetX(const Length & obj)163   void SetX(const Length& obj) {
164     if (!(geometry->x == obj))
165       geometry.Access()->x = obj;
166   }
SetY(const Length & obj)167   void SetY(const Length& obj) {
168     if (!(geometry->y == obj))
169       geometry.Access()->y = obj;
170   }
SetR(const Length & obj)171   void SetR(const Length& obj) {
172     if (!(geometry->r == obj))
173       geometry.Access()->r = obj;
174   }
SetRx(const Length & obj)175   void SetRx(const Length& obj) {
176     if (!(geometry->rx == obj))
177       geometry.Access()->rx = obj;
178   }
SetRy(const Length & obj)179   void SetRy(const Length& obj) {
180     if (!(geometry->ry == obj))
181       geometry.Access()->ry = obj;
182   }
SetFillOpacity(float obj)183   void SetFillOpacity(float obj) {
184     if (!(fill->opacity == obj))
185       fill.Access()->opacity = obj;
186   }
187 
SetFillPaint(const SVGPaint & paint)188   void SetFillPaint(const SVGPaint& paint) {
189     if (!(fill->paint == paint))
190       fill.Access()->paint = paint;
191   }
192 
SetInternalVisitedFillPaint(const SVGPaint & paint)193   void SetInternalVisitedFillPaint(const SVGPaint& paint) {
194     if (!(fill->visited_link_paint == paint))
195       fill.Access()->visited_link_paint = paint;
196   }
197 
SetStrokeOpacity(float obj)198   void SetStrokeOpacity(float obj) {
199     if (!(stroke->opacity == obj))
200       stroke.Access()->opacity = obj;
201   }
202 
SetStrokePaint(const SVGPaint & paint)203   void SetStrokePaint(const SVGPaint& paint) {
204     if (!(stroke->paint == paint))
205       stroke.Access()->paint = paint;
206   }
207 
SetInternalVisitedStrokePaint(const SVGPaint & paint)208   void SetInternalVisitedStrokePaint(const SVGPaint& paint) {
209     if (!(stroke->visited_link_paint == paint))
210       stroke.Access()->visited_link_paint = paint;
211   }
212 
SetStrokeDashArray(scoped_refptr<SVGDashArray> dash_array)213   void SetStrokeDashArray(scoped_refptr<SVGDashArray> dash_array) {
214     if (stroke->dash_array->data != dash_array->data)
215       stroke.Access()->dash_array = std::move(dash_array);
216   }
217 
SetStrokeMiterLimit(float obj)218   void SetStrokeMiterLimit(float obj) {
219     if (!(stroke->miter_limit == obj))
220       stroke.Access()->miter_limit = obj;
221   }
222 
SetStrokeWidth(const UnzoomedLength & stroke_width)223   void SetStrokeWidth(const UnzoomedLength& stroke_width) {
224     if (!(stroke->width == stroke_width))
225       stroke.Access()->width = stroke_width;
226   }
227 
SetStrokeDashOffset(const Length & dash_offset)228   void SetStrokeDashOffset(const Length& dash_offset) {
229     if (!(stroke->dash_offset == dash_offset))
230       stroke.Access()->dash_offset = dash_offset;
231   }
232 
SetStopOpacity(float obj)233   void SetStopOpacity(float obj) {
234     if (!(stops->opacity == obj))
235       stops.Access()->opacity = obj;
236   }
237 
SetStopColor(const StyleColor & obj)238   void SetStopColor(const StyleColor& obj) {
239     if (!(stops->color == obj))
240       stops.Access()->color = obj;
241   }
242 
SetFloodOpacity(float obj)243   void SetFloodOpacity(float obj) {
244     if (!(misc->flood_opacity == obj))
245       misc.Access()->flood_opacity = obj;
246   }
247 
SetFloodColor(const StyleColor & style_color)248   void SetFloodColor(const StyleColor& style_color) {
249     if (FloodColor() != style_color) {
250       StyleMiscData* mutable_misc = misc.Access();
251       mutable_misc->flood_color = style_color.Resolve(Color());
252       mutable_misc->flood_color_is_current_color = style_color.IsCurrentColor();
253     }
254   }
255 
SetLightingColor(const StyleColor & style_color)256   void SetLightingColor(const StyleColor& style_color) {
257     if (LightingColor() != style_color) {
258       StyleMiscData* mutable_misc = misc.Access();
259       mutable_misc->lighting_color = style_color.Resolve(Color());
260       mutable_misc->lighting_color_is_current_color =
261           style_color.IsCurrentColor();
262     }
263   }
264 
SetBaselineShiftValue(const Length & baseline_shift_value)265   void SetBaselineShiftValue(const Length& baseline_shift_value) {
266     if (!(misc->baseline_shift_value == baseline_shift_value))
267       misc.Access()->baseline_shift_value = baseline_shift_value;
268   }
269 
270   // Setters for non-inherited resources
271   void SetMaskerResource(scoped_refptr<StyleSVGResource> resource);
272 
273   // Setters for inherited resources
274   void SetMarkerStartResource(scoped_refptr<StyleSVGResource> resource);
275 
276   void SetMarkerMidResource(scoped_refptr<StyleSVGResource> resource);
277 
278   void SetMarkerEndResource(scoped_refptr<StyleSVGResource> resource);
279 
280   // Read accessors for all the properties
AlignmentBaseline()281   EAlignmentBaseline AlignmentBaseline() const {
282     return (EAlignmentBaseline)svg_noninherited_flags.f.alignment_baseline;
283   }
DominantBaseline()284   EDominantBaseline DominantBaseline() const {
285     return (EDominantBaseline)svg_inherited_flags.dominant_baseline;
286   }
BaselineShift()287   EBaselineShift BaselineShift() const {
288     return (EBaselineShift)svg_noninherited_flags.f.baseline_shift;
289   }
VectorEffect()290   EVectorEffect VectorEffect() const {
291     return (EVectorEffect)svg_noninherited_flags.f.vector_effect;
292   }
BufferedRendering()293   EBufferedRendering BufferedRendering() const {
294     return (EBufferedRendering)svg_noninherited_flags.f.buffered_rendering;
295   }
CapStyle()296   LineCap CapStyle() const { return (LineCap)svg_inherited_flags.cap_style; }
ClipRule()297   WindRule ClipRule() const { return (WindRule)svg_inherited_flags.clip_rule; }
ColorInterpolation()298   EColorInterpolation ColorInterpolation() const {
299     return (EColorInterpolation)svg_inherited_flags.color_interpolation;
300   }
ColorInterpolationFilters()301   EColorInterpolation ColorInterpolationFilters() const {
302     return (EColorInterpolation)svg_inherited_flags.color_interpolation_filters;
303   }
ColorRendering()304   EColorRendering ColorRendering() const {
305     return (EColorRendering)svg_inherited_flags.color_rendering;
306   }
FillRule()307   WindRule FillRule() const { return (WindRule)svg_inherited_flags.fill_rule; }
JoinStyle()308   LineJoin JoinStyle() const {
309     return (LineJoin)svg_inherited_flags.join_style;
310   }
ShapeRendering()311   EShapeRendering ShapeRendering() const {
312     return (EShapeRendering)svg_inherited_flags.shape_rendering;
313   }
TextAnchor()314   ETextAnchor TextAnchor() const {
315     return (ETextAnchor)svg_inherited_flags.text_anchor;
316   }
FillOpacity()317   float FillOpacity() const { return fill->opacity; }
FillPaint()318   const SVGPaint& FillPaint() const { return fill->paint; }
StrokeOpacity()319   float StrokeOpacity() const { return stroke->opacity; }
StrokePaint()320   const SVGPaint& StrokePaint() const { return stroke->paint; }
StrokeDashArray()321   SVGDashArray* StrokeDashArray() const { return stroke->dash_array.get(); }
StrokeMiterLimit()322   float StrokeMiterLimit() const { return stroke->miter_limit; }
StrokeWidth()323   const UnzoomedLength& StrokeWidth() const { return stroke->width; }
StrokeDashOffset()324   const Length& StrokeDashOffset() const { return stroke->dash_offset; }
StopOpacity()325   float StopOpacity() const { return stops->opacity; }
StopColor()326   const StyleColor& StopColor() const { return stops->color; }
FloodOpacity()327   float FloodOpacity() const { return misc->flood_opacity; }
FloodColor()328   StyleColor FloodColor() const {
329     return misc->flood_color_is_current_color ? StyleColor::CurrentColor()
330                                               : StyleColor(misc->flood_color);
331   }
LightingColor()332   StyleColor LightingColor() const {
333     return misc->lighting_color_is_current_color
334                ? StyleColor::CurrentColor()
335                : StyleColor(misc->lighting_color);
336   }
BaselineShiftValue()337   const Length& BaselineShiftValue() const {
338     return misc->baseline_shift_value;
339   }
D()340   StylePath* D() const { return geometry->d.get(); }
Cx()341   const Length& Cx() const { return geometry->cx; }
Cy()342   const Length& Cy() const { return geometry->cy; }
X()343   const Length& X() const { return geometry->x; }
Y()344   const Length& Y() const { return geometry->y; }
R()345   const Length& R() const { return geometry->r; }
Rx()346   const Length& Rx() const { return geometry->rx; }
Ry()347   const Length& Ry() const { return geometry->ry; }
MaskerResource()348   StyleSVGResource* MaskerResource() const { return resources->masker.get(); }
MarkerStartResource()349   StyleSVGResource* MarkerStartResource() const {
350     return inherited_resources->marker_start.get();
351   }
MarkerMidResource()352   StyleSVGResource* MarkerMidResource() const {
353     return inherited_resources->marker_mid.get();
354   }
MarkerEndResource()355   StyleSVGResource* MarkerEndResource() const {
356     return inherited_resources->marker_end.get();
357   }
MaskType()358   EMaskType MaskType() const {
359     return (EMaskType)svg_noninherited_flags.f.mask_type;
360   }
PaintOrder()361   EPaintOrder PaintOrder() const {
362     return (EPaintOrder)svg_inherited_flags.paint_order;
363   }
364   EPaintOrderType PaintOrderType(unsigned index) const;
365 
InternalVisitedFillPaint()366   const SVGPaint& InternalVisitedFillPaint() const {
367     return fill->visited_link_paint;
368   }
InternalVisitedStrokePaint()369   const SVGPaint& InternalVisitedStrokePaint() const {
370     return stroke->visited_link_paint;
371   }
372 
IsFillColorCurrentColor()373   bool IsFillColorCurrentColor() const {
374     return FillPaint().HasCurrentColor() ||
375            InternalVisitedFillPaint().HasCurrentColor();
376   }
377 
IsStrokeColorCurrentColor()378   bool IsStrokeColorCurrentColor() const {
379     return StrokePaint().HasCurrentColor() ||
380            InternalVisitedStrokePaint().HasCurrentColor();
381   }
382 
383   // convenience
HasMasker()384   bool HasMasker() const { return MaskerResource(); }
HasMarkers()385   bool HasMarkers() const {
386     return MarkerStartResource() || MarkerMidResource() || MarkerEndResource();
387   }
HasStroke()388   bool HasStroke() const { return !StrokePaint().IsNone(); }
HasVisibleStroke()389   bool HasVisibleStroke() const {
390     return HasStroke() && !StrokeWidth().IsZero();
391   }
HasFill()392   bool HasFill() const { return !FillPaint().IsNone(); }
393 
394  protected:
395   // inherit
396   struct InheritedFlags {
397     bool operator==(const InheritedFlags& other) const {
398       return (color_rendering == other.color_rendering) &&
399              (shape_rendering == other.shape_rendering) &&
400              (clip_rule == other.clip_rule) && (fill_rule == other.fill_rule) &&
401              (cap_style == other.cap_style) &&
402              (join_style == other.join_style) &&
403              (text_anchor == other.text_anchor) &&
404              (color_interpolation == other.color_interpolation) &&
405              (color_interpolation_filters ==
406               other.color_interpolation_filters) &&
407              (paint_order == other.paint_order) &&
408              (dominant_baseline == other.dominant_baseline);
409     }
410 
411     bool operator!=(const InheritedFlags& other) const {
412       return !(*this == other);
413     }
414 
415     unsigned color_rendering : 2;              // EColorRendering
416     unsigned shape_rendering : 2;              // EShapeRendering
417     unsigned clip_rule : 1;                    // WindRule
418     unsigned fill_rule : 1;                    // WindRule
419     unsigned cap_style : 2;                    // LineCap
420     unsigned join_style : 2;                   // LineJoin
421     unsigned text_anchor : 2;                  // ETextAnchor
422     unsigned color_interpolation : 2;          // EColorInterpolation
423     unsigned color_interpolation_filters : 2;  // EColorInterpolation_
424     unsigned paint_order : 3;                  // EPaintOrder
425     unsigned dominant_baseline : 4;            // EDominantBaseline
426   } svg_inherited_flags;
427 
428   // don't inherit
429   struct NonInheritedFlags {
430     // 32 bit non-inherited, don't add to the struct, or the operator will
431     // break.
432     bool operator==(const NonInheritedFlags& other) const {
433       return niflags == other.niflags;
434     }
435     bool operator!=(const NonInheritedFlags& other) const {
436       return niflags != other.niflags;
437     }
438 
439     union {
440       struct {
441         unsigned alignment_baseline : 4;  // EAlignmentBaseline
442         unsigned baseline_shift : 2;      // EBaselineShift
443         unsigned vector_effect : 1;       // EVectorEffect
444         unsigned buffered_rendering : 2;  // EBufferedRendering
445         unsigned mask_type : 1;           // EMaskType
446                                           // 18 bits unused
447       } f;
448       uint32_t niflags;
449     };
450   } svg_noninherited_flags;
451 
452   // inherited attributes
453   DataRef<StyleFillData> fill;
454   DataRef<StyleStrokeData> stroke;
455   DataRef<StyleInheritedResourceData> inherited_resources;
456 
457   // non-inherited attributes
458   DataRef<StyleStopData> stops;
459   DataRef<StyleMiscData> misc;
460   DataRef<StyleGeometryData> geometry;
461   DataRef<StyleResourceData> resources;
462 
463  private:
464   enum CreateInitialType { kCreateInitial };
465 
466   CORE_EXPORT SVGComputedStyle();
467   SVGComputedStyle(const SVGComputedStyle&);
468   SVGComputedStyle(
469       CreateInitialType);  // Used to create the initial style singleton.
470 
471   bool DiffNeedsLayoutAndPaintInvalidation(const SVGComputedStyle& other) const;
472   bool DiffNeedsPaintInvalidation(const SVGComputedStyle& other) const;
473 
SetBitDefaults()474   void SetBitDefaults() {
475     svg_inherited_flags.clip_rule = InitialClipRule();
476     svg_inherited_flags.color_rendering = InitialColorRendering();
477     svg_inherited_flags.fill_rule = InitialFillRule();
478     svg_inherited_flags.shape_rendering = InitialShapeRendering();
479     svg_inherited_flags.text_anchor = InitialTextAnchor();
480     svg_inherited_flags.cap_style = InitialCapStyle();
481     svg_inherited_flags.join_style = InitialJoinStyle();
482     svg_inherited_flags.color_interpolation = InitialColorInterpolation();
483     svg_inherited_flags.color_interpolation_filters =
484         InitialColorInterpolationFilters();
485     svg_inherited_flags.paint_order = InitialPaintOrder();
486     svg_inherited_flags.dominant_baseline = InitialDominantBaseline();
487 
488     svg_noninherited_flags.niflags = 0;
489     svg_noninherited_flags.f.alignment_baseline = InitialAlignmentBaseline();
490     svg_noninherited_flags.f.baseline_shift = InitialBaselineShift();
491     svg_noninherited_flags.f.vector_effect = InitialVectorEffect();
492     svg_noninherited_flags.f.buffered_rendering = InitialBufferedRendering();
493     svg_noninherited_flags.f.mask_type = InitialMaskType();
494   }
495 };
496 
497 }  // namespace blink
498 
499 #endif  // THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_SVG_COMPUTED_STYLE_H_
500