| OLD | NEW |
| (Empty) |
| 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, 2010 Apple Inc. All rights reserved. | |
| 6 * | |
| 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. | |
| 11 * | |
| 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. | |
| 16 * | |
| 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. | |
| 21 */ | |
| 22 | |
| 23 #include "config.h" | |
| 24 #include "core/html/HTMLMetaElement.h" | |
| 25 | |
| 26 #include "core/HTMLNames.h" | |
| 27 #include "core/dom/Document.h" | |
| 28 #include "core/dom/ElementTraversal.h" | |
| 29 #include "core/frame/LocalFrame.h" | |
| 30 #include "core/frame/Settings.h" | |
| 31 #include "core/inspector/ConsoleMessage.h" | |
| 32 #include "core/loader/FrameLoaderClient.h" | |
| 33 #include "platform/RuntimeEnabledFeatures.h" | |
| 34 | |
| 35 namespace blink { | |
| 36 | |
| 37 inline HTMLMetaElement::HTMLMetaElement(Document& document) | |
| 38 : HTMLElement(HTMLNames::metaTag, document) | |
| 39 { | |
| 40 ScriptWrappable::init(this); | |
| 41 } | |
| 42 | |
| 43 DEFINE_NODE_FACTORY(HTMLMetaElement) | |
| 44 | |
| 45 void HTMLMetaElement::parseAttribute(const QualifiedName& name, const AtomicStri
ng& value) | |
| 46 { | |
| 47 if (name == HTMLNames::http_equivAttr || name == HTMLNames::contentAttr) { | |
| 48 process(); | |
| 49 return; | |
| 50 } | |
| 51 | |
| 52 if (name != HTMLNames::nameAttr) | |
| 53 HTMLElement::parseAttribute(name, value); | |
| 54 } | |
| 55 | |
| 56 Node::InsertionNotificationRequest HTMLMetaElement::insertedInto(ContainerNode*
insertionPoint) | |
| 57 { | |
| 58 HTMLElement::insertedInto(insertionPoint); | |
| 59 return InsertionShouldCallDidNotifySubtreeInsertions; | |
| 60 } | |
| 61 | |
| 62 void HTMLMetaElement::didNotifySubtreeInsertionsToDocument() | |
| 63 { | |
| 64 process(); | |
| 65 } | |
| 66 | |
| 67 void HTMLMetaElement::process() | |
| 68 { | |
| 69 if (!inDocument()) | |
| 70 return; | |
| 71 | |
| 72 // All below situations require a content attribute (which can be the empty
string). | |
| 73 const AtomicString& contentValue = getAttribute(HTMLNames::contentAttr); | |
| 74 if (contentValue.isNull()) | |
| 75 return; | |
| 76 | |
| 77 const AtomicString& nameValue = getAttribute(HTMLNames::nameAttr); | |
| 78 if (!nameValue.isEmpty() && equalIgnoringCase(nameValue, "referrer")) | |
| 79 document().processReferrerPolicy(contentValue); | |
| 80 | |
| 81 // Get the document to process the tag, but only if we're actually part of D
OM | |
| 82 // tree (changing a meta tag while it's not in the tree shouldn't have any e
ffect | |
| 83 // on the document). | |
| 84 | |
| 85 const AtomicString& httpEquivValue = getAttribute(HTMLNames::http_equivAttr)
; | |
| 86 if (!httpEquivValue.isEmpty()) | |
| 87 document().processHttpEquiv(httpEquivValue, contentValue, false); | |
| 88 } | |
| 89 | |
| 90 const AtomicString& HTMLMetaElement::content() const | |
| 91 { | |
| 92 return getAttribute(HTMLNames::contentAttr); | |
| 93 } | |
| 94 | |
| 95 const AtomicString& HTMLMetaElement::httpEquiv() const | |
| 96 { | |
| 97 return getAttribute(HTMLNames::http_equivAttr); | |
| 98 } | |
| 99 | |
| 100 const AtomicString& HTMLMetaElement::name() const | |
| 101 { | |
| 102 return getAttribute(HTMLNames::nameAttr); | |
| 103 } | |
| 104 | |
| 105 } | |
| OLD | NEW |