summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/style/SVGRenderStyle.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/rendering/style/SVGRenderStyle.h')
-rw-r--r--Source/WebCore/rendering/style/SVGRenderStyle.h97
1 files changed, 62 insertions, 35 deletions
diff --git a/Source/WebCore/rendering/style/SVGRenderStyle.h b/Source/WebCore/rendering/style/SVGRenderStyle.h
index ff07db54c..1eff35685 100644
--- a/Source/WebCore/rendering/style/SVGRenderStyle.h
+++ b/Source/WebCore/rendering/style/SVGRenderStyle.h
@@ -1,8 +1,9 @@
/*
Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
- Copyright (C) 2005, 2006 Apple Computer, Inc.
+ Copyright (C) 2005, 2006 Apple Inc.
Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -23,7 +24,6 @@
#ifndef SVGRenderStyle_h
#define SVGRenderStyle_h
-#if ENABLE(SVG)
#include "CSSValueList.h"
#include "DataRef.h"
#include "ExceptionCodePlaceholder.h"
@@ -41,9 +41,9 @@ class RenderObject;
class SVGRenderStyle : public RefCounted<SVGRenderStyle> {
public:
- static PassRef<SVGRenderStyle> createDefaultStyle();
- static PassRef<SVGRenderStyle> create() { return adoptRef(*new SVGRenderStyle); }
- PassRef<SVGRenderStyle> copy() const;
+ static Ref<SVGRenderStyle> createDefaultStyle();
+ static Ref<SVGRenderStyle> create() { return adoptRef(*new SVGRenderStyle); }
+ Ref<SVGRenderStyle> copy() const;
~SVGRenderStyle();
bool inheritedNotEqual(const SVGRenderStyle*) const;
@@ -90,12 +90,12 @@ public:
static Color initialLightingColor() { return Color(255, 255, 255); }
static ShadowData* initialShadow() { return 0; }
static String initialClipperResource() { return String(); }
- static String initialFilterResource() { return String(); }
static String initialMaskerResource() { return String(); }
static String initialMarkerStartResource() { return String(); }
static String initialMarkerMidResource() { return String(); }
static String initialMarkerEndResource() { return String(); }
static EMaskType initialMaskType() { return MT_LUMINANCE; }
+ static PaintOrder initialPaintOrder() { return PaintOrderNormal; }
static SVGLength initialBaselineShiftValue()
{
@@ -111,20 +111,6 @@ public:
return length;
}
- static SVGLength initialStrokeDashOffset()
- {
- SVGLength length;
- length.newValueSpecifiedUnits(LengthTypeNumber, 0, ASSERT_NO_EXCEPTION);
- return length;
- }
-
- static SVGLength initialStrokeWidth()
- {
- SVGLength length;
- length.newValueSpecifiedUnits(LengthTypeNumber, 1, ASSERT_NO_EXCEPTION);
- return length;
- }
-
// SVG CSS Property setters
void setAlignmentBaseline(EAlignmentBaseline val) { svg_noninherited_flags.f._alignmentBaseline = val; }
void setDominantBaseline(EDominantBaseline val) { svg_noninherited_flags.f._dominantBaseline = val; }
@@ -144,6 +130,42 @@ public:
void setGlyphOrientationHorizontal(EGlyphOrientation val) { svg_inherited_flags._glyphOrientationHorizontal = val; }
void setGlyphOrientationVertical(EGlyphOrientation val) { svg_inherited_flags._glyphOrientationVertical = val; }
void setMaskType(EMaskType val) { svg_noninherited_flags.f.maskType = val; }
+ void setPaintOrder(PaintOrder val) { svg_inherited_flags.paintOrder = val; }
+ void setCx(const Length& obj)
+ {
+ if (!(layout->cx == obj))
+ layout.access()->cx = obj;
+ }
+ void setCy(const Length& obj)
+ {
+ if (!(layout->cy == obj))
+ layout.access()->cy = obj;
+ }
+ void setR(const Length& obj)
+ {
+ if (!(layout->r == obj))
+ layout.access()->r = obj;
+ }
+ void setRx(const Length& obj)
+ {
+ if (!(layout->rx == obj))
+ layout.access()->rx = obj;
+ }
+ void setRy(const Length& obj)
+ {
+ if (!(layout->ry == obj))
+ layout.access()->ry = obj;
+ }
+ void setX(const Length& obj)
+ {
+ if (!(layout->x == obj))
+ layout.access()->x = obj;
+ }
+ void setY(const Length& obj)
+ {
+ if (!(layout->y == obj))
+ layout.access()->y = obj;
+ }
void setFillOpacity(float obj)
{
@@ -209,13 +231,13 @@ public:
stroke.access()->miterLimit = obj;
}
- void setStrokeWidth(const SVGLength& obj)
+ void setStrokeWidth(const Length& obj)
{
if (!(stroke->width == obj))
stroke.access()->width = obj;
}
- void setStrokeDashOffset(const SVGLength& obj)
+ void setStrokeDashOffset(const Length& obj)
{
if (!(stroke->dashOffset == obj))
stroke.access()->dashOffset = obj;
@@ -263,7 +285,7 @@ public:
misc.access()->baselineShiftValue = obj;
}
- void setShadow(PassOwnPtr<ShadowData> obj) { shadowSVG.access()->shadow = obj; }
+ void setShadow(std::unique_ptr<ShadowData> obj) { shadowSVG.access()->shadow = WTFMove(obj); }
// Setters for non-inherited resources
void setClipperResource(const String& obj)
@@ -272,12 +294,6 @@ public:
resources.access()->clipper = obj;
}
- void setFilterResource(const String& obj)
- {
- if (!(resources->filter == obj))
- resources.access()->filter = obj;
- }
-
void setMaskerResource(const String& obj)
{
if (!(resources->masker == obj))
@@ -331,8 +347,8 @@ public:
const String& strokePaintUri() const { return stroke->paintUri; }
Vector<SVGLength> strokeDashArray() const { return stroke->dashArray; }
float strokeMiterLimit() const { return stroke->miterLimit; }
- SVGLength strokeWidth() const { return stroke->width; }
- SVGLength strokeDashOffset() const { return stroke->dashOffset; }
+ const Length& strokeWidth() const { return stroke->width; }
+ const Length& strokeDashOffset() const { return stroke->dashOffset; }
SVGLength kerning() const { return text->kerning; }
float stopOpacity() const { return stops->opacity; }
const Color& stopColor() const { return stops->color; }
@@ -341,13 +357,21 @@ public:
const Color& lightingColor() const { return misc->lightingColor; }
SVGLength baselineShiftValue() const { return misc->baselineShiftValue; }
ShadowData* shadow() const { return shadowSVG->shadow.get(); }
+ const Length& cx() const { return layout->cx; }
+ const Length& cy() const { return layout->cy; }
+ const Length& r() const { return layout->r; }
+ const Length& rx() const { return layout->rx; }
+ const Length& ry() const { return layout->ry; }
+ const Length& x() const { return layout->x; }
+ const Length& y() const { return layout->y; }
String clipperResource() const { return resources->clipper; }
- String filterResource() const { return resources->filter; }
String maskerResource() const { return resources->masker; }
String markerStartResource() const { return inheritedResources->markerStart; }
String markerMidResource() const { return inheritedResources->markerMid; }
String markerEndResource() const { return inheritedResources->markerEnd; }
EMaskType maskType() const { return (EMaskType) svg_noninherited_flags.f.maskType; }
+ PaintOrder paintOrder() const { return (PaintOrder) svg_inherited_flags.paintOrder; }
+ Vector<PaintType, 3> paintTypesForPaintOrder() const;
const SVGPaint::SVGPaintType& visitedLinkFillPaintType() const { return fill->visitedLinkPaintType; }
const Color& visitedLinkFillPaintColor() const { return fill->visitedLinkPaintColor; }
@@ -359,12 +383,12 @@ public:
// convenience
bool hasClipper() const { return !clipperResource().isEmpty(); }
bool hasMasker() const { return !maskerResource().isEmpty(); }
- bool hasFilter() const { return !filterResource().isEmpty(); }
bool hasMarkers() const { return !markerStartResource().isEmpty() || !markerMidResource().isEmpty() || !markerEndResource().isEmpty(); }
bool hasStroke() const { return strokePaintType() != SVGPaint::SVG_PAINTTYPE_NONE; }
bool hasVisibleStroke() const { return hasStroke() && !strokeWidth().isZero(); }
bool hasFill() const { return fillPaintType() != SVGPaint::SVG_PAINTTYPE_NONE; }
bool isVerticalWritingMode() const { return writingMode() == WM_TBRL || writingMode() == WM_TB; }
+ bool isolatesBlending() const { return hasMasker() || shadow(); }
protected:
// inherit
@@ -382,7 +406,8 @@ protected:
&& (_colorInterpolationFilters == other._colorInterpolationFilters)
&& (_writingMode == other._writingMode)
&& (_glyphOrientationHorizontal == other._glyphOrientationHorizontal)
- && (_glyphOrientationVertical == other._glyphOrientationVertical);
+ && (_glyphOrientationVertical == other._glyphOrientationVertical)
+ && (paintOrder == other.paintOrder);
}
bool operator!=(const InheritedFlags& other) const
@@ -402,6 +427,7 @@ protected:
unsigned _writingMode : 3; // SVGWritingMode
unsigned _glyphOrientationHorizontal : 3; // EGlyphOrientation
unsigned _glyphOrientationVertical : 3; // EGlyphOrientation
+ unsigned paintOrder : 3; // PaintOrder
} svg_inherited_flags;
// don't inherit
@@ -434,6 +460,7 @@ protected:
DataRef<StyleStopData> stops;
DataRef<StyleMiscData> misc;
DataRef<StyleShadowSVGData> shadowSVG;
+ DataRef<StyleLayoutData> layout;
DataRef<StyleResourceData> resources;
private:
@@ -457,6 +484,7 @@ private:
svg_inherited_flags._writingMode = initialWritingMode();
svg_inherited_flags._glyphOrientationHorizontal = initialGlyphOrientationHorizontal();
svg_inherited_flags._glyphOrientationVertical = initialGlyphOrientationVertical();
+ svg_inherited_flags.paintOrder = initialPaintOrder();
svg_noninherited_flags._niflags = 0;
svg_noninherited_flags.f._alignmentBaseline = initialAlignmentBaseline();
@@ -470,5 +498,4 @@ private:
} // namespace WebCore
-#endif // ENABLE(SVG)
#endif // SVGRenderStyle_h