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

Introduce toSVGLinearGradientElement(), and use it

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

Reviewed by Andreas Kling.

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

* rendering/svg/RenderSVGResourceLinearGradient.cpp:
(WebCore::RenderSVGResourceLinearGradient::collectGradientAttributes):
* rendering/svg/SVGRenderTreeAsText.cpp:
(WebCore::writeSVGResourceContainer):
* svg/SVGLinearGradientElement.cpp:
(WebCore::SVGLinearGradientElement::collectGradientAttributes):
* svg/SVGLinearGradientElement.h:
(WebCore::toSVGLinearGradientElement):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154472 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent af9d9722
2013-08-22 Gyuyoung Kim <gyuyoung.kim@samsung.com>
Introduce toSVGLinearGradientElement(), and use it
https://bugs.webkit.org/show_bug.cgi?id=120154
Reviewed by Andreas Kling.
As a step to clean-up static_cast<SVGXXX>, toSVGLinearGradientElement() is added to clean-up
static_cast<SVGLinearGradientElement*>.
* rendering/svg/RenderSVGResourceLinearGradient.cpp:
(WebCore::RenderSVGResourceLinearGradient::collectGradientAttributes):
* rendering/svg/SVGRenderTreeAsText.cpp:
(WebCore::writeSVGResourceContainer):
* svg/SVGLinearGradientElement.cpp:
(WebCore::SVGLinearGradientElement::collectGradientAttributes):
* svg/SVGLinearGradientElement.h:
(WebCore::toSVGLinearGradientElement):
2013-08-22 Simon Fraser <simon.fraser@apple.com>
 
compositing/geometry/bounds-ignores-hidden-dynamic.html has incorrect initial rendering
......@@ -42,7 +42,7 @@ RenderSVGResourceLinearGradient::~RenderSVGResourceLinearGradient()
bool RenderSVGResourceLinearGradient::collectGradientAttributes(SVGGradientElement* gradientElement)
{
m_attributes = LinearGradientAttributes();
return static_cast<SVGLinearGradientElement*>(gradientElement)->collectGradientAttributes(m_attributes);
return toSVGLinearGradientElement(gradientElement)->collectGradientAttributes(m_attributes);
}
FloatPoint RenderSVGResourceLinearGradient::startPoint(const LinearGradientAttributes& attributes) const
......
......@@ -552,7 +552,7 @@ 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()
SVGLinearGradientElement* linearGradientElement = static_cast<SVGLinearGradientElement*>(gradient->node());
SVGLinearGradientElement* linearGradientElement = toSVGLinearGradientElement(gradient->node());
LinearGradientAttributes attributes;
linearGradientElement->collectGradientAttributes(attributes);
......
......@@ -153,7 +153,7 @@ bool SVGLinearGradientElement::collectGradientAttributes(LinearGradientAttribute
}
if (isLinear) {
SVGLinearGradientElement* linear = static_cast<SVGLinearGradientElement*>(current);
SVGLinearGradientElement* linear = toSVGLinearGradientElement(current);
if (!attributes.hasX1() && current->hasAttribute(SVGNames::x1Attr))
attributes.setX1(linear->x1());
......
......@@ -24,6 +24,7 @@
#if ENABLE(SVG)
#include "SVGAnimatedLength.h"
#include "SVGGradientElement.h"
#include "SVGNames.h"
namespace WebCore {
......@@ -54,6 +55,12 @@ private:
END_DECLARE_ANIMATED_PROPERTIES
};
inline SVGLinearGradientElement* toSVGLinearGradientElement(Node* node)
{
ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::linearGradientTag));
return static_cast<SVGLinearGradientElement*>(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