2008-11-04 Anders Carlsson <andersca@apple.com>
[webkit/qt.git] / WebCore / html / HTMLMetaElement.cpp
blobf93770ddb2d26bef5d53dca739b7cd96e72fcfe4
1 /**
2 * This file is part of the DOM implementation for KDE.
4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
5 * (C) 1999 Antti Koivisto (koivisto@kde.org)
6 * (C) 2001 Dirk Mueller (mueller@kde.org)
7 * Copyright (C) 2003 Apple Computer, Inc.
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Library General Public License for more details.
19 * You should have received a copy of the GNU Library General Public License
20 * along with this library; see the file COPYING.LIB. If not, write to
21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
24 #include "config.h"
25 #include "HTMLMetaElement.h"
27 #include "Document.h"
28 #include "HTMLNames.h"
30 namespace WebCore {
32 using namespace HTMLNames;
34 HTMLMetaElement::HTMLMetaElement(Document* doc)
35 : HTMLElement(metaTag, doc)
39 HTMLMetaElement::~HTMLMetaElement()
43 void HTMLMetaElement::parseMappedAttribute(MappedAttribute* attr)
45 if (attr->name() == http_equivAttr) {
46 m_equiv = attr->value();
47 process();
48 } else if (attr->name() == contentAttr) {
49 m_content = attr->value();
50 process();
51 } else if (attr->name() == nameAttr) {
52 // Do nothing.
53 } else
54 HTMLElement::parseMappedAttribute(attr);
57 void HTMLMetaElement::insertedIntoDocument()
59 HTMLElement::insertedIntoDocument();
60 process();
63 void HTMLMetaElement::process()
65 // Get the document to process the tag, but only if we're actually part of DOM tree (changing a meta tag while
66 // it's not in the tree shouldn't have any effect on the document)
67 if (inDocument() && !m_equiv.isNull() && !m_content.isNull())
68 document()->processHttpEquiv(m_equiv, m_content);
71 String HTMLMetaElement::content() const
73 return getAttribute(contentAttr);
76 void HTMLMetaElement::setContent(const String& value)
78 setAttribute(contentAttr, value);
81 String HTMLMetaElement::httpEquiv() const
83 return getAttribute(http_equivAttr);
86 void HTMLMetaElement::setHttpEquiv(const String& value)
88 setAttribute(http_equivAttr, value);
91 String HTMLMetaElement::name() const
93 return getAttribute(nameAttr);
96 void HTMLMetaElement::setName(const String& value)
98 setAttribute(nameAttr, value);
101 String HTMLMetaElement::scheme() const
103 return getAttribute(schemeAttr);
106 void HTMLMetaElement::setScheme(const String &value)
108 setAttribute(schemeAttr, value);