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

Side by Side 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 unified diff | 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 »
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 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 5230 matching lines...) Expand 10 before | Expand all | Expand 10 after
5241 return; 5241 return;
5242 view()->beginLifecycleUpdates(); 5242 view()->beginLifecycleUpdates();
5243 } 5243 }
5244 5244
5245 Vector<IconURL> Document::iconURLs(int iconTypesMask) { 5245 Vector<IconURL> Document::iconURLs(int iconTypesMask) {
5246 IconURL firstFavicon; 5246 IconURL firstFavicon;
5247 IconURL firstTouchIcon; 5247 IconURL firstTouchIcon;
5248 IconURL firstTouchPrecomposedIcon; 5248 IconURL firstTouchPrecomposedIcon;
5249 Vector<IconURL> secondaryIcons; 5249 Vector<IconURL> secondaryIcons;
5250 5250
5251 // Start from the last child node so that icons seen later take precedence as 5251 using TraversalFunction = HTMLLinkElement* (*)(const Node&);
5252 TraversalFunction findNextCandidate =
5253 &Traversal<HTMLLinkElement>::nextSibling;
5254
5255 HTMLLinkElement* firstElement = nullptr;
5256 if (head()) {
5257 firstElement = Traversal<HTMLLinkElement>::firstChild(*head());
5258 } else if (isSVGDocument() && isSVGSVGElement(documentElement())) {
5259 firstElement = Traversal<HTMLLinkElement>::firstWithin(*documentElement());
5260 findNextCandidate = &Traversal<HTMLLinkElement>::next;
5261 }
5262
5263 // Start from the first child node so that icons seen later take precedence as
5252 // required by the spec. 5264 // required by the spec.
5253 for (HTMLLinkElement* linkElement = 5265 for (HTMLLinkElement* linkElement = firstElement; linkElement;
5254 head() ? Traversal<HTMLLinkElement>::firstChild(*head()) : 0; 5266 linkElement = findNextCandidate(*linkElement)) {
5255 linkElement;
5256 linkElement = Traversal<HTMLLinkElement>::nextSibling(*linkElement)) {
5257 if (!(linkElement->getIconType() & iconTypesMask)) 5267 if (!(linkElement->getIconType() & iconTypesMask))
5258 continue; 5268 continue;
5259 if (linkElement->href().isEmpty()) 5269 if (linkElement->href().isEmpty())
5260 continue; 5270 continue;
5261 5271
5262 IconURL newURL(linkElement->href(), linkElement->iconSizes(), 5272 IconURL newURL(linkElement->href(), linkElement->iconSizes(),
5263 linkElement->type(), linkElement->getIconType()); 5273 linkElement->type(), linkElement->getIconType());
5264 if (linkElement->getIconType() == Favicon) { 5274 if (linkElement->getIconType() == Favicon) {
5265 if (firstFavicon.m_iconType != InvalidIcon) 5275 if (firstFavicon.m_iconType != InvalidIcon)
5266 secondaryIcons.push_back(firstFavicon); 5276 secondaryIcons.push_back(firstFavicon);
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after
6475 } 6485 }
6476 6486
6477 void showLiveDocumentInstances() { 6487 void showLiveDocumentInstances() {
6478 WeakDocumentSet& set = liveDocumentSet(); 6488 WeakDocumentSet& set = liveDocumentSet();
6479 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6489 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6480 for (Document* document : set) 6490 for (Document* document : set)
6481 fprintf(stderr, "- Document %p URL: %s\n", document, 6491 fprintf(stderr, "- Document %p URL: %s\n", document,
6482 document->url().getString().utf8().data()); 6492 document->url().getString().utf8().data());
6483 } 6493 }
6484 #endif 6494 #endif
OLDNEW
« 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