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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 if (insertionPoint->inDocument()) | 398 if (insertionPoint->inDocument()) |
399 process(); | 399 process(); |
400 return InsertionDone; | 400 return InsertionDone; |
401 } | 401 } |
402 | 402 |
403 void HTMLMetaElement::process() | 403 void HTMLMetaElement::process() |
404 { | 404 { |
405 if (!inDocument()) | 405 if (!inDocument()) |
406 return; | 406 return; |
407 | 407 |
| 408 // All below situations require a content attribute (which can be the empty
string). |
408 const AtomicString& contentValue = fastGetAttribute(contentAttr); | 409 const AtomicString& contentValue = fastGetAttribute(contentAttr); |
409 if (contentValue.isNull()) | 410 if (contentValue.isNull()) |
410 return; | 411 return; |
411 | 412 |
412 if (equalIgnoringCase(name(), "viewport")) | 413 const AtomicString& nameValue = fastGetAttribute(nameAttr); |
| 414 if (nameValue.isNull()) { |
| 415 // Get the document to process the tag, but only if we're actually part
of DOM |
| 416 // tree (changing a meta tag while it's not in the tree shouldn't have a
ny effect |
| 417 // on the document) |
| 418 const AtomicString& httpEquivValue = fastGetAttribute(http_equivAttr); |
| 419 if (!httpEquivValue.isNull()) |
| 420 document().processHttpEquiv(httpEquivValue, contentValue); |
| 421 return; |
| 422 } |
| 423 |
| 424 if (equalIgnoringCase(nameValue, "viewport")) |
413 processViewportContentAttribute(contentValue, ViewportDescription::Viewp
ortMeta); | 425 processViewportContentAttribute(contentValue, ViewportDescription::Viewp
ortMeta); |
414 else if (equalIgnoringCase(name(), "referrer")) | 426 else if (equalIgnoringCase(nameValue, "referrer")) |
415 document().processReferrerPolicy(contentValue); | 427 document().processReferrerPolicy(contentValue); |
416 else if (equalIgnoringCase(name(), "handheldfriendly") && equalIgnoringCase(
contentValue, "true")) | 428 else if (equalIgnoringCase(nameValue, "handheldfriendly") && equalIgnoringCa
se(contentValue, "true")) |
417 processViewportContentAttribute("width=device-width", ViewportDescriptio
n::HandheldFriendlyMeta); | 429 processViewportContentAttribute("width=device-width", ViewportDescriptio
n::HandheldFriendlyMeta); |
418 else if (equalIgnoringCase(name(), "mobileoptimized")) | 430 else if (equalIgnoringCase(nameValue, "mobileoptimized")) |
419 processViewportContentAttribute("width=device-width, initial-scale=1", V
iewportDescription::MobileOptimizedMeta); | 431 processViewportContentAttribute("width=device-width, initial-scale=1", V
iewportDescription::MobileOptimizedMeta); |
420 | |
421 // Get the document to process the tag, but only if we're actually part of D
OM tree (changing a meta tag while | |
422 // it's not in the tree shouldn't have any effect on the document) | |
423 const AtomicString& httpEquivValue = fastGetAttribute(http_equivAttr); | |
424 if (!httpEquivValue.isNull()) | |
425 document().processHttpEquiv(httpEquivValue, contentValue); | |
426 } | 432 } |
427 | 433 |
428 String HTMLMetaElement::content() const | 434 String HTMLMetaElement::content() const |
429 { | 435 { |
430 return getAttribute(contentAttr); | 436 return getAttribute(contentAttr); |
431 } | 437 } |
432 | 438 |
433 String HTMLMetaElement::httpEquiv() const | 439 String HTMLMetaElement::httpEquiv() const |
434 { | 440 { |
435 return getAttribute(http_equivAttr); | 441 return getAttribute(http_equivAttr); |
436 } | 442 } |
437 | 443 |
438 String HTMLMetaElement::name() const | 444 String HTMLMetaElement::name() const |
439 { | 445 { |
440 return getNameAttribute(); | 446 return getNameAttribute(); |
441 } | 447 } |
442 | 448 |
443 } | 449 } |
OLD | NEW |