summaryrefslogtreecommitdiff
path: root/Source/WebCore/svg/SVGZoomAndPan.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/svg/SVGZoomAndPan.h')
-rw-r--r--Source/WebCore/svg/SVGZoomAndPan.h64
1 files changed, 23 insertions, 41 deletions
diff --git a/Source/WebCore/svg/SVGZoomAndPan.h b/Source/WebCore/svg/SVGZoomAndPan.h
index a29353c2e..2a3702b92 100644
--- a/Source/WebCore/svg/SVGZoomAndPan.h
+++ b/Source/WebCore/svg/SVGZoomAndPan.h
@@ -18,21 +18,14 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef SVGZoomAndPan_h
-#define SVGZoomAndPan_h
+#pragma once
-#if ENABLE(SVG)
#include "QualifiedName.h"
#include "SVGNames.h"
-#include <wtf/HashSet.h>
namespace WebCore {
-enum SVGZoomAndPanType {
- SVGZoomAndPanUnknown = 0,
- SVGZoomAndPanDisable,
- SVGZoomAndPanMagnify
-};
+enum SVGZoomAndPanType { SVGZoomAndPanUnknown, SVGZoomAndPanDisable, SVGZoomAndPanMagnify };
class SVGZoomAndPan {
public:
@@ -44,43 +37,32 @@ public:
};
static bool isKnownAttribute(const QualifiedName&);
- static void addSupportedAttributes(HashSet<QualifiedName>&);
- static SVGZoomAndPanType parseFromNumber(unsigned short number)
- {
- if (!number || number > SVGZoomAndPanMagnify)
- return SVGZoomAndPanUnknown;
- return static_cast<SVGZoomAndPanType>(number);
- }
+ static SVGZoomAndPanType parseFromNumber(unsigned short);
- static bool parseZoomAndPan(const UChar*& start, const UChar* end, SVGZoomAndPanType&);
+ static bool parse(const UChar*& start, const UChar* end, SVGZoomAndPanType&);
+ template<class DerivedClass> static void parseAttribute(DerivedClass&, const QualifiedName&, const AtomicString& value);
- template<class SVGElementTarget>
- static bool parseAttribute(SVGElementTarget* target, const QualifiedName& name, const AtomicString& value)
- {
- ASSERT(target);
- if (name == SVGNames::zoomAndPanAttr) {
- const UChar* start = value.string().deprecatedCharacters();
- const UChar* end = start + value.length();
- SVGZoomAndPanType zoomAndPan = SVGZoomAndPanUnknown;
- parseZoomAndPan(start, end, zoomAndPan);
- target->setZoomAndPan(zoomAndPan);
- return true;
- }
+private:
+ static SVGZoomAndPanType parseAttributeValue(const AtomicString&);
+};
- return false;
- }
+inline bool SVGZoomAndPan::isKnownAttribute(const QualifiedName& name)
+{
+ return name == SVGNames::zoomAndPanAttr;
+}
- SVGZoomAndPanType zoomAndPan() const { return SVGZoomAndPanUnknown; }
+inline SVGZoomAndPanType SVGZoomAndPan::parseFromNumber(unsigned short number)
+{
+ if (number > SVGZoomAndPanMagnify)
+ return SVGZoomAndPanUnknown;
+ return static_cast<SVGZoomAndPanType>(number);
+}
- // These methods only exist to allow us to compile JSSVGZoomAndPan.*.
- // These are never called, and thus ASSERT_NOT_REACHED.
- void ref();
- void deref();
- void setZoomAndPan(unsigned short);
-};
+template<class DerivedClass> void SVGZoomAndPan::parseAttribute(DerivedClass& element, const QualifiedName& name, const AtomicString& value)
+{
+ if (name == SVGNames::zoomAndPanAttr)
+ element.setZoomAndPan(parseAttributeValue(value));
+}
} // namespace WebCore
-
-#endif // ENABLE(SVG)
-#endif // SVGZoomAndPan_h