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 * (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 Loading... |
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 Loading... |
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 |
OLD | NEW |