Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / core / svg / SVGSVGElement.h
blobdfa5822200e43176e9017361661fabfa82d0b7b5
1 /*
2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Rob Buis <buis@kde.org>
4 * Copyright (C) 2014 Google, Inc.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
22 #ifndef SVGSVGElement_h
23 #define SVGSVGElement_h
25 #include "core/svg/SVGAnimatedBoolean.h"
26 #include "core/svg/SVGAnimatedLength.h"
27 #include "core/svg/SVGFitToViewBox.h"
28 #include "core/svg/SVGGraphicsElement.h"
29 #include "core/svg/SVGLengthTearOff.h"
30 #include "core/svg/SVGPointTearOff.h"
31 #include "core/svg/SVGZoomAndPan.h"
32 #include "platform/heap/Handle.h"
34 namespace blink {
36 class SVGMatrixTearOff;
37 class SVGAngleTearOff;
38 class SVGNumberTearOff;
39 class SVGTransformTearOff;
40 class SVGViewSpec;
41 class SVGViewElement;
42 class SMILTimeContainer;
44 class SVGSVGElement final : public SVGGraphicsElement,
45 public SVGFitToViewBox,
46 public SVGZoomAndPan {
47 DEFINE_WRAPPERTYPEINFO();
48 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SVGSVGElement);
49 public:
50 DECLARE_NODE_FACTORY(SVGSVGElement);
52 #if !ENABLE(OILPAN)
53 using SVGGraphicsElement::ref;
54 using SVGGraphicsElement::deref;
55 #endif
57 // 'SVGSVGElement' functions
58 PassRefPtrWillBeRawPtr<SVGRectTearOff> viewport() const;
60 float pixelUnitToMillimeterX() const;
61 float pixelUnitToMillimeterY() const;
62 float screenPixelToMillimeterX() const;
63 float screenPixelToMillimeterY() const;
65 bool useCurrentView() const { return m_useCurrentView; }
66 SVGViewSpec* currentView();
68 Length intrinsicWidth() const;
69 Length intrinsicHeight() const;
70 FloatSize currentViewportSize() const;
71 FloatRect currentViewBoxRect() const;
73 float currentScale() const;
74 void setCurrentScale(float scale);
76 FloatPoint currentTranslate() { return m_translation->value(); }
77 void setCurrentTranslate(const FloatPoint&);
78 PassRefPtrWillBeRawPtr<SVGPointTearOff> currentTranslateFromJavascript();
80 SMILTimeContainer* timeContainer() const { return m_timeContainer.get(); }
82 void pauseAnimations();
83 void unpauseAnimations();
84 bool animationsPaused() const;
86 float getCurrentTime() const;
87 void setCurrentTime(float seconds);
89 // Stubs for the deprecated 'redraw' interface.
90 unsigned suspendRedraw(unsigned) { return 1; }
91 void unsuspendRedraw(unsigned) { }
92 void unsuspendRedrawAll() { }
93 void forceRedraw() { }
95 PassRefPtrWillBeRawPtr<StaticNodeList> getIntersectionList(PassRefPtrWillBeRawPtr<SVGRectTearOff>, SVGElement* referenceElement) const;
96 PassRefPtrWillBeRawPtr<StaticNodeList> getEnclosureList(PassRefPtrWillBeRawPtr<SVGRectTearOff>, SVGElement* referenceElement) const;
97 bool checkIntersection(SVGElement*, PassRefPtrWillBeRawPtr<SVGRectTearOff>) const;
98 bool checkEnclosure(SVGElement*, PassRefPtrWillBeRawPtr<SVGRectTearOff>) const;
99 void deselectAll();
101 static PassRefPtrWillBeRawPtr<SVGNumberTearOff> createSVGNumber();
102 static PassRefPtrWillBeRawPtr<SVGLengthTearOff> createSVGLength();
103 static PassRefPtrWillBeRawPtr<SVGAngleTearOff> createSVGAngle();
104 static PassRefPtrWillBeRawPtr<SVGPointTearOff> createSVGPoint();
105 static PassRefPtrWillBeRawPtr<SVGMatrixTearOff> createSVGMatrix();
106 static PassRefPtrWillBeRawPtr<SVGRectTearOff> createSVGRect();
107 static PassRefPtrWillBeRawPtr<SVGTransformTearOff> createSVGTransform();
108 static PassRefPtrWillBeRawPtr<SVGTransformTearOff> createSVGTransformFromMatrix(PassRefPtrWillBeRawPtr<SVGMatrixTearOff>);
110 AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const;
112 void setupInitialView(const String& fragmentIdentifier, Element* anchorNode);
113 bool zoomAndPanEnabled() const;
115 bool hasIntrinsicWidth() const;
116 bool hasIntrinsicHeight() const;
118 SVGAnimatedLength* x() const { return m_x.get(); }
119 SVGAnimatedLength* y() const { return m_y.get(); }
120 SVGAnimatedLength* width() const { return m_width.get(); }
121 SVGAnimatedLength* height() const { return m_height.get(); }
123 DECLARE_VIRTUAL_TRACE();
125 private:
126 explicit SVGSVGElement(Document&);
127 ~SVGSVGElement() override;
129 void parseAttribute(const QualifiedName&, const AtomicString&) override;
130 bool isPresentationAttribute(const QualifiedName&) const override;
131 bool isPresentationAttributeWithSVGDOM(const QualifiedName&) const override;
132 void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStylePropertySet*) override;
134 bool layoutObjectIsNeeded(const ComputedStyle&) override;
135 LayoutObject* createLayoutObject(const ComputedStyle&) override;
137 InsertionNotificationRequest insertedInto(ContainerNode*) override;
138 void removedFrom(ContainerNode*) override;
140 void svgAttributeChanged(const QualifiedName&) override;
142 bool selfHasRelativeLengths() const override;
144 void inheritViewAttributes(SVGViewElement*);
146 void updateCurrentTranslate();
148 void finishParsingChildren() override;
150 enum CheckIntersectionOrEnclosure {
151 CheckIntersection,
152 CheckEnclosure
155 bool checkIntersectionOrEnclosure(const SVGElement&, const FloatRect&, CheckIntersectionOrEnclosure) const;
156 PassRefPtrWillBeRawPtr<StaticNodeList> collectIntersectionOrEnclosureList(const FloatRect&, SVGElement*, CheckIntersectionOrEnclosure) const;
158 RefPtrWillBeMember<SVGAnimatedLength> m_x;
159 RefPtrWillBeMember<SVGAnimatedLength> m_y;
160 RefPtrWillBeMember<SVGAnimatedLength> m_width;
161 RefPtrWillBeMember<SVGAnimatedLength> m_height;
163 AffineTransform localCoordinateSpaceTransform(SVGElement::CTMScope) const override;
165 bool m_useCurrentView;
166 RefPtrWillBeMember<SMILTimeContainer> m_timeContainer;
167 RefPtrWillBeMember<SVGPoint> m_translation;
168 RefPtrWillBeMember<SVGViewSpec> m_viewSpec;
170 friend class SVGCurrentTranslateTearOff;
173 } // namespace blink
175 #endif // SVGSVGElement_h