Introduce toSVGPatternElement(), use it

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

Reviewed by Andreas Kling.

As a step to change static_cast with toSVGXXX, static_cast<SVGPatternElement*> can
be changed with toSVGPatternElement().

Merge from https://src.chromium.org/viewvc/blink?view=rev&revision=154734

* rendering/svg/RenderSVGResourcePattern.cpp:
(WebCore::RenderSVGResourcePattern::buildPattern):
* rendering/svg/SVGRenderTreeAsText.cpp:
(WebCore::writeSVGResourceContainer):
* rendering/svg/SVGResources.cpp:
(WebCore::targetReferenceFromResource):
* svg/SVGPatternElement.h:
(WebCore::toSVGPatternElement):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 237b1464
2013-07-24 Gyuyoung Kim <gyuyoung.kim@samsung.com>
Introduce toSVGPatternElement(), use it
https://bugs.webkit.org/show_bug.cgi?id=119013
Reviewed by Andreas Kling.
As a step to change static_cast with toSVGXXX, static_cast<SVGPatternElement*> can
be changed with toSVGPatternElement().
Merge from https://src.chromium.org/viewvc/blink?view=rev&revision=154734
* rendering/svg/RenderSVGResourcePattern.cpp:
(WebCore::RenderSVGResourcePattern::buildPattern):
* rendering/svg/SVGRenderTreeAsText.cpp:
(WebCore::writeSVGResourceContainer):
* rendering/svg/SVGResources.cpp:
(WebCore::targetReferenceFromResource):
* svg/SVGPatternElement.h:
(WebCore::toSVGPatternElement):
2013-06-21 Mark Lam <mark.lam@apple.com>
Fixed broken build: updated to match SmallStrings changes in r151864.
......@@ -61,7 +61,7 @@ PatternData* RenderSVGResourcePattern::buildPattern(RenderObject* object, unsign
if (currentData && currentData->pattern)
return currentData;
SVGPatternElement* patternElement = static_cast<SVGPatternElement*>(node());
SVGPatternElement* patternElement = toSVGPatternElement(node());
if (!patternElement)
return 0;
......
......@@ -538,7 +538,7 @@ void writeSVGResourceContainer(TextStream& ts, const RenderObject& object, int i
// Dump final results that are used for rendering. No use in asking SVGPatternElement for its patternUnits(), as it may
// link to other patterns using xlink:href, we need to build the full inheritance chain, aka. collectPatternProperties()
PatternAttributes attributes;
static_cast<SVGPatternElement*>(pattern->node())->collectPatternAttributes(attributes);
toSVGPatternElement(pattern->node())->collectPatternAttributes(attributes);
writeNameValuePair(ts, "patternUnits", attributes.patternUnits());
writeNameValuePair(ts, "patternContentUnits", attributes.patternContentUnits());
......
......@@ -144,7 +144,7 @@ static inline String targetReferenceFromResource(SVGElement* element)
{
String target;
if (element->hasTagName(SVGNames::patternTag))
target = static_cast<SVGPatternElement*>(element)->href();
target = toSVGPatternElement(element)->href();
else if (element->hasTagName(SVGNames::linearGradientTag) || element->hasTagName(SVGNames::radialGradientTag))
target = toSVGGradientElement(element)->href();
#if ENABLE(FILTERS)
......
......@@ -30,6 +30,7 @@
#include "SVGAnimatedTransformList.h"
#include "SVGExternalResourcesRequired.h"
#include "SVGFitToViewBox.h"
#include "SVGNames.h"
#include "SVGStyledElement.h"
#include "SVGTests.h"
#include "SVGURIReference.h"
......@@ -86,6 +87,12 @@ private:
virtual void synchronizeSystemLanguage() { SVGTests::synchronizeSystemLanguage(this); }
};
inline SVGPatternElement* toSVGPatternElement(Node* node)
{
ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::patternTag));
return static_cast<SVGPatternElement*>(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