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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2628873003: Look for favicon URLs (and similar <link>s) in SVG documents (Closed)
Patch Set: Find all <link>s in document (like Gecko.) Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/svg/custom/favicon-link-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index eb856afdaa55eb22b25ddac31cd4621ba8eb151b..af5b88d99572ecbd0e4fd4b32f102aa3a0eca357 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -5248,12 +5248,22 @@ Vector<IconURL> Document::iconURLs(int iconTypesMask) {
IconURL firstTouchPrecomposedIcon;
Vector<IconURL> secondaryIcons;
- // Start from the last child node so that icons seen later take precedence as
+ using TraversalFunction = HTMLLinkElement* (*)(const Node&);
+ TraversalFunction findNextCandidate =
+ &Traversal<HTMLLinkElement>::nextSibling;
+
+ HTMLLinkElement* firstElement = nullptr;
+ if (head()) {
+ firstElement = Traversal<HTMLLinkElement>::firstChild(*head());
+ } else if (isSVGDocument() && isSVGSVGElement(documentElement())) {
+ firstElement = Traversal<HTMLLinkElement>::firstWithin(*documentElement());
+ findNextCandidate = &Traversal<HTMLLinkElement>::next;
+ }
+
+ // Start from the first child node so that icons seen later take precedence as
// required by the spec.
- for (HTMLLinkElement* linkElement =
- head() ? Traversal<HTMLLinkElement>::firstChild(*head()) : 0;
- linkElement;
- linkElement = Traversal<HTMLLinkElement>::nextSibling(*linkElement)) {
+ for (HTMLLinkElement* linkElement = firstElement; linkElement;
+ linkElement = findNextCandidate(*linkElement)) {
if (!(linkElement->getIconType() & iconTypesMask))
continue;
if (linkElement->href().isEmpty())
« no previous file with comments | « third_party/WebKit/LayoutTests/svg/custom/favicon-link-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698