Home | History | Annotate | Download | only in svg
      1 /*
      2  * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann (at) kde.org>
      3  * Copyright (C) 2004, 2005, 2006, 2007 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 #ifndef SVGGraphicsElement_h
     22 #define SVGGraphicsElement_h
     23 
     24 #include "core/svg/SVGAnimatedTransformList.h"
     25 #include "core/svg/SVGElement.h"
     26 #include "core/svg/SVGTests.h"
     27 
     28 namespace WebCore {
     29 
     30 class AffineTransform;
     31 class Path;
     32 
     33 class SVGGraphicsElement : public SVGElement, public SVGTests {
     34 public:
     35     virtual ~SVGGraphicsElement();
     36 
     37     enum StyleUpdateStrategy { AllowStyleUpdate, DisallowStyleUpdate };
     38 
     39     AffineTransform getCTM(StyleUpdateStrategy = AllowStyleUpdate);
     40     AffineTransform getScreenCTM(StyleUpdateStrategy = AllowStyleUpdate);
     41     AffineTransform getTransformToElement(SVGElement*, ExceptionState&);
     42     SVGElement* nearestViewportElement() const;
     43     SVGElement* farthestViewportElement() const;
     44 
     45     virtual AffineTransform localCoordinateSpaceTransform(SVGElement::CTMScope) const OVERRIDE { return animatedLocalTransform(); }
     46     virtual AffineTransform animatedLocalTransform() const;
     47     virtual AffineTransform* supplementalTransform();
     48 
     49     virtual SVGRect getBBox();
     50     SVGRect getStrokeBBox();
     51 
     52     // "base class" methods for all the elements which render as paths
     53     virtual void toClipPath(Path&);
     54     virtual RenderObject* createRenderer(RenderStyle*);
     55 
     56 protected:
     57     SVGGraphicsElement(const QualifiedName&, Document&, ConstructionType = CreateSVGElement);
     58 
     59     bool isSupportedAttribute(const QualifiedName&);
     60     virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
     61     virtual void svgAttributeChanged(const QualifiedName&);
     62 
     63     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGGraphicsElement)
     64         DECLARE_ANIMATED_TRANSFORM_LIST(Transform, transform)
     65     END_DECLARE_ANIMATED_PROPERTIES
     66 
     67 private:
     68     virtual bool isSVGGraphicsElement() const OVERRIDE { return true; }
     69 
     70     // SVGTests
     71     virtual void synchronizeRequiredFeatures() { SVGTests::synchronizeRequiredFeatures(this); }
     72     virtual void synchronizeRequiredExtensions() { SVGTests::synchronizeRequiredExtensions(this); }
     73     virtual void synchronizeSystemLanguage() { SVGTests::synchronizeSystemLanguage(this); }
     74 
     75     // Used by <animateMotion>
     76     OwnPtr<AffineTransform> m_supplementalTransform;
     77 };
     78 
     79 inline bool isSVGGraphicsElement(const Node& node)
     80 {
     81     return node.isSVGElement() && toSVGElement(node).isSVGGraphicsElement();
     82 }
     83 
     84 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(SVGGraphicsElement);
     85 
     86 } // namespace WebCore
     87 
     88 #endif // SVGGraphicsElement_h
     89