diff options
Diffstat (limited to 'Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp')
-rw-r--r-- | Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp | 79 |
1 files changed, 53 insertions, 26 deletions
diff --git a/Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp b/Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp index aed179b9c..9f023e5c8 100644 --- a/Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp +++ b/Source/WebCore/rendering/style/SVGRenderStyleDefs.cpp @@ -2,12 +2,13 @@ Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2007 Rob Buis <buis@kde.org> Copyright (C) Research In Motion Limited 2010. All rights reserved. + Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. Based on khtml code by: Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) Copyright (C) 2002-2003 Dirk Mueller (mueller@kde.org) - Copyright (C) 2002 Apple Computer, Inc. + Copyright (C) 2002 Apple Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -26,12 +27,11 @@ */ #include "config.h" - -#if ENABLE(SVG) #include "SVGRenderStyleDefs.h" #include "RenderStyle.h" #include "SVGRenderStyle.h" +#include <wtf/PointerComparison.h> namespace WebCore { @@ -58,7 +58,7 @@ inline StyleFillData::StyleFillData(const StyleFillData& other) { } -PassRef<StyleFillData> StyleFillData::copy() const +Ref<StyleFillData> StyleFillData::copy() const { return adoptRef(*new StyleFillData(*this)); } @@ -77,8 +77,7 @@ bool StyleFillData::operator==(const StyleFillData& other) const StyleStrokeData::StyleStrokeData() : opacity(SVGRenderStyle::initialStrokeOpacity()) , miterLimit(SVGRenderStyle::initialStrokeMiterLimit()) - , width(SVGRenderStyle::initialStrokeWidth()) - , dashOffset(SVGRenderStyle::initialStrokeDashOffset()) + , dashOffset(RenderStyle::initialZeroLength()) , dashArray(SVGRenderStyle::initialStrokeDashArray()) , paintType(SVGRenderStyle::initialStrokePaintType()) , paintColor(SVGRenderStyle::initialStrokePaintColor()) @@ -93,7 +92,6 @@ inline StyleStrokeData::StyleStrokeData(const StyleStrokeData& other) : RefCounted<StyleStrokeData>() , opacity(other.opacity) , miterLimit(other.miterLimit) - , width(other.width) , dashOffset(other.dashOffset) , dashArray(other.dashArray) , paintType(other.paintType) @@ -105,15 +103,14 @@ inline StyleStrokeData::StyleStrokeData(const StyleStrokeData& other) { } -PassRef<StyleStrokeData> StyleStrokeData::copy() const +Ref<StyleStrokeData> StyleStrokeData::copy() const { return adoptRef(*new StyleStrokeData(*this)); } bool StyleStrokeData::operator==(const StyleStrokeData& other) const { - return width == other.width - && opacity == other.opacity + return opacity == other.opacity && miterLimit == other.miterLimit && dashOffset == other.dashOffset && dashArray == other.dashArray @@ -138,7 +135,7 @@ inline StyleStopData::StyleStopData(const StyleStopData& other) { } -PassRef<StyleStopData> StyleStopData::copy() const +Ref<StyleStopData> StyleStopData::copy() const { return adoptRef(*new StyleStopData(*this)); } @@ -160,7 +157,7 @@ inline StyleTextData::StyleTextData(const StyleTextData& other) { } -PassRef<StyleTextData> StyleTextData::copy() const +Ref<StyleTextData> StyleTextData::copy() const { return adoptRef(*new StyleTextData(*this)); } @@ -187,7 +184,7 @@ inline StyleMiscData::StyleMiscData(const StyleMiscData& other) { } -PassRef<StyleMiscData> StyleMiscData::copy() const +Ref<StyleMiscData> StyleMiscData::copy() const { return adoptRef(*new StyleMiscData(*this)); } @@ -206,27 +203,22 @@ StyleShadowSVGData::StyleShadowSVGData() inline StyleShadowSVGData::StyleShadowSVGData(const StyleShadowSVGData& other) : RefCounted<StyleShadowSVGData>() - , shadow(other.shadow ? adoptPtr(new ShadowData(*other.shadow)) : nullptr) + , shadow(other.shadow ? std::make_unique<ShadowData>(*other.shadow) : nullptr) { } -PassRef<StyleShadowSVGData> StyleShadowSVGData::copy() const +Ref<StyleShadowSVGData> StyleShadowSVGData::copy() const { return adoptRef(*new StyleShadowSVGData(*this)); } bool StyleShadowSVGData::operator==(const StyleShadowSVGData& other) const { - if ((!shadow && other.shadow) || (shadow && !other.shadow)) - return false; - if (shadow && other.shadow && (*shadow != *other.shadow)) - return false; - return true; + return arePointingToEqualData(shadow, other.shadow); } StyleResourceData::StyleResourceData() : clipper(SVGRenderStyle::initialClipperResource()) - , filter(SVGRenderStyle::initialFilterResource()) , masker(SVGRenderStyle::initialMaskerResource()) { } @@ -234,12 +226,11 @@ StyleResourceData::StyleResourceData() inline StyleResourceData::StyleResourceData(const StyleResourceData& other) : RefCounted<StyleResourceData>() , clipper(other.clipper) - , filter(other.filter) , masker(other.masker) { } -PassRef<StyleResourceData> StyleResourceData::copy() const +Ref<StyleResourceData> StyleResourceData::copy() const { return adoptRef(*new StyleResourceData(*this)); } @@ -247,7 +238,6 @@ PassRef<StyleResourceData> StyleResourceData::copy() const bool StyleResourceData::operator==(const StyleResourceData& other) const { return clipper == other.clipper - && filter == other.filter && masker == other.masker; } @@ -266,7 +256,7 @@ inline StyleInheritedResourceData::StyleInheritedResourceData(const StyleInherit { } -PassRef<StyleInheritedResourceData> StyleInheritedResourceData::copy() const +Ref<StyleInheritedResourceData> StyleInheritedResourceData::copy() const { return adoptRef(*new StyleInheritedResourceData(*this)); } @@ -278,6 +268,43 @@ bool StyleInheritedResourceData::operator==(const StyleInheritedResourceData& ot && markerEnd == other.markerEnd; } +StyleLayoutData::StyleLayoutData() + : cx(RenderStyle::initialZeroLength()) + , cy(RenderStyle::initialZeroLength()) + , r(RenderStyle::initialZeroLength()) + , rx(RenderStyle::initialZeroLength()) + , ry(RenderStyle::initialZeroLength()) + , x(RenderStyle::initialZeroLength()) + , y(RenderStyle::initialZeroLength()) +{ +} + +inline StyleLayoutData::StyleLayoutData(const StyleLayoutData& other) + : RefCounted<StyleLayoutData>() + , cx(other.cx) + , cy(other.cy) + , r(other.r) + , rx(other.rx) + , ry(other.ry) + , x(other.x) + , y(other.y) +{ +} + +Ref<StyleLayoutData> StyleLayoutData::copy() const +{ + return adoptRef(*new StyleLayoutData(*this)); +} + +bool StyleLayoutData::operator==(const StyleLayoutData& other) const +{ + return cx == other.cx + && cy == other.cy + && r == other.r + && rx == other.rx + && ry == other.ry + && x == other.x + && y == other.y; } -#endif // ENABLE(SVG) +} |