• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KHTML

SVGTextElement.cpp

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
00003                   2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
00004 
00005     This file is part of the KDE project
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Library General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Library General Public License for more details.
00016 
00017     You should have received a copy of the GNU Library General Public License
00018     along with this library; see the file COPYING.LIB.  If not, write to
00019     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020     Boston, MA 02110-1301, USA.
00021 */
00022 
00023 #include "config.h"
00024 #include "wtf/Platform.h"
00025 
00026 #if ENABLE(SVG)
00027 #include "SVGTextElement.h"
00028 
00029 #include "AffineTransform.h"
00030 #include "FloatRect.h"
00031 #include "RenderSVGText.h"
00032 #include "SVGLengthList.h"
00033 #include "SVGRenderStyle.h"
00034 #include "SVGTSpanElement.h"
00035 #include "SVGTransformList.h"
00036 
00037 namespace WebCore {
00038 
00039 SVGTextElement::SVGTextElement(const QualifiedName& tagName, Document* doc)
00040     : SVGTextPositioningElement(tagName, doc)
00041     , SVGTransformable()
00042     , m_transform(SVGTransformList::create(SVGNames::transformAttr))
00043 {
00044 }
00045 
00046 SVGTextElement::~SVGTextElement()
00047 {
00048 }
00049 
00050 ANIMATED_PROPERTY_DEFINITIONS(SVGTextElement, SVGTransformList*, TransformList, transformList, Transform, transform, SVGNames::transformAttr, m_transform.get())
00051 
00052 void SVGTextElement::parseMappedAttribute(MappedAttribute* attr)
00053 {
00054     if (attr->name() == SVGNames::transformAttr) {
00055         SVGTransformList* localTransforms = transformBaseValue();
00056 
00057         ExceptionCode ec = 0;
00058         localTransforms->clear(ec);
00059 
00060         if (!SVGTransformable::parseTransformAttribute(localTransforms, attr->value()))
00061             localTransforms->clear(ec);
00062         else {
00063             setTransformBaseValue(localTransforms);
00064             if (renderer())
00065                 renderer()->setNeedsLayout(true); // should be in setTransformBaseValue
00066         }
00067     } else
00068         SVGTextPositioningElement::parseMappedAttribute(attr);
00069 }
00070 
00071 SVGElement* SVGTextElement::nearestViewportElement() const
00072 {
00073     return SVGTransformable::nearestViewportElement(this);
00074 }
00075 
00076 SVGElement* SVGTextElement::farthestViewportElement() const
00077 {
00078     return SVGTransformable::farthestViewportElement(this);
00079 }
00080 
00081 FloatRect SVGTextElement::getBBox() const
00082 {
00083     return SVGTransformable::getBBox(this);
00084 }
00085 
00086 AffineTransform SVGTextElement::getScreenCTM() const
00087 {
00088     return SVGTransformable::getScreenCTM(this);
00089 }
00090 
00091 AffineTransform SVGTextElement::getCTM() const
00092 {
00093     return SVGTransformable::getCTM(this);
00094 }
00095 
00096 AffineTransform SVGTextElement::animatedLocalTransform() const
00097 {
00098     return m_supplementalTransform ? transform()->concatenate().matrix() * *m_supplementalTransform : transform()->concatenate().matrix();
00099 }
00100 
00101 AffineTransform* SVGTextElement::supplementalTransform()
00102 {
00103     if (!m_supplementalTransform)
00104         m_supplementalTransform.set(new AffineTransform());
00105     return m_supplementalTransform.get();
00106 }
00107 
00108 RenderObject* SVGTextElement::createRenderer(RenderArena* arena, RenderStyle* style)
00109 {
00110     kDebug() << "create renderer for <text>" << endl;
00111     return new (arena) RenderSVGText(this);
00112 }
00113 
00114 bool SVGTextElement::childShouldCreateRenderer(Node* child) const
00115 {
00116     if (child->isTextNode()
00117 #if ENABLE(SVG_FONTS)
00118         || child->hasTagName(SVGNames::altGlyphTag)
00119 #endif
00120         || child->hasTagName(SVGNames::tspanTag) || child->hasTagName(SVGNames::trefTag) || child->hasTagName(SVGNames::aTag) || child->hasTagName(SVGNames::textPathTag))
00121         return true;
00122     return false;
00123 }
00124 
00125 void SVGTextElement::svgAttributeChanged(const QualifiedName& attrName)
00126 {
00127     SVGTextPositioningElement::svgAttributeChanged(attrName);
00128 
00129     if (!renderer())
00130         return;
00131 
00132     if (SVGTextPositioningElement::isKnownAttribute(attrName))
00133         renderer()->setNeedsLayout(true);
00134 }
00135 
00136 }
00137 
00138 #endif // ENABLE(SVG)

KHTML

Skip menu "KHTML"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal