Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: Source/core/html/HTMLMetaElement-in.cpp

Issue 126313002: Gracefully handle <meta http-equiv name content> elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « LayoutTests/http/tests/misc/meta-http-equiv-and-name-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 { 444 {
445 if (!inDocument()) 445 if (!inDocument())
446 return; 446 return;
447 447
448 // All below situations require a content attribute (which can be the empty string). 448 // All below situations require a content attribute (which can be the empty string).
449 const AtomicString& contentValue = fastGetAttribute(contentAttr); 449 const AtomicString& contentValue = fastGetAttribute(contentAttr);
450 if (contentValue.isNull()) 450 if (contentValue.isNull())
451 return; 451 return;
452 452
453 const AtomicString& nameValue = fastGetAttribute(nameAttr); 453 const AtomicString& nameValue = fastGetAttribute(nameAttr);
454 if (nameValue.isNull()) { 454 if (!nameValue.isEmpty()) {
455 // Get the document to process the tag, but only if we're actually part of DOM 455 if (equalIgnoringCase(nameValue, "viewport"))
456 // tree (changing a meta tag while it's not in the tree shouldn't have a ny effect 456 processViewportContentAttribute(contentValue, ViewportDescription::V iewportMeta);
457 // on the document). 457 else if (equalIgnoringCase(nameValue, "referrer"))
458 const AtomicString& httpEquivValue = fastGetAttribute(http_equivAttr); 458 document().processReferrerPolicy(contentValue);
459 if (!httpEquivValue.isNull()) 459 else if (equalIgnoringCase(nameValue, "handheldfriendly") && equalIgnori ngCase(contentValue, "true"))
460 document().processHttpEquiv(httpEquivValue, contentValue); 460 processViewportContentAttribute("width=device-width", ViewportDescri ption::HandheldFriendlyMeta);
461 return; 461 else if (equalIgnoringCase(nameValue, "mobileoptimized"))
462 processViewportContentAttribute("width=device-width, initial-scale=1 ", ViewportDescription::MobileOptimizedMeta);
462 } 463 }
463 464
464 if (equalIgnoringCase(nameValue, "viewport")) 465 // Get the document to process the tag, but only if we're actually part of D OM
465 processViewportContentAttribute(contentValue, ViewportDescription::Viewp ortMeta); 466 // tree (changing a meta tag while it's not in the tree shouldn't have any e ffect
466 else if (equalIgnoringCase(nameValue, "referrer")) 467 // on the document).
467 document().processReferrerPolicy(contentValue); 468 const AtomicString& httpEquivValue = fastGetAttribute(http_equivAttr);
468 else if (equalIgnoringCase(nameValue, "handheldfriendly") && equalIgnoringCa se(contentValue, "true")) 469 if (!httpEquivValue.isEmpty())
469 processViewportContentAttribute("width=device-width", ViewportDescriptio n::HandheldFriendlyMeta); 470 document().processHttpEquiv(httpEquivValue, contentValue);
470 else if (equalIgnoringCase(nameValue, "mobileoptimized"))
471 processViewportContentAttribute("width=device-width, initial-scale=1", V iewportDescription::MobileOptimizedMeta);
472 } 471 }
473 472
474 const AtomicString& HTMLMetaElement::content() const 473 const AtomicString& HTMLMetaElement::content() const
475 { 474 {
476 return getAttribute(contentAttr); 475 return getAttribute(contentAttr);
477 } 476 }
478 477
479 const AtomicString& HTMLMetaElement::httpEquiv() const 478 const AtomicString& HTMLMetaElement::httpEquiv() const
480 { 479 {
481 return getAttribute(http_equivAttr); 480 return getAttribute(http_equivAttr);
482 } 481 }
483 482
484 const AtomicString& HTMLMetaElement::name() const 483 const AtomicString& HTMLMetaElement::name() const
485 { 484 {
486 return getNameAttribute(); 485 return getNameAttribute();
487 } 486 }
488 487
489 } 488 }
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/misc/meta-http-equiv-and-name-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698