| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2003, 2010 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2010 Apple Inc. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 } | 436 } |
| 437 | 437 |
| 438 Node::InsertionNotificationRequest HTMLMetaElement::insertedInto(ContainerNode*
insertionPoint) | 438 Node::InsertionNotificationRequest HTMLMetaElement::insertedInto(ContainerNode*
insertionPoint) |
| 439 { | 439 { |
| 440 HTMLElement::insertedInto(insertionPoint); | 440 HTMLElement::insertedInto(insertionPoint); |
| 441 if (insertionPoint->inDocument()) | 441 if (insertionPoint->inDocument()) |
| 442 process(); | 442 process(); |
| 443 return InsertionDone; | 443 return InsertionDone; |
| 444 } | 444 } |
| 445 | 445 |
| 446 static bool inDocumentHead(HTMLMetaElement* element) |
| 447 { |
| 448 if (!element->inDocument()) |
| 449 return false; |
| 450 |
| 451 for (Element* current = element; current; current = current->parentElement()
) { |
| 452 if (current->hasTagName(HTMLNames::headTag)) |
| 453 return true; |
| 454 } |
| 455 return false; |
| 456 } |
| 457 |
| 446 void HTMLMetaElement::process() | 458 void HTMLMetaElement::process() |
| 447 { | 459 { |
| 448 if (!inDocument()) | 460 if (!inDocument()) |
| 449 return; | 461 return; |
| 450 | 462 |
| 451 // All below situations require a content attribute (which can be the empty
string). | 463 // All below situations require a content attribute (which can be the empty
string). |
| 452 const AtomicString& contentValue = fastGetAttribute(contentAttr); | 464 const AtomicString& contentValue = fastGetAttribute(contentAttr); |
| 453 if (contentValue.isNull()) | 465 if (contentValue.isNull()) |
| 454 return; | 466 return; |
| 455 | 467 |
| 456 const AtomicString& nameValue = fastGetAttribute(nameAttr); | 468 const AtomicString& nameValue = fastGetAttribute(nameAttr); |
| 457 if (!nameValue.isEmpty()) { | 469 if (!nameValue.isEmpty()) { |
| 458 if (equalIgnoringCase(nameValue, "viewport")) | 470 if (equalIgnoringCase(nameValue, "viewport")) |
| 459 processViewportContentAttribute(contentValue, ViewportDescription::V
iewportMeta); | 471 processViewportContentAttribute(contentValue, ViewportDescription::V
iewportMeta); |
| 460 else if (equalIgnoringCase(nameValue, "referrer")) | 472 else if (equalIgnoringCase(nameValue, "referrer")) |
| 461 document().processReferrerPolicy(contentValue); | 473 document().processReferrerPolicy(contentValue); |
| 462 else if (equalIgnoringCase(nameValue, "handheldfriendly") && equalIgnori
ngCase(contentValue, "true")) | 474 else if (equalIgnoringCase(nameValue, "handheldfriendly") && equalIgnori
ngCase(contentValue, "true")) |
| 463 processViewportContentAttribute("width=device-width", ViewportDescri
ption::HandheldFriendlyMeta); | 475 processViewportContentAttribute("width=device-width", ViewportDescri
ption::HandheldFriendlyMeta); |
| 464 else if (equalIgnoringCase(nameValue, "mobileoptimized")) | 476 else if (equalIgnoringCase(nameValue, "mobileoptimized")) |
| 465 processViewportContentAttribute("width=device-width, initial-scale=1
", ViewportDescription::MobileOptimizedMeta); | 477 processViewportContentAttribute("width=device-width, initial-scale=1
", ViewportDescription::MobileOptimizedMeta); |
| 466 } | 478 } |
| 467 | 479 |
| 468 // Get the document to process the tag, but only if we're actually part of D
OM | 480 // Get the document to process the tag, but only if we're actually part of D
OM |
| 469 // tree (changing a meta tag while it's not in the tree shouldn't have any e
ffect | 481 // tree (changing a meta tag while it's not in the tree shouldn't have any e
ffect |
| 470 // on the document). | 482 // on the document). |
| 483 |
| 471 const AtomicString& httpEquivValue = fastGetAttribute(http_equivAttr); | 484 const AtomicString& httpEquivValue = fastGetAttribute(http_equivAttr); |
| 472 if (!httpEquivValue.isEmpty()) | 485 if (!httpEquivValue.isEmpty()) |
| 473 document().processHttpEquiv(httpEquivValue, contentValue); | 486 document().processHttpEquiv(httpEquivValue, contentValue, inDocumentHead
(this)); |
| 474 } | 487 } |
| 475 | 488 |
| 476 const AtomicString& HTMLMetaElement::content() const | 489 const AtomicString& HTMLMetaElement::content() const |
| 477 { | 490 { |
| 478 return getAttribute(contentAttr); | 491 return getAttribute(contentAttr); |
| 479 } | 492 } |
| 480 | 493 |
| 481 const AtomicString& HTMLMetaElement::httpEquiv() const | 494 const AtomicString& HTMLMetaElement::httpEquiv() const |
| 482 { | 495 { |
| 483 return getAttribute(http_equivAttr); | 496 return getAttribute(http_equivAttr); |
| 484 } | 497 } |
| 485 | 498 |
| 486 const AtomicString& HTMLMetaElement::name() const | 499 const AtomicString& HTMLMetaElement::name() const |
| 487 { | 500 { |
| 488 return getNameAttribute(); | 501 return getNameAttribute(); |
| 489 } | 502 } |
| 490 | 503 |
| 491 } | 504 } |
| OLD | NEW |