Home | History | Annotate | Download | only in svg
      1 /*
      2  * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann (at) kde.org>
      3  * Copyright (C) 2004, 2005, 2006, 2010 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 "SVGTSpanElement.h"
     25 
     26 #include "RenderInline.h"
     27 #include "RenderSVGTSpan.h"
     28 #include "SVGNames.h"
     29 
     30 namespace WebCore {
     31 
     32 inline SVGTSpanElement::SVGTSpanElement(const QualifiedName& tagName, Document* document)
     33     : SVGTextPositioningElement(tagName, document)
     34 {
     35 }
     36 
     37 PassRefPtr<SVGTSpanElement> SVGTSpanElement::create(const QualifiedName& tagName, Document* document)
     38 {
     39     return adoptRef(new SVGTSpanElement(tagName, document));
     40 }
     41 
     42 RenderObject* SVGTSpanElement::createRenderer(RenderArena* arena, RenderStyle*)
     43 {
     44     return new (arena) RenderSVGTSpan(this);
     45 }
     46 
     47 bool SVGTSpanElement::childShouldCreateRenderer(Node* child) const
     48 {
     49     if (child->isTextNode()
     50         || child->hasTagName(SVGNames::aTag)
     51 #if ENABLE(SVG_FONTS)
     52         || child->hasTagName(SVGNames::altGlyphTag)
     53 #endif
     54         || child->hasTagName(SVGNames::trefTag)
     55         || child->hasTagName(SVGNames::tspanTag))
     56         return true;
     57 
     58     return false;
     59 }
     60 
     61 bool SVGTSpanElement::rendererIsNeeded(RenderStyle* style)
     62 {
     63     if (parentNode()
     64         && (parentNode()->hasTagName(SVGNames::aTag)
     65 #if ENABLE(SVG_FONTS)
     66             || parentNode()->hasTagName(SVGNames::altGlyphTag)
     67 #endif
     68             || parentNode()->hasTagName(SVGNames::textTag)
     69             || parentNode()->hasTagName(SVGNames::textPathTag)
     70             || parentNode()->hasTagName(SVGNames::tspanTag)))
     71         return StyledElement::rendererIsNeeded(style);
     72 
     73     return false;
     74 }
     75 
     76 AttributeToPropertyTypeMap& SVGTSpanElement::attributeToPropertyTypeMap()
     77 {
     78     DEFINE_STATIC_LOCAL(AttributeToPropertyTypeMap, s_attributeToPropertyTypeMap, ());
     79     return s_attributeToPropertyTypeMap;
     80 }
     81 
     82 void SVGTSpanElement::fillAttributeToPropertyTypeMap()
     83 {
     84     SVGTextPositioningElement::fillPassedAttributeToPropertyTypeMap(attributeToPropertyTypeMap());
     85 }
     86 
     87 }
     88 
     89 #endif // ENABLE(SVG)
     90 
     91 // vim:ts=4:noet
     92