KHTML
SVGSVGElement.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef SVGSVGElement_h
00024 #define SVGSVGElement_h
00025
00026 #if ENABLE(SVG)
00027
00028 #include "FloatRect.h"
00029
00030 #include "IntSize.h"
00031 #include "SVGExternalResourcesRequired.h"
00032 #include "SVGFitToViewBox.h"
00033 #include "SVGLangSpace.h"
00034 #include "SVGStyledLocatableElement.h"
00035 #include "SVGTests.h"
00036 #include "SVGZoomAndPan.h"
00037
00038 namespace WebCore
00039 {
00040 class SVGAngle;
00041 class SVGLength;
00042 class SVGTransform;
00043 class SVGViewSpec;
00044
00045
00046 class SVGSVGElement : public SVGStyledLocatableElement,
00047 public SVGTests,
00048 public SVGLangSpace,
00049 public SVGExternalResourcesRequired,
00050 public SVGFitToViewBox,
00051 public SVGZoomAndPan
00052 {
00053 public:
00054 SVGSVGElement(const QualifiedName&, Document*);
00055 virtual ~SVGSVGElement();
00056
00057 virtual bool isSVG() const { return true; }
00058
00059 virtual bool isValid() const { return SVGTests::isValid(); }
00060
00061
00062 const AtomicString& contentScriptType() const;
00063 void setContentScriptType(const AtomicString& type);
00064
00065 const AtomicString& contentStyleType() const;
00066 void setContentStyleType(const AtomicString& type);
00067
00068 FloatRect viewport() const;
00069
00070 void setContainerSize(const IntSize& containerSize) { m_containerSize = containerSize; m_hasSetContainerSize = true; }
00071 IntSize containerSize() const { return m_containerSize; }
00072 bool hasSetContainerSize() const { return m_hasSetContainerSize; }
00073 int relativeWidthValue() const;
00074 int relativeHeightValue() const;
00075
00076 float pixelUnitToMillimeterX() const;
00077 float pixelUnitToMillimeterY() const;
00078 float screenPixelToMillimeterX() const;
00079 float screenPixelToMillimeterY() const;
00080
00081 bool useCurrentView() const;
00082 void setUseCurrentView(bool currentView);
00083
00084 SVGViewSpec* currentView() const;
00085
00086 float currentScale() const;
00087 void setCurrentScale(float scale);
00088
00089 FloatPoint currentTranslate() const;
00090 void setCurrentTranslate(const FloatPoint&);
00091
00092
00093
00094 void pauseAnimations();
00095 void unpauseAnimations();
00096 bool animationsPaused() const;
00097
00098 float getCurrentTime() const;
00099 void setCurrentTime(float seconds);
00100
00101 unsigned long suspendRedraw(unsigned long max_wait_milliseconds);
00102 void unsuspendRedraw(unsigned long suspend_handle_id, ExceptionCode&);
00103 void unsuspendRedrawAll();
00104 void forceRedraw();
00105
00106 NodeList* getIntersectionList(const FloatRect&, SVGElement* referenceElement);
00107 NodeList* getEnclosureList(const FloatRect&, SVGElement* referenceElement);
00108 bool checkIntersection(SVGElement*, const FloatRect&);
00109 bool checkEnclosure(SVGElement*, const FloatRect&);
00110 void deselectAll();
00111
00112 static float createSVGNumber();
00113 static SVGLength createSVGLength();
00114 static SVGAngle* createSVGAngle();
00115 static FloatPoint createSVGPoint();
00116 static AffineTransform createSVGMatrix();
00117 static FloatRect createSVGRect();
00118 static SVGTransform createSVGTransform();
00119 static SVGTransform createSVGTransformFromMatrix(const AffineTransform&);
00120
00121 virtual void parseMappedAttribute(MappedAttribute*);
00122
00123
00124 virtual AffineTransform getCTM() const;
00125 virtual AffineTransform getScreenCTM() const;
00126
00127 virtual bool rendererIsNeeded(RenderStyle* style) { return StyledElement::rendererIsNeeded(style); }
00128 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
00129
00130 virtual void insertedIntoDocument();
00131 virtual void removedFromDocument();
00132
00133 virtual void svgAttributeChanged(const QualifiedName&);
00134
00135 virtual AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const;
00136
00137
00138
00139
00140 virtual quint32 id() const;
00141 virtual DOMString tagName() const { return SVGNames::svgTag.tagName(); }
00142
00143
00144 protected:
00145 virtual const SVGElement* contextElement() const { return this; }
00146
00147 friend class RenderSVGRoot;
00148
00149
00150 virtual bool hasRelativeValues() const;
00151
00152 bool isOutermostSVG() const;
00153
00154 private:
00155 void addSVGWindowEventListener(const AtomicString& eventType, const Attribute* attr);
00156
00157 ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
00158 ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGFitToViewBox, FloatRect, ViewBox, viewBox)
00159 ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGFitToViewBox, SVGPreserveAspectRatio*, PreserveAspectRatio, preserveAspectRatio)
00160
00161 ANIMATED_PROPERTY_DECLARATIONS(SVGSVGElement, SVGLength, SVGLength, X, x)
00162 ANIMATED_PROPERTY_DECLARATIONS(SVGSVGElement, SVGLength, SVGLength, Y, y)
00163 ANIMATED_PROPERTY_DECLARATIONS(SVGSVGElement, SVGLength, SVGLength, Width, width)
00164 ANIMATED_PROPERTY_DECLARATIONS(SVGSVGElement, SVGLength, SVGLength, Height, height)
00165
00166 virtual void willSaveToCache();
00167 virtual void willRestoreFromCache();
00168
00169 bool m_useCurrentView;
00170
00171 FloatPoint m_translation;
00172 mutable OwnPtr<SVGViewSpec> m_viewSpec;
00173 IntSize m_containerSize;
00174 bool m_hasSetContainerSize;
00175 };
00176
00177 }
00178
00179 #endif // ENABLE(SVG)
00180 #endif
00181
00182