Commit da36125d authored by gyuyoung.kim@samsung.com's avatar gyuyoung.kim@samsung.com
Browse files

Introduce toSVGRadialGradientElement(), and use it

https://bugs.webkit.org/show_bug.cgi?id=120153

Reviewed by Andreas Kling.

As a step to clean-up static_cast<SVGXXX>, toSVGRadialGradientElement() is added to clean-up
static_cast<SVGRadialGradientElement*>.

* rendering/svg/RenderSVGResourceRadialGradient.cpp:
(WebCore::RenderSVGResourceRadialGradient::collectGradientAttributes):
* rendering/svg/SVGRenderTreeAsText.cpp:
(WebCore::writeSVGResourceContainer):
* svg/SVGRadialGradientElement.cpp:
(WebCore::SVGRadialGradientElement::collectGradientAttributes):
* svg/SVGRadialGradientElement.h:
(WebCore::toSVGRadialGradientElement):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154440 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 82857b28
2013-08-22 Gyuyoung Kim <gyuyoung.kim@samsung.com>
Introduce toSVGRadialGradientElement(), and use it
https://bugs.webkit.org/show_bug.cgi?id=120153
Reviewed by Andreas Kling.
As a step to clean-up static_cast<SVGXXX>, toSVGRadialGradientElement() is added to clean-up
static_cast<SVGRadialGradientElement*>.
* rendering/svg/RenderSVGResourceRadialGradient.cpp:
(WebCore::RenderSVGResourceRadialGradient::collectGradientAttributes):
* rendering/svg/SVGRenderTreeAsText.cpp:
(WebCore::writeSVGResourceContainer):
* svg/SVGRadialGradientElement.cpp:
(WebCore::SVGRadialGradientElement::collectGradientAttributes):
* svg/SVGRadialGradientElement.h:
(WebCore::toSVGRadialGradientElement):
2013-08-22 Renata Hodovan <reni@webkit.org>
 
ASSERTION FAILED: extractedStyle in WebCore::ApplyStyleCommand::removeInlineStyleFromElement
......@@ -43,7 +43,7 @@ RenderSVGResourceRadialGradient::~RenderSVGResourceRadialGradient()
bool RenderSVGResourceRadialGradient::collectGradientAttributes(SVGGradientElement* gradientElement)
{
m_attributes = RadialGradientAttributes();
return static_cast<SVGRadialGradientElement*>(gradientElement)->collectGradientAttributes(m_attributes);
return toSVGRadialGradientElement(gradientElement)->collectGradientAttributes(m_attributes);
}
FloatPoint RenderSVGResourceRadialGradient::centerPoint(const RadialGradientAttributes& attributes) const
......
......@@ -564,10 +564,8 @@ void writeSVGResourceContainer(TextStream& ts, const RenderObject& object, int i
// Dump final results that are used for rendering. No use in asking SVGGradientElement for its gradientUnits(), as it may
// link to other gradients using xlink:href, we need to build the full inheritance chain, aka. collectGradientProperties()
SVGRadialGradientElement* radialGradientElement = static_cast<SVGRadialGradientElement*>(gradient->node());
RadialGradientAttributes attributes;
radialGradientElement->collectGradientAttributes(attributes);
toSVGRadialGradientElement(gradient->node())->collectGradientAttributes(attributes);
writeCommonGradientProperties(ts, attributes.spreadMethod(), attributes.gradientTransform(), attributes.gradientUnits());
FloatPoint focalPoint = gradient->focalPoint(attributes);
......
......@@ -165,7 +165,7 @@ bool SVGRadialGradientElement::collectGradientAttributes(RadialGradientAttribute
}
if (isRadial) {
SVGRadialGradientElement* radial = static_cast<SVGRadialGradientElement*>(current);
SVGRadialGradientElement* radial = toSVGRadialGradientElement(current);
if (!attributes.hasCx() && current->hasAttribute(SVGNames::cxAttr))
attributes.setCx(radial->cx());
......
......@@ -24,6 +24,7 @@
#if ENABLE(SVG)
#include "SVGAnimatedLength.h"
#include "SVGGradientElement.h"
#include "SVGNames.h"
namespace WebCore {
......@@ -56,6 +57,12 @@ private:
END_DECLARE_ANIMATED_PROPERTIES
};
inline SVGRadialGradientElement* toSVGRadialGradientElement(Node* node)
{
ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::radialGradientTag));
return static_cast<SVGRadialGradientElement*>(node);
}
} // namespace WebCore
#endif // ENABLE(SVG)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment