Rubber-stamped by Brady Eidson.
[webbrowser.git] / WebCore / html / HTMLMetaElement.cpp
blobcf667ca41147f1c76f9b3b4738b442f03ee96cba
1 /**
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003 Apple Computer, Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
23 #include "config.h"
24 #include "HTMLMetaElement.h"
26 #include "Document.h"
27 #include "HTMLNames.h"
28 #include "MappedAttribute.h"
30 namespace WebCore {
32 using namespace HTMLNames;
34 HTMLMetaElement::HTMLMetaElement(const QualifiedName& tagName, Document* doc)
35 : HTMLElement(tagName, doc)
37 ASSERT(hasTagName(metaTag));
40 HTMLMetaElement::~HTMLMetaElement()
44 void HTMLMetaElement::parseMappedAttribute(MappedAttribute* attr)
46 if (attr->name() == http_equivAttr) {
47 m_equiv = attr->value();
48 process();
49 } else if (attr->name() == contentAttr) {
50 m_content = attr->value();
51 process();
52 } else if (attr->name() == nameAttr) {
53 // Do nothing.
54 } else
55 HTMLElement::parseMappedAttribute(attr);
58 void HTMLMetaElement::insertedIntoDocument()
60 HTMLElement::insertedIntoDocument();
61 process();
64 void HTMLMetaElement::process()
66 // Get the document to process the tag, but only if we're actually part of DOM tree (changing a meta tag while
67 // it's not in the tree shouldn't have any effect on the document)
68 if (inDocument() && !m_equiv.isNull() && !m_content.isNull())
69 document()->processHttpEquiv(m_equiv, m_content);
72 String HTMLMetaElement::content() const
74 return getAttribute(contentAttr);
77 void HTMLMetaElement::setContent(const String& value)
79 setAttribute(contentAttr, value);
82 String HTMLMetaElement::httpEquiv() const
84 return getAttribute(http_equivAttr);
87 void HTMLMetaElement::setHttpEquiv(const String& value)
89 setAttribute(http_equivAttr, value);
92 String HTMLMetaElement::name() const
94 return getAttribute(nameAttr);
97 void HTMLMetaElement::setName(const String& value)
99 setAttribute(nameAttr, value);
102 String HTMLMetaElement::scheme() const
104 return getAttribute(schemeAttr);
107 void HTMLMetaElement::setScheme(const String &value)
109 setAttribute(schemeAttr, value);