HTMLMetaElement.cpp [plain text]
#include "config.h"
#include "HTMLMetaElement.h"
#include "Attribute.h"
#include "Document.h"
#include "HTMLNames.h"
namespace WebCore {
using namespace HTMLNames;
inline HTMLMetaElement::HTMLMetaElement(const QualifiedName& tagName, Document* document)
: HTMLElement(tagName, document)
{
ASSERT(hasTagName(metaTag));
}
PassRefPtr<HTMLMetaElement> HTMLMetaElement::create(const QualifiedName& tagName, Document* document)
{
return adoptRef(new HTMLMetaElement(tagName, document));
}
void HTMLMetaElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == http_equivAttr) {
m_equiv = attr->value();
process();
} else if (attr->name() == contentAttr) {
m_content = attr->value();
process();
} else if (attr->name() == nameAttr) {
} else
HTMLElement::parseMappedAttribute(attr);
}
void HTMLMetaElement::insertedIntoDocument()
{
HTMLElement::insertedIntoDocument();
process();
}
void HTMLMetaElement::process()
{
if (!inDocument() || m_content.isNull())
return;
if (equalIgnoringCase(name(), "viewport"))
document()->processViewport(m_content);
if (equalIgnoringCase(name(), "format-detection"))
document()->processFormatDetection(m_content);
if (!m_equiv.isNull())
document()->processHttpEquiv(m_equiv, m_content);
}
String HTMLMetaElement::content() const
{
return getAttribute(contentAttr);
}
String HTMLMetaElement::httpEquiv() const
{
return getAttribute(http_equivAttr);
}
String HTMLMetaElement::name() const
{
return getAttribute(nameAttr);
}
}