Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / core / svg / SVGZoomAndPan.cpp
blobada7d6c8b3f69e232ba3c335b143e8efab78366d
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) 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 #include "config.h"
23 #include "core/svg/SVGZoomAndPan.h"
25 #include "core/svg/SVGParserUtilities.h"
27 namespace blink {
29 SVGZoomAndPan::SVGZoomAndPan()
30 : m_zoomAndPan(SVGZoomAndPanMagnify)
34 void SVGZoomAndPan::resetZoomAndPan()
36 m_zoomAndPan = SVGZoomAndPanMagnify;
39 bool SVGZoomAndPan::isKnownAttribute(const QualifiedName& attrName)
41 return attrName == SVGNames::zoomAndPanAttr;
44 void SVGZoomAndPan::addSupportedAttributes(HashSet<QualifiedName>& supportedAttributes)
46 supportedAttributes.add(SVGNames::zoomAndPanAttr);
49 static const LChar disable[] = {'d', 'i', 's', 'a', 'b', 'l', 'e'};
50 static const LChar magnify[] = {'m', 'a', 'g', 'n', 'i', 'f', 'y'};
52 template<typename CharType>
53 static bool parseZoomAndPanInternal(const CharType*& start, const CharType* end, SVGZoomAndPanType& zoomAndPan)
55 if (skipString(start, end, disable, WTF_ARRAY_LENGTH(disable))) {
56 zoomAndPan = SVGZoomAndPanDisable;
57 return true;
59 if (skipString(start, end, magnify, WTF_ARRAY_LENGTH(magnify))) {
60 zoomAndPan = SVGZoomAndPanMagnify;
61 return true;
63 return false;
66 bool SVGZoomAndPan::parseZoomAndPan(const LChar*& start, const LChar* end)
68 return parseZoomAndPanInternal(start, end, m_zoomAndPan);
71 bool SVGZoomAndPan::parseZoomAndPan(const UChar*& start, const UChar* end)
73 return parseZoomAndPanInternal(start, end, m_zoomAndPan);