OLD | NEW |
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 Loading... |
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 "platform/Length.h" |
32 #include "platform/graphics/GraphicsTypes.h" | 33 #include "platform/graphics/GraphicsTypes.h" |
33 #include "platform/graphics/Path.h" | 34 #include "platform/graphics/Path.h" |
34 | 35 |
35 namespace blink { | 36 namespace blink { |
36 | 37 |
37 class SVGRenderStyle : public RefCounted<SVGRenderStyle> { | 38 class SVGRenderStyle : public RefCounted<SVGRenderStyle> { |
38 public: | 39 public: |
39 static PassRefPtr<SVGRenderStyle> create() { return adoptRef(new SVGRenderSt
yle); } | 40 static PassRefPtr<SVGRenderStyle> create() { return adoptRef(new SVGRenderSt
yle); } |
40 PassRefPtr<SVGRenderStyle> copy() const { return adoptRef(new SVGRenderStyle
(*this));} | 41 PassRefPtr<SVGRenderStyle> copy() const { return adoptRef(new SVGRenderStyle
(*this));} |
41 ~SVGRenderStyle(); | 42 ~SVGRenderStyle(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 static Color initialFloodColor() { return Color(0, 0, 0); } | 84 static Color initialFloodColor() { return Color(0, 0, 0); } |
84 static Color initialLightingColor() { return Color(255, 255, 255); } | 85 static Color initialLightingColor() { return Color(255, 255, 255); } |
85 static const AtomicString& initialClipperResource() { return nullAtom; } | 86 static const AtomicString& initialClipperResource() { return nullAtom; } |
86 static const AtomicString& initialFilterResource() { return nullAtom; } | 87 static const AtomicString& initialFilterResource() { return nullAtom; } |
87 static const AtomicString& initialMaskerResource() { return nullAtom; } | 88 static const AtomicString& initialMaskerResource() { return nullAtom; } |
88 static const AtomicString& initialMarkerStartResource() { return nullAtom; } | 89 static const AtomicString& initialMarkerStartResource() { return nullAtom; } |
89 static const AtomicString& initialMarkerMidResource() { return nullAtom; } | 90 static const AtomicString& initialMarkerMidResource() { return nullAtom; } |
90 static const AtomicString& initialMarkerEndResource() { return nullAtom; } | 91 static const AtomicString& initialMarkerEndResource() { return nullAtom; } |
91 static EMaskType initialMaskType() { return MT_LUMINANCE; } | 92 static EMaskType initialMaskType() { return MT_LUMINANCE; } |
92 static EPaintOrder initialPaintOrder() { return PO_NORMAL; } | 93 static EPaintOrder initialPaintOrder() { return PO_NORMAL; } |
| 94 static Length initialX() { return Length(Fixed); } |
| 95 static Length initialY() { return Length(Fixed); } |
93 | 96 |
94 static PassRefPtrWillBeRawPtr<SVGLength> initialBaselineShiftValue() | 97 static PassRefPtrWillBeRawPtr<SVGLength> initialBaselineShiftValue() |
95 { | 98 { |
96 RefPtrWillBeRawPtr<SVGLength> length = SVGLength::create(); | 99 RefPtrWillBeRawPtr<SVGLength> length = SVGLength::create(); |
97 length->newValueSpecifiedUnits(LengthTypeNumber, 0); | 100 length->newValueSpecifiedUnits(LengthTypeNumber, 0); |
98 return length.release(); | 101 return length.release(); |
99 } | 102 } |
100 | 103 |
101 static PassRefPtrWillBeRawPtr<SVGLength> initialStrokeDashOffset() | 104 static PassRefPtrWillBeRawPtr<SVGLength> initialStrokeDashOffset() |
102 { | 105 { |
(...skipping 22 matching lines...) Expand all Loading... |
125 void setColorRendering(EColorRendering val) { svg_inherited_flags._colorRend
ering = val; } | 128 void setColorRendering(EColorRendering val) { svg_inherited_flags._colorRend
ering = val; } |
126 void setFillRule(WindRule val) { svg_inherited_flags._fillRule = val; } | 129 void setFillRule(WindRule val) { svg_inherited_flags._fillRule = val; } |
127 void setJoinStyle(LineJoin val) { svg_inherited_flags._joinStyle = val; } | 130 void setJoinStyle(LineJoin val) { svg_inherited_flags._joinStyle = val; } |
128 void setShapeRendering(EShapeRendering val) { svg_inherited_flags._shapeRend
ering = val; } | 131 void setShapeRendering(EShapeRendering val) { svg_inherited_flags._shapeRend
ering = val; } |
129 void setTextAnchor(ETextAnchor val) { svg_inherited_flags._textAnchor = val;
} | 132 void setTextAnchor(ETextAnchor val) { svg_inherited_flags._textAnchor = val;
} |
130 void setWritingMode(SVGWritingMode val) { svg_inherited_flags._writingMode =
val; } | 133 void setWritingMode(SVGWritingMode val) { svg_inherited_flags._writingMode =
val; } |
131 void setGlyphOrientationHorizontal(EGlyphOrientation val) { svg_inherited_fl
ags._glyphOrientationHorizontal = val; } | 134 void setGlyphOrientationHorizontal(EGlyphOrientation val) { svg_inherited_fl
ags._glyphOrientationHorizontal = val; } |
132 void setGlyphOrientationVertical(EGlyphOrientation val) { svg_inherited_flag
s._glyphOrientationVertical = val; } | 135 void setGlyphOrientationVertical(EGlyphOrientation val) { svg_inherited_flag
s._glyphOrientationVertical = val; } |
133 void setMaskType(EMaskType val) { svg_noninherited_flags.f.maskType = val; } | 136 void setMaskType(EMaskType val) { svg_noninherited_flags.f.maskType = val; } |
134 void setPaintOrder(EPaintOrder val) { svg_inherited_flags._paintOrder = (int
)val; } | 137 void setPaintOrder(EPaintOrder val) { svg_inherited_flags._paintOrder = (int
)val; } |
135 | 138 void setX(const Length& obj) |
| 139 { |
| 140 if (!(layout->x == obj)) |
| 141 layout.access()->x = obj; |
| 142 } |
| 143 void setY(const Length& obj) |
| 144 { |
| 145 if (!(layout->y == obj)) |
| 146 layout.access()->y = obj; |
| 147 } |
136 void setFillOpacity(float obj) | 148 void setFillOpacity(float obj) |
137 { | 149 { |
138 if (!(fill->opacity == obj)) | 150 if (!(fill->opacity == obj)) |
139 fill.access()->opacity = obj; | 151 fill.access()->opacity = obj; |
140 } | 152 } |
141 | 153 |
142 void setFillPaint(SVGPaintType type, const Color& color, const String& uri,
bool applyToRegularStyle = true, bool applyToVisitedLinkStyle = false) | 154 void setFillPaint(SVGPaintType type, const Color& color, const String& uri,
bool applyToRegularStyle = true, bool applyToVisitedLinkStyle = false) |
143 { | 155 { |
144 if (applyToRegularStyle) { | 156 if (applyToRegularStyle) { |
145 if (!(fill->paintType == type)) | 157 if (!(fill->paintType == type)) |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 SVGLengthList* strokeDashArray() const { return stroke->dashArray.get(); } | 324 SVGLengthList* strokeDashArray() const { return stroke->dashArray.get(); } |
313 float strokeMiterLimit() const { return stroke->miterLimit; } | 325 float strokeMiterLimit() const { return stroke->miterLimit; } |
314 SVGLength* strokeWidth() const { return stroke->width.get(); } | 326 SVGLength* strokeWidth() const { return stroke->width.get(); } |
315 SVGLength* strokeDashOffset() const { return stroke->dashOffset.get(); } | 327 SVGLength* strokeDashOffset() const { return stroke->dashOffset.get(); } |
316 float stopOpacity() const { return stops->opacity; } | 328 float stopOpacity() const { return stops->opacity; } |
317 const Color& stopColor() const { return stops->color; } | 329 const Color& stopColor() const { return stops->color; } |
318 float floodOpacity() const { return misc->floodOpacity; } | 330 float floodOpacity() const { return misc->floodOpacity; } |
319 const Color& floodColor() const { return misc->floodColor; } | 331 const Color& floodColor() const { return misc->floodColor; } |
320 const Color& lightingColor() const { return misc->lightingColor; } | 332 const Color& lightingColor() const { return misc->lightingColor; } |
321 SVGLength* baselineShiftValue() const { return misc->baselineShiftValue.get(
); } | 333 SVGLength* baselineShiftValue() const { return misc->baselineShiftValue.get(
); } |
| 334 const Length& x() const { return layout->x; } |
| 335 const Length& y() const { return layout->y; } |
322 const AtomicString& clipperResource() const { return resources->clipper; } | 336 const AtomicString& clipperResource() const { return resources->clipper; } |
323 const AtomicString& filterResource() const { return resources->filter; } | 337 const AtomicString& filterResource() const { return resources->filter; } |
324 const AtomicString& maskerResource() const { return resources->masker; } | 338 const AtomicString& maskerResource() const { return resources->masker; } |
325 const AtomicString& markerStartResource() const { return inheritedResources-
>markerStart; } | 339 const AtomicString& markerStartResource() const { return inheritedResources-
>markerStart; } |
326 const AtomicString& markerMidResource() const { return inheritedResources->m
arkerMid; } | 340 const AtomicString& markerMidResource() const { return inheritedResources->m
arkerMid; } |
327 const AtomicString& markerEndResource() const { return inheritedResources->m
arkerEnd; } | 341 const AtomicString& markerEndResource() const { return inheritedResources->m
arkerEnd; } |
328 EMaskType maskType() const { return (EMaskType) svg_noninherited_flags.f.mas
kType; } | 342 EMaskType maskType() const { return (EMaskType) svg_noninherited_flags.f.mas
kType; } |
329 EPaintOrder paintOrder() const { return (EPaintOrder) svg_inherited_flags._p
aintOrder; } | 343 EPaintOrder paintOrder() const { return (EPaintOrder) svg_inherited_flags._p
aintOrder; } |
330 EPaintOrderType paintOrderType(unsigned index) const; | 344 EPaintOrderType paintOrderType(unsigned index) const; |
331 | 345 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 } svg_noninherited_flags; | 421 } svg_noninherited_flags; |
408 | 422 |
409 // inherited attributes | 423 // inherited attributes |
410 DataRef<StyleFillData> fill; | 424 DataRef<StyleFillData> fill; |
411 DataRef<StyleStrokeData> stroke; | 425 DataRef<StyleStrokeData> stroke; |
412 DataRef<StyleInheritedResourceData> inheritedResources; | 426 DataRef<StyleInheritedResourceData> inheritedResources; |
413 | 427 |
414 // non-inherited attributes | 428 // non-inherited attributes |
415 DataRef<StyleStopData> stops; | 429 DataRef<StyleStopData> stops; |
416 DataRef<StyleMiscData> misc; | 430 DataRef<StyleMiscData> misc; |
| 431 DataRef<StyleLayoutData> layout; |
417 DataRef<StyleResourceData> resources; | 432 DataRef<StyleResourceData> resources; |
418 | 433 |
419 private: | 434 private: |
420 enum CreateDefaultType { CreateDefault }; | 435 enum CreateDefaultType { CreateDefault }; |
421 | 436 |
422 SVGRenderStyle(); | 437 SVGRenderStyle(); |
423 SVGRenderStyle(const SVGRenderStyle&); | 438 SVGRenderStyle(const SVGRenderStyle&); |
424 SVGRenderStyle(CreateDefaultType); // Used to create the default style. | 439 SVGRenderStyle(CreateDefaultType); // Used to create the default style. |
425 | 440 |
426 bool diffNeedsLayoutAndPaintInvalidation(const SVGRenderStyle* other) const; | 441 bool diffNeedsLayoutAndPaintInvalidation(const SVGRenderStyle* other) const; |
(...skipping 21 matching lines...) Expand all Loading... |
448 svg_noninherited_flags.f._baselineShift = initialBaselineShift(); | 463 svg_noninherited_flags.f._baselineShift = initialBaselineShift(); |
449 svg_noninherited_flags.f._vectorEffect = initialVectorEffect(); | 464 svg_noninherited_flags.f._vectorEffect = initialVectorEffect(); |
450 svg_noninherited_flags.f.bufferedRendering = initialBufferedRendering(); | 465 svg_noninherited_flags.f.bufferedRendering = initialBufferedRendering(); |
451 svg_noninherited_flags.f.maskType = initialMaskType(); | 466 svg_noninherited_flags.f.maskType = initialMaskType(); |
452 } | 467 } |
453 }; | 468 }; |
454 | 469 |
455 } // namespace blink | 470 } // namespace blink |
456 | 471 |
457 #endif // SVGRenderStyle_h | 472 #endif // SVGRenderStyle_h |
OLD | NEW |