diff options
Diffstat (limited to 'Source/WebCore/html/HTMLMetaElement.cpp')
-rw-r--r-- | Source/WebCore/html/HTMLMetaElement.cpp | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/Source/WebCore/html/HTMLMetaElement.cpp b/Source/WebCore/html/HTMLMetaElement.cpp index 6f360fe2b..15f002177 100644 --- a/Source/WebCore/html/HTMLMetaElement.cpp +++ b/Source/WebCore/html/HTMLMetaElement.cpp @@ -25,6 +25,7 @@ #include "Attribute.h" #include "Document.h" +#include "HTMLHeadElement.h" #include "HTMLNames.h" namespace WebCore { @@ -37,9 +38,14 @@ inline HTMLMetaElement::HTMLMetaElement(const QualifiedName& tagName, Document& ASSERT(hasTagName(metaTag)); } -PassRefPtr<HTMLMetaElement> HTMLMetaElement::create(const QualifiedName& tagName, Document& document) +Ref<HTMLMetaElement> HTMLMetaElement::create(Document& document) { - return adoptRef(new HTMLMetaElement(tagName, document)); + return adoptRef(*new HTMLMetaElement(metaTag, document)); +} + +Ref<HTMLMetaElement> HTMLMetaElement::create(const QualifiedName& tagName, Document& document) +{ + return adoptRef(*new HTMLMetaElement(tagName, document)); } void HTMLMetaElement::parseAttribute(const QualifiedName& name, const AtomicString& value) @@ -57,55 +63,48 @@ void HTMLMetaElement::parseAttribute(const QualifiedName& name, const AtomicStri Node::InsertionNotificationRequest HTMLMetaElement::insertedInto(ContainerNode& insertionPoint) { HTMLElement::insertedInto(insertionPoint); - if (insertionPoint.inDocument()) + if (insertionPoint.isConnected()) process(); return InsertionDone; } void HTMLMetaElement::process() { - if (!inDocument()) + // Changing a meta tag while it's not in the tree shouldn't have any effect on the document. + if (!isConnected()) return; - const AtomicString& contentValue = fastGetAttribute(contentAttr); + const AtomicString& contentValue = attributeWithoutSynchronization(contentAttr); if (contentValue.isNull()) return; - if (equalIgnoringCase(name(), "viewport")) + if (equalLettersIgnoringASCIICase(name(), "viewport")) document().processViewport(contentValue, ViewportArguments::ViewportMeta); #if PLATFORM(IOS) - else if (equalIgnoringCase(name(), "format-detection")) + else if (equalLettersIgnoringASCIICase(name(), "format-detection")) document().processFormatDetection(contentValue); - else if (equalIgnoringCase(name(), "apple-mobile-web-app-orientations")) + else if (equalLettersIgnoringASCIICase(name(), "apple-mobile-web-app-orientations")) document().processWebAppOrientations(); #endif - else if (equalIgnoringCase(name(), "referrer")) + else if (equalLettersIgnoringASCIICase(name(), "referrer")) document().processReferrerPolicy(contentValue); -#if ENABLE(LEGACY_VIEWPORT_ADAPTION) - else if (equalIgnoringCase(name(), "handheldfriendly") && equalIgnoringCase(contentValue, "true")) - document().processViewport("width=device-width", ViewportArguments::HandheldFriendlyMeta); - else if (equalIgnoringCase(name(), "mobileoptimized")) - document().processViewport("width=device-width, initial-scale=1", ViewportArguments::MobileOptimizedMeta); -#endif - // Get the document to process the tag, but only if we're actually part of DOM tree (changing a meta tag while - // it's not in the tree shouldn't have any effect on the document) - const AtomicString& httpEquivValue = fastGetAttribute(http_equivAttr); + const AtomicString& httpEquivValue = attributeWithoutSynchronization(http_equivAttr); if (!httpEquivValue.isNull()) - document().processHttpEquiv(httpEquivValue, contentValue); + document().processHttpEquiv(httpEquivValue, contentValue, isDescendantOf(document().head())); } -String HTMLMetaElement::content() const +const AtomicString& HTMLMetaElement::content() const { - return getAttribute(contentAttr); + return attributeWithoutSynchronization(contentAttr); } -String HTMLMetaElement::httpEquiv() const +const AtomicString& HTMLMetaElement::httpEquiv() const { - return getAttribute(http_equivAttr); + return attributeWithoutSynchronization(http_equivAttr); } -String HTMLMetaElement::name() const +const AtomicString& HTMLMetaElement::name() const { return getNameAttribute(); } |