2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4 * Copyright (C) 2014 Samsung Electronics. All rights reserved.
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 SVGZoomAndPan_h
23 #define SVGZoomAndPan_h
25 #include "core/SVGNames.h"
26 #include "core/dom/QualifiedName.h"
27 #include "wtf/HashSet.h"
33 enum SVGZoomAndPanType
{
34 SVGZoomAndPanUnknown
= 0,
41 // Forward declare enumerations in the W3C naming scheme, for IDL generation.
43 SVG_ZOOMANDPAN_UNKNOWN
= SVGZoomAndPanUnknown
,
44 SVG_ZOOMANDPAN_DISABLE
= SVGZoomAndPanDisable
,
45 SVG_ZOOMANDPAN_MAGNIFY
= SVGZoomAndPanMagnify
48 virtual ~SVGZoomAndPan() { }
50 static bool isKnownAttribute(const QualifiedName
&);
51 static void addSupportedAttributes(HashSet
<QualifiedName
>&);
53 static SVGZoomAndPanType
parseFromNumber(unsigned short number
)
55 if (!number
|| number
> SVGZoomAndPanMagnify
)
56 return SVGZoomAndPanUnknown
;
57 return static_cast<SVGZoomAndPanType
>(number
);
60 bool parseZoomAndPan(const LChar
*& start
, const LChar
* end
);
61 bool parseZoomAndPan(const UChar
*& start
, const UChar
* end
);
63 bool parseAttribute(const QualifiedName
& name
, const AtomicString
& value
)
65 if (name
== SVGNames::zoomAndPanAttr
) {
66 m_zoomAndPan
= SVGZoomAndPanUnknown
;
67 if (!value
.isEmpty()) {
69 const LChar
* start
= value
.characters8();
70 parseZoomAndPan(start
, start
+ value
.length());
72 const UChar
* start
= value
.characters16();
73 parseZoomAndPan(start
, start
+ value
.length());
83 SVGZoomAndPanType
zoomAndPan() const { return m_zoomAndPan
; }
84 virtual void setZoomAndPan(unsigned short value
) { m_zoomAndPan
= parseFromNumber(value
); }
85 virtual void setZoomAndPan(unsigned short value
, ExceptionState
&) { setZoomAndPan(value
); }
89 void resetZoomAndPan();
92 SVGZoomAndPanType m_zoomAndPan
;
97 #endif // SVGZoomAndPan_h