Home | History | Annotate | Download | only in svg
      1 /*
      2     Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann (at) kde.org>
      3                   2004, 2005, 2006 Rob Buis <buis (at) kde.org>
      4 
      5     This library is free software; you can redistribute it and/or
      6     modify it under the terms of the GNU Library General Public
      7     License as published by the Free Software Foundation; either
      8     version 2 of the License, or (at your option) any later version.
      9 
     10     This library is distributed in the hope that it will be useful,
     11     but WITHOUT ANY WARRANTY; without even the implied warranty of
     12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13     Library General Public License for more details.
     14 
     15     You should have received a copy of the GNU Library General Public License
     16     along with this library; see the file COPYING.LIB.  If not, write to
     17     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     18     Boston, MA 02110-1301, USA.
     19 */
     20 
     21 #include "config.h"
     22 
     23 #if ENABLE(SVG)
     24 #include "SVGGElement.h"
     25 
     26 #include "RenderSVGTransformableContainer.h"
     27 
     28 namespace WebCore {
     29 
     30 SVGGElement::SVGGElement(const QualifiedName& tagName, Document* doc)
     31     : SVGStyledTransformableElement(tagName, doc)
     32     , SVGTests()
     33     , SVGLangSpace()
     34     , SVGExternalResourcesRequired()
     35 {
     36 }
     37 
     38 SVGGElement::~SVGGElement()
     39 {
     40 }
     41 
     42 void SVGGElement::parseMappedAttribute(MappedAttribute* attr)
     43 {
     44     if (SVGTests::parseMappedAttribute(attr))
     45         return;
     46     if (SVGLangSpace::parseMappedAttribute(attr))
     47         return;
     48     if (SVGExternalResourcesRequired::parseMappedAttribute(attr))
     49         return;
     50 
     51     SVGStyledTransformableElement::parseMappedAttribute(attr);
     52 }
     53 
     54 void SVGGElement::svgAttributeChanged(const QualifiedName& attrName)
     55 {
     56     SVGStyledTransformableElement::svgAttributeChanged(attrName);
     57 
     58     if (!renderer())
     59         return;
     60 
     61     if (SVGTests::isKnownAttribute(attrName) ||
     62         SVGLangSpace::isKnownAttribute(attrName) ||
     63         SVGExternalResourcesRequired::isKnownAttribute(attrName) ||
     64         SVGStyledTransformableElement::isKnownAttribute(attrName))
     65         renderer()->setNeedsLayout(true);
     66 }
     67 
     68 void SVGGElement::synchronizeProperty(const QualifiedName& attrName)
     69 {
     70     SVGStyledTransformableElement::synchronizeProperty(attrName);
     71 
     72     if (attrName == anyQName() || SVGExternalResourcesRequired::isKnownAttribute(attrName))
     73         synchronizeExternalResourcesRequired();
     74 }
     75 
     76 void SVGGElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
     77 {
     78     SVGStyledTransformableElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
     79 
     80     if (renderer())
     81         renderer()->setNeedsLayout(true);
     82 }
     83 
     84 RenderObject* SVGGElement::createRenderer(RenderArena* arena, RenderStyle*)
     85 {
     86     return new (arena) RenderSVGTransformableContainer(this);
     87 }
     88 
     89 }
     90 
     91 #endif // ENABLE(SVG)
     92