| 1 | /* |
| 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) 2018-2019 Apple Inc. All rights reserved. |
| 5 | * |
| 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. |
| 10 | * |
| 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. |
| 15 | * |
| 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. |
| 20 | */ |
| 21 | |
| 22 | #pragma once |
| 23 | |
| 24 | #include "ExceptionOr.h" |
| 25 | #include "QualifiedName.h" |
| 26 | #include "SVGNames.h" |
| 27 | #include "SVGZoomAndPanType.h" |
| 28 | |
| 29 | namespace WebCore { |
| 30 | |
| 31 | class SVGZoomAndPan { |
| 32 | WTF_MAKE_NONCOPYABLE(SVGZoomAndPan); |
| 33 | public: |
| 34 | // Forward declare enumerations in the W3C naming scheme, for IDL generation. |
| 35 | enum { |
| 36 | SVG_ZOOMANDPAN_UNKNOWN = SVGZoomAndPanUnknown, |
| 37 | SVG_ZOOMANDPAN_DISABLE = SVGZoomAndPanDisable, |
| 38 | SVG_ZOOMANDPAN_MAGNIFY = SVGZoomAndPanMagnify |
| 39 | }; |
| 40 | |
| 41 | SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan; } |
| 42 | void setZoomAndPan(SVGZoomAndPanType zoomAndPan) { m_zoomAndPan = zoomAndPan; } |
| 43 | ExceptionOr<void> setZoomAndPan(unsigned) { return Exception { NoModificationAllowedError }; } |
| 44 | void reset() { m_zoomAndPan = SVGPropertyTraits<SVGZoomAndPanType>::initialValue(); } |
| 45 | |
| 46 | void parseAttribute(const QualifiedName&, const AtomicString&); |
| 47 | |
| 48 | protected: |
| 49 | SVGZoomAndPan() = default; |
| 50 | |
| 51 | bool parseZoomAndPan(const UChar*&, const UChar*); |
| 52 | |
| 53 | private: |
| 54 | SVGZoomAndPanType m_zoomAndPan { SVGPropertyTraits<SVGZoomAndPanType>::initialValue() }; |
| 55 | }; |
| 56 | |
| 57 | } // namespace WebCore |
| 58 | |