summaryrefslogtreecommitdiffstats
path: root/WebCore/svg/SVGRectElement.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/svg/SVGRectElement.cpp')
-rw-r--r--WebCore/svg/SVGRectElement.cpp34
1 files changed, 26 insertions, 8 deletions
diff --git a/WebCore/svg/SVGRectElement.cpp b/WebCore/svg/SVGRectElement.cpp
index 43ba888..46ed8de 100644
--- a/WebCore/svg/SVGRectElement.cpp
+++ b/WebCore/svg/SVGRectElement.cpp
@@ -24,7 +24,7 @@
#include "SVGRectElement.h"
#include "Attribute.h"
-#include "RenderPath.h"
+#include "RenderSVGPath.h"
#include "RenderSVGResource.h"
#include "SVGLength.h"
#include "SVGNames.h"
@@ -94,7 +94,7 @@ void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName)
if (isLengthAttribute)
updateRelativeLengthsInformation();
- RenderPath* renderer = static_cast<RenderPath*>(this->renderer());
+ RenderSVGPath* renderer = static_cast<RenderSVGPath*>(this->renderer());
if (!renderer)
return;
@@ -147,19 +147,37 @@ void SVGRectElement::synchronizeProperty(const QualifiedName& attrName)
synchronizeExternalResourcesRequired();
}
-Path SVGRectElement::toPathData() const
+void SVGRectElement::toPathData(Path& path) const
{
- FloatRect rect(x().value(this), y().value(this), width().value(this), height().value(this));
+ ASSERT(path.isEmpty());
+
+ float widthValue = width().value(this);
+ if (widthValue <= 0)
+ return;
+
+ float heightValue = height().value(this);
+ if (heightValue <= 0)
+ return;
+
+ float xValue = x().value(this);
+ float yValue = y().value(this);
+
+ FloatRect rect(xValue, yValue, widthValue, heightValue);
bool hasRx = hasAttribute(SVGNames::rxAttr);
bool hasRy = hasAttribute(SVGNames::ryAttr);
if (hasRx || hasRy) {
- float _rx = hasRx ? rx().value(this) : ry().value(this);
- float _ry = hasRy ? ry().value(this) : rx().value(this);
- return Path::createRoundedRectangle(rect, FloatSize(_rx, _ry));
+ float rxValue = rx().value(this);
+ float ryValue = ry().value(this);
+ if (!hasRx)
+ rxValue = ryValue;
+ else if (!hasRy)
+ ryValue = rxValue;
+ path.addRoundedRect(rect, FloatSize(rxValue, ryValue));
+ return;
}
- return Path::createRectangle(rect);
+ path.addRect(rect);
}
bool SVGRectElement::selfHasRelativeLengths() const