KHtml

SVGSVGElement.h
1 /*
2  Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <[email protected]>
3  2004, 2005, 2006, 2007 Rob Buis <[email protected]>
4 
5  This file is part of the KDE project
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
22 
23 #ifndef SVGSVGElement_h
24 #define SVGSVGElement_h
25 
26 #if ENABLE(SVG)
27 
28 #include "FloatRect.h"
29 
30 #include "IntSize.h"
31 #include "SVGExternalResourcesRequired.h"
32 #include "SVGFitToViewBox.h"
33 #include "SVGLangSpace.h"
34 #include "SVGStyledLocatableElement.h"
35 #include "SVGTests.h"
36 #include "SVGZoomAndPan.h"
37 
38 namespace WebCore
39 {
40 class SVGAngle;
41 class SVGLength;
42 class SVGTransform;
43 class SVGViewSpec;
44 /*class SVGViewElement;
45 class SMILTimeContainer;*/
46 class SVGSVGElement : public SVGStyledLocatableElement,
47  public SVGTests,
48  public SVGLangSpace,
49  public SVGExternalResourcesRequired,
50  public SVGFitToViewBox,
51  public SVGZoomAndPan
52 {
53 public:
54  SVGSVGElement(const QualifiedName &, Document *);
55  virtual ~SVGSVGElement();
56 
57  bool isSVG() const override
58  {
59  return true;
60  }
61 
62  bool isValid() const override
63  {
64  return SVGTests::isValid();
65  }
66 
67  // 'SVGSVGElement' functions
68  DOMString contentScriptType() const;
69  void setContentScriptType(const DOMString &type);
70 
71  DOMString contentStyleType() const;
72  void setContentStyleType(const DOMString &type);
73 
74  FloatRect viewport() const;
75 
76  IntSize containerSize() const;
77  bool hasSetContainerSize() const;
78  int relativeWidthValue() const;
79  int relativeHeightValue() const;
80 
81  float pixelUnitToMillimeterX() const;
82  float pixelUnitToMillimeterY() const;
83  float screenPixelToMillimeterX() const;
84  float screenPixelToMillimeterY() const;
85 
86  bool useCurrentView() const;
87  void setUseCurrentView(bool currentView);
88 
89  SVGViewSpec *currentView() const;
90 
91  float currentScale() const;
92  void setCurrentScale(float scale);
93 
94  FloatPoint currentTranslate() const;
95  void setCurrentTranslate(const FloatPoint &);
96 
97  /*SMILTimeContainer* timeContainer() const { return m_timeContainer.get(); }*/
98 
99  void pauseAnimations();
100  void unpauseAnimations();
101  bool animationsPaused() const;
102 
103  float getCurrentTime() const;
104  void setCurrentTime(float seconds);
105 
106  unsigned long suspendRedraw(unsigned long max_wait_milliseconds);
107  void unsuspendRedraw(unsigned long suspend_handle_id, ExceptionCode &);
108  void unsuspendRedrawAll();
109  void forceRedraw();
110 
111  DOM::NodeListImpl *getIntersectionList(const FloatRect &, SVGElement *referenceElement);
112  DOM::NodeListImpl *getEnclosureList(const FloatRect &, SVGElement *referenceElement);
113  bool checkIntersection(SVGElement *, const FloatRect &);
114  bool checkEnclosure(SVGElement *, const FloatRect &);
115  void deselectAll();
116 
117  static float createSVGNumber();
118  static SVGLength createSVGLength();
119  static SVGAngle *createSVGAngle();
120  static FloatPoint createSVGPoint();
121  static AffineTransform createSVGMatrix();
122  static FloatRect createSVGRect();
123  static SVGTransform createSVGTransform();
124  static SVGTransform createSVGTransformFromMatrix(const AffineTransform &);
125 
126  void parseMappedAttribute(MappedAttribute *) override;
127 
128  // 'virtual SVGLocatable' functions
129  AffineTransform getCTM() const override;
130  AffineTransform getScreenCTM() const override;
131 
132  bool rendererIsNeeded(RenderStyle *style) override
133  {
134  return StyledElement::rendererIsNeeded(style);
135  }
136  RenderObject *createRenderer(RenderArena *, RenderStyle *) override;
137 
138  void insertedIntoDocument() override;
139  void removedFromDocument() override;
140 
141  void svgAttributeChanged(const QualifiedName &) override;
142 
143  AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const override;
144 
145  //void inheritViewAttributes(SVGViewElement*);
146 
147  // KHTML ElementImpl pure virtual method
148  quint32 id() const override;
149 protected:
150  const SVGElement *contextElement() const override
151  {
152  return this;
153  }
154 
155  friend class RenderSVGRoot;
156  /*friend class RenderSVGViewportContainer;*/
157 
158  bool hasRelativeValues() const override;
159 
160  bool isOutermostSVG() const;
161 
162 private:
163  void addSVGWindowEventListener(const AtomicString &eventType, const Attribute *attr);
164 
165  ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
166  ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGFitToViewBox, FloatRect, ViewBox, viewBox)
167  ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGFitToViewBox, SVGPreserveAspectRatio *, PreserveAspectRatio, preserveAspectRatio)
168 
169  ANIMATED_PROPERTY_DECLARATIONS(SVGSVGElement, SVGLength, SVGLength, X, x)
170  ANIMATED_PROPERTY_DECLARATIONS(SVGSVGElement, SVGLength, SVGLength, Y, y)
171  ANIMATED_PROPERTY_DECLARATIONS(SVGSVGElement, SVGLength, SVGLength, Width, width)
172  ANIMATED_PROPERTY_DECLARATIONS(SVGSVGElement, SVGLength, SVGLength, Height, height)
173 
174  virtual void willSaveToCache();
175  virtual void willRestoreFromCache();
176 
177  bool m_useCurrentView;
178  /*RefPtr<SMILTimeContainer> m_timeContainer;*/
179  FloatPoint m_translation;
180  mutable OwnPtr<SVGViewSpec> m_viewSpec;
181 };
182 
183 } // namespace WebCore
184 
185 #endif // ENABLE(SVG)
186 #endif
187 
bool isValid(QStringView ifopt)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Oct 16 2021 22:48:02 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.