diff options
author | Konstantin Tokarev <annulen@yandex.ru> | 2016-08-25 19:20:41 +0300 |
---|---|---|
committer | Konstantin Tokarev <annulen@yandex.ru> | 2017-02-02 12:30:55 +0000 |
commit | 6882a04fb36642862b11efe514251d32070c3d65 (patch) | |
tree | b7959826000b061fd5ccc7512035c7478742f7b0 /Source/WebCore/svg/SVGSwitchElement.cpp | |
parent | ab6df191029eeeb0b0f16f127d553265659f739e (diff) | |
download | qtwebkit-6882a04fb36642862b11efe514251d32070c3d65.tar.gz |
Imported QtWebKit TP3 (git b57bc6801f1876c3220d5a4bfea33d620d477443)
Change-Id: I3b1d8a2808782c9f34d50240000e20cb38d3680f
Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/WebCore/svg/SVGSwitchElement.cpp')
-rw-r--r-- | Source/WebCore/svg/SVGSwitchElement.cpp | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/Source/WebCore/svg/SVGSwitchElement.cpp b/Source/WebCore/svg/SVGSwitchElement.cpp index 8518c3f64..d4ac300b1 100644 --- a/Source/WebCore/svg/SVGSwitchElement.cpp +++ b/Source/WebCore/svg/SVGSwitchElement.cpp @@ -19,11 +19,9 @@ */ #include "config.h" - -#if ENABLE(SVG) #include "SVGSwitchElement.h" -#include "NodeRenderingContext.h" +#include "ElementIterator.h" #include "RenderSVGTransformableContainer.h" #include "SVGNames.h" @@ -37,41 +35,34 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGSwitchElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) END_REGISTER_ANIMATED_PROPERTIES -inline SVGSwitchElement::SVGSwitchElement(const QualifiedName& tagName, Document* document) +inline SVGSwitchElement::SVGSwitchElement(const QualifiedName& tagName, Document& document) : SVGGraphicsElement(tagName, document) { ASSERT(hasTagName(SVGNames::switchTag)); registerAnimatedPropertiesForSVGSwitchElement(); } -PassRefPtr<SVGSwitchElement> SVGSwitchElement::create(const QualifiedName& tagName, Document* document) +Ref<SVGSwitchElement> SVGSwitchElement::create(const QualifiedName& tagName, Document& document) { - return adoptRef(new SVGSwitchElement(tagName, document)); + return adoptRef(*new SVGSwitchElement(tagName, document)); } -bool SVGSwitchElement::childShouldCreateRenderer(const NodeRenderingContext& childContext) const +bool SVGSwitchElement::childShouldCreateRenderer(const Node& child) const { - // FIXME: This function does not do what the comment below implies it does. - // It will create a renderer for any valid SVG element children, not just the first one. - for (Node* node = firstChild(); node; node = node->nextSibling()) { - if (!node->isSVGElement()) - continue; - - SVGElement* element = toSVGElement(node); - if (!element || !element->isValid()) + // We create a renderer for the first valid SVG element child. + // FIXME: The renderer must be updated after dynamic change of the requiredFeatures, requiredExtensions and systemLanguage attributes (https://bugs.webkit.org/show_bug.cgi?id=74749). + for (auto& element : childrenOfType<SVGElement>(*this)) { + if (!element.isValid()) continue; - - return node == childContext.node(); // Only allow this child if it's the first valid child + return &element == &child; // Only allow this child if it's the first valid child } return false; } -RenderObject* SVGSwitchElement::createRenderer(RenderArena* arena, RenderStyle*) +RenderPtr<RenderElement> SVGSwitchElement::createElementRenderer(Ref<RenderStyle>&& style, const RenderTreePosition&) { - return new (arena) RenderSVGTransformableContainer(this); + return createRenderer<RenderSVGTransformableContainer>(*this, WTFMove(style)); } } - -#endif // ENABLE(SVG) |