<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[209613] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/209613">209613</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2016-12-09 10:21:30 -0800 (Fri, 09 Dec 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>LinkIconCollector refactoring.
https://bugs.webkit.org/show_bug.cgi?id=165657
Reviewed by Dean Jackson.
No new tests (Refactor, no behavior change)
* WebCore.xcodeproj/project.pbxproj:
* html/LinkIconCollector.cpp:
(WebCore::iconSize):
(WebCore::compareIcons):
* html/LinkIconCollector.h:
* platform/LinkIcon.h: Move outside of LinkIconCollector for future expandability.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorehtmlLinkIconCollectorcpp">trunk/Source/WebCore/html/LinkIconCollector.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlLinkIconCollectorh">trunk/Source/WebCore/html/LinkIconCollector.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformLinkIconh">trunk/Source/WebCore/platform/LinkIcon.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (209612 => 209613)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-12-09 18:12:31 UTC (rev 209612)
+++ trunk/Source/WebCore/ChangeLog        2016-12-09 18:21:30 UTC (rev 209613)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2016-12-09 Brady Eidson <beidson@apple.com>
+
+ LinkIconCollector refactoring.
+ https://bugs.webkit.org/show_bug.cgi?id=165657
+
+ Reviewed by Dean Jackson.
+
+ No new tests (Refactor, no behavior change)
+
+ * WebCore.xcodeproj/project.pbxproj:
+
+ * html/LinkIconCollector.cpp:
+ (WebCore::iconSize):
+ (WebCore::compareIcons):
+ * html/LinkIconCollector.h:
+
+ * platform/LinkIcon.h: Move outside of LinkIconCollector for future expandability.
+
</ins><span class="cx"> 2016-12-09 Ryan Haddad <ryanhaddad@apple.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed, rolling out r209574.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (209612 => 209613)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-12-09 18:12:31 UTC (rev 209612)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-12-09 18:21:30 UTC (rev 209613)
</span><span class="lines">@@ -2050,6 +2050,7 @@
</span><span class="cx">                 514129981C6976900059E714 /* IDBRequestCompletionEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514129961C6976150059E714 /* IDBRequestCompletionEvent.cpp */; };
</span><span class="cx">                 514129991C6976900059E714 /* IDBRequestCompletionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 514129971C6976150059E714 /* IDBRequestCompletionEvent.h */; };
</span><span class="cx">                 5141299B1C6C16740059E714 /* JSIDBIndexCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5141299A1C6C166D0059E714 /* JSIDBIndexCustom.cpp */; };
</span><ins>+                5143B2631DDD15200014FAC6 /* LinkIcon.h in Headers */ = {isa = PBXBuildFile; fileRef = 5143B2621DDD14900014FAC6 /* LinkIcon.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 5145B1091BC48E2E00E86219 /* IDBResourceIdentifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5145B1071BC4890B00E86219 /* IDBResourceIdentifier.cpp */; };
</span><span class="cx">                 5145B10A1BC48E2E00E86219 /* IDBResourceIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 5145B1081BC4890B00E86219 /* IDBResourceIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 5148453E1BB9D07E006A72ED /* IDBError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5148453C1BB9D076006A72ED /* IDBError.cpp */; };
</span><span class="lines">@@ -9271,6 +9272,7 @@
</span><span class="cx">                 514129961C6976150059E714 /* IDBRequestCompletionEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBRequestCompletionEvent.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 514129971C6976150059E714 /* IDBRequestCompletionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBRequestCompletionEvent.h; sourceTree = "<group>"; };
</span><span class="cx">                 5141299A1C6C166D0059E714 /* JSIDBIndexCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBIndexCustom.cpp; sourceTree = "<group>"; };
</span><ins>+                5143B2621DDD14900014FAC6 /* LinkIcon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LinkIcon.h; sourceTree = "<group>"; };
</ins><span class="cx">                 5145B1071BC4890B00E86219 /* IDBResourceIdentifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBResourceIdentifier.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 5145B1081BC4890B00E86219 /* IDBResourceIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBResourceIdentifier.h; sourceTree = "<group>"; };
</span><span class="cx">                 5148453C1BB9D076006A72ED /* IDBError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBError.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -22535,6 +22537,7 @@
</span><span class="cx">                                 BCFF64900EAD15C200C1D6F7 /* LengthSize.h */,
</span><span class="cx">                                 A7AD2F850EC89D07008AB002 /* LinkHash.cpp */,
</span><span class="cx">                                 A7AD2F860EC89D07008AB002 /* LinkHash.h */,
</span><ins>+                                5143B2621DDD14900014FAC6 /* LinkIcon.h */,
</ins><span class="cx">                                 C046E1AB1208A9FE00BA2CF7 /* LocalizedStrings.cpp */,
</span><span class="cx">                                 935207BD09BD410A00F2038D /* LocalizedStrings.h */,
</span><span class="cx">                                 A8239DFE09B3CF8A00B60641 /* Logging.cpp */,
</span><span class="lines">@@ -27757,6 +27760,7 @@
</span><span class="cx">                                 B22279F40D00BF220071B782 /* SVGFEMergeElement.h in Headers */,
</span><span class="cx">                                 B22279F70D00BF220071B782 /* SVGFEMergeNodeElement.h in Headers */,
</span><span class="cx">                                 84224194107E78A700766A87 /* SVGFEMorphologyElement.h in Headers */,
</span><ins>+                                5143B2631DDD15200014FAC6 /* LinkIcon.h in Headers */,
</ins><span class="cx">                                 B22279FA0D00BF220071B782 /* SVGFEOffsetElement.h in Headers */,
</span><span class="cx">                                 B22279FD0D00BF220071B782 /* SVGFEPointLightElement.h in Headers */,
</span><span class="cx">                                 B2227A000D00BF220071B782 /* SVGFESpecularLightingElement.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlLinkIconCollectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/LinkIconCollector.cpp (209612 => 209613)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/LinkIconCollector.cpp        2016-12-09 18:12:31 UTC (rev 209612)
+++ trunk/Source/WebCore/html/LinkIconCollector.cpp        2016-12-09 18:21:30 UTC (rev 209613)
</span><span class="lines">@@ -36,7 +36,7 @@
</span><span class="cx">
</span><span class="cx"> const unsigned defaultTouchIconWidth = 60;
</span><span class="cx">
</span><del>-static unsigned iconSize(const LinkIconCollector::Icon& icon)
</del><ins>+static unsigned iconSize(const LinkIcon& icon)
</ins><span class="cx"> {
</span><span class="cx"> if (icon.size)
</span><span class="cx"> return *icon.size;
</span><span class="lines">@@ -47,7 +47,7 @@
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static int compareIcons(const LinkIconCollector::Icon& a, const LinkIconCollector::Icon& b)
</del><ins>+static int compareIcons(const LinkIcon& a, const LinkIcon& b)
</ins><span class="cx"> {
</span><span class="cx"> // Apple Touch icons always come first.
</span><span class="cx"> if (a.type == LinkIconType::Favicon && b.type != LinkIconType::Favicon)
</span><span class="lines">@@ -72,13 +72,13 @@
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-auto LinkIconCollector::iconsOfTypes(OptionSet<LinkIconType> iconTypes) -> Vector<Icon>
</del><ins>+auto LinkIconCollector::iconsOfTypes(OptionSet<LinkIconType> iconTypes) -> Vector<LinkIcon>
</ins><span class="cx"> {
</span><span class="cx"> auto* head = m_document.head();
</span><span class="cx"> if (!head)
</span><span class="cx"> return { };
</span><span class="cx">
</span><del>- Vector<Icon> icons;
</del><ins>+ Vector<LinkIcon> icons;
</ins><span class="cx">
</span><span class="cx"> for (auto& linkElement : childrenOfType<HTMLLinkElement>(*head)) {
</span><span class="cx"> if (!linkElement.iconType())
</span><span class="lines">@@ -104,7 +104,7 @@
</span><span class="cx"> iconSize = size;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- icons.append({ url, iconType, iconSize });
</del><ins>+ icons.append({ url, iconType, linkElement.type(), iconSize });
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> std::sort(icons.begin(), icons.end(), [](auto& a, auto& b) {
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlLinkIconCollectorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/LinkIconCollector.h (209612 => 209613)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/LinkIconCollector.h        2016-12-09 18:12:31 UTC (rev 209612)
+++ trunk/Source/WebCore/html/LinkIconCollector.h        2016-12-09 18:21:30 UTC (rev 209613)
</span><span class="lines">@@ -25,9 +25,8 @@
</span><span class="cx">
</span><span class="cx"> #pragma once
</span><span class="cx">
</span><del>-#include "URL.h"
</del><ins>+#include "LinkIcon.h"
</ins><span class="cx"> #include <wtf/OptionSet.h>
</span><del>-#include <wtf/Optional.h>
</del><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -41,15 +40,8 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>- struct Icon {
- URL url;
</del><ins>+ WEBCORE_EXPORT Vector<LinkIcon> iconsOfTypes(OptionSet<LinkIconType>);
</ins><span class="cx">
</span><del>- LinkIconType type;
- std::optional<unsigned> size;
- };
-
- WEBCORE_EXPORT Vector<Icon> iconsOfTypes(OptionSet<LinkIconType>);
-
</del><span class="cx"> private:
</span><span class="cx"> Document& m_document;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformLinkIconhfromrev209612trunkSourceWebCorehtmlLinkIconCollectorh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/LinkIcon.h (from rev 209612, trunk/Source/WebCore/html/LinkIconCollector.h) (0 => 209613)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/LinkIcon.h         (rev 0)
+++ trunk/Source/WebCore/platform/LinkIcon.h        2016-12-09 18:21:30 UTC (rev 209613)
</span><span class="lines">@@ -0,0 +1,42 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "LinkIconType.h"
+#include "URL.h"
+#include <wtf/Optional.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+struct LinkIcon {
+ URL url;
+ LinkIconType type;
+ String mimeType;
+ std::optional<unsigned> size;
+};
+
+} // namespace WebCore
</ins></span></pre>
</div>
</div>
</body>
</html>