1 /* 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 4 * Copyright (C) 2003, 2010 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 23 #ifndef HTMLMetaElement_h 24 #define HTMLMetaElement_h 25 26 #include "core/html/HTMLElement.h" 27 28 namespace WebCore { 29 30 enum ViewportErrorCode { 31 UnrecognizedViewportArgumentKeyError, 32 UnrecognizedViewportArgumentValueError, 33 TruncatedViewportArgumentValueError, 34 MaximumScaleTooLargeError, 35 TargetDensityDpiUnsupported 36 }; 37 38 class HTMLMetaElement FINAL : public HTMLElement { 39 public: 40 static PassRefPtr<HTMLMetaElement> create(Document&); 41 42 const AtomicString& content() const; 43 const AtomicString& httpEquiv() const; 44 const AtomicString& name() const; 45 46 private: 47 explicit HTMLMetaElement(Document&); 48 49 typedef void (HTMLMetaElement::*KeyValuePairCallback)(const String& key, const String& value, void* data); 50 void processViewportKeyValuePair(const String& key, const String& value, void* data); 51 void parseContentAttribute(const String& content, KeyValuePairCallback, void* data); 52 53 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; 54 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; 55 56 float parsePositiveNumber(const String& key, const String& value, bool* ok = 0); 57 58 Length parseViewportValueAsLength(const String& key, const String& value); 59 float parseViewportValueAsZoom(const String& key, const String& value); 60 float parseViewportValueAsUserZoom(const String& key, const String& value); 61 float parseViewportValueAsDPI(const String& key, const String& value); 62 63 void reportViewportWarning(ViewportErrorCode, const String& replacement1, const String& replacement2); 64 65 void process(); 66 void processViewportContentAttribute(const String& content, ViewportDescription::Type origin); 67 }; 68 69 DEFINE_NODE_TYPE_CASTS(HTMLMetaElement, hasTagName(HTMLNames::metaTag)); 70 71 } // namespace WebCore 72 73 #endif 74