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 IntSize containerSize() const;
00071 bool hasSetContainerSize() const;
00072 int relativeWidthValue() const;
00073 int relativeHeightValue() const;
00074
00075 float pixelUnitToMillimeterX() const;
00076 float pixelUnitToMillimeterY() const;
00077 float screenPixelToMillimeterX() const;
00078 float screenPixelToMillimeterY() const;
00079
00080 bool useCurrentView() const;
00081 void setUseCurrentView(bool currentView);
00082
00083 SVGViewSpec* currentView() const;
00084
00085 float currentScale() const;
00086 void setCurrentScale(float scale);
00087
00088 FloatPoint currentTranslate() const;
00089 void setCurrentTranslate(const FloatPoint&);
00090
00091
00092
00093 void pauseAnimations();
00094 void unpauseAnimations();
00095 bool animationsPaused() const;
00096
00097 float getCurrentTime() const;
00098 void setCurrentTime(float seconds);
00099
00100 unsigned long suspendRedraw(unsigned long max_wait_milliseconds);
00101 void unsuspendRedraw(unsigned long suspend_handle_id, ExceptionCode&);
00102 void unsuspendRedrawAll();
00103 void forceRedraw();
00104
00105 DOM::NodeListImpl* getIntersectionList(const FloatRect&, SVGElement* referenceElement);
00106 DOM::NodeListImpl* getEnclosureList(const FloatRect&, SVGElement* referenceElement);
00107 bool checkIntersection(SVGElement*, const FloatRect&);
00108 bool checkEnclosure(SVGElement*, const FloatRect&);
00109 void deselectAll();
00110
00111 static float createSVGNumber();
00112 static SVGLength createSVGLength();
00113 static SVGAngle* createSVGAngle();
00114 static FloatPoint createSVGPoint();
00115 static AffineTransform createSVGMatrix();
00116 static FloatRect createSVGRect();
00117 static SVGTransform createSVGTransform();
00118 static SVGTransform createSVGTransformFromMatrix(const AffineTransform&);
00119
00120 virtual void parseMappedAttribute(MappedAttribute*);
00121
00122
00123 virtual AffineTransform getCTM() const;
00124 virtual AffineTransform getScreenCTM() const;
00125
00126 virtual bool rendererIsNeeded(RenderStyle* style) { return StyledElement::rendererIsNeeded(style); }
00127 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
00128
00129 virtual void insertedIntoDocument();
00130 virtual void removedFromDocument();
00131
00132 virtual void svgAttributeChanged(const QualifiedName&);
00133
00134 virtual AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const;
00135
00136
00137
00138
00139 virtual quint32 id() const;
00140 protected:
00141 virtual const SVGElement* contextElement() const { return this; }
00142
00143 friend class RenderSVGRoot;
00144
00145
00146 virtual bool hasRelativeValues() const;
00147
00148 bool isOutermostSVG() const;
00149
00150 private:
00151 void addSVGWindowEventListener(const AtomicString& eventType, const Attribute* attr);
00152
00153 ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
00154 ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGFitToViewBox, FloatRect, ViewBox, viewBox)
00155 ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGFitToViewBox, SVGPreserveAspectRatio*, PreserveAspectRatio, preserveAspectRatio)
00156
00157 ANIMATED_PROPERTY_DECLARATIONS(SVGSVGElement, SVGLength, SVGLength, X, x)
00158 ANIMATED_PROPERTY_DECLARATIONS(SVGSVGElement, SVGLength, SVGLength, Y, y)
00159 ANIMATED_PROPERTY_DECLARATIONS(SVGSVGElement, SVGLength, SVGLength, Width, width)
00160 ANIMATED_PROPERTY_DECLARATIONS(SVGSVGElement, SVGLength, SVGLength, Height, height)
00161
00162 virtual void willSaveToCache();
00163 virtual void willRestoreFromCache();
00164
00165 bool m_useCurrentView;
00166
00167 FloatPoint m_translation;
00168 mutable OwnPtr<SVGViewSpec> m_viewSpec;
00169 };
00170
00171 }
00172
00173 #endif // ENABLE(SVG)
00174 #endif
00175
00176