Diff
Modified: trunk/Source/WebCore/ChangeLog (200518 => 200519)
--- trunk/Source/WebCore/ChangeLog 2016-05-06 20:37:16 UTC (rev 200518)
+++ trunk/Source/WebCore/ChangeLog 2016-05-06 20:38:55 UTC (rev 200519)
@@ -1,3 +1,29 @@
+2016-05-06 Anders Carlsson <ander...@apple.com>
+
+ Tidy up the LinkRelAttribute code
+ https://bugs.webkit.org/show_bug.cgi?id=157429
+
+ Reviewed by Sam Weinig.
+
+ Get rid of IconURL.h and move the IconType enumeration inside LinkRelAttribute.
+ Remove the InvalidIcon enum declaration and use WTF::Optional instead.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * dom/IconURL.h: Removed.
+ * html/HTMLLinkElement.cpp:
+ (WebCore::HTMLLinkElement::iconType):
+ (WebCore::HTMLLinkElement::addSubresourceAttributeURLs):
+ * html/HTMLLinkElement.h:
+ * html/LinkRelAttribute.cpp:
+ (WebCore::LinkRelAttribute::LinkRelAttribute):
+ * html/LinkRelAttribute.h:
+ * html/parser/HTMLPreloadScanner.cpp:
+ (WebCore::TokenPreloadScanner::StartTagScanner::relAttributeIsStyleSheet):
+ * loader/FrameLoader.h:
+ * loader/FrameLoaderClient.h:
+ * loader/icon/IconController.cpp:
+ (WebCore::iconFromLinkElements):
+
2016-05-06 Jer Noble <jer.no...@apple.com>
Muted media elements should be allowed to autoplay, even if RequireUserGestureForAudioRateChange is set.
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (200518 => 200519)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-05-06 20:37:16 UTC (rev 200518)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-05-06 20:38:55 UTC (rev 200519)
@@ -1729,7 +1729,6 @@
45830D4E1679B4F800ACF8C3 /* AutoscrollController.h in Headers */ = {isa = PBXBuildFile; fileRef = 45830D4C1679B4F800ACF8C3 /* AutoscrollController.h */; settings = {ATTRIBUTES = (Private, ); }; };
458FE4091589DF0B005609E6 /* RenderSearchField.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 458FE4071589DF0B005609E6 /* RenderSearchField.cpp */; };
458FE40A1589DF0B005609E6 /* RenderSearchField.h in Headers */ = {isa = PBXBuildFile; fileRef = 458FE4081589DF0B005609E6 /* RenderSearchField.h */; };
- 45BAC2B01360BBAB005DA258 /* IconURL.h in Headers */ = {isa = PBXBuildFile; fileRef = 45BAC2AF1360BBAB005DA258 /* IconURL.h */; settings = {ATTRIBUTES = (Private, ); }; };
45FEA5CF156DDE8C00654101 /* Decimal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45FEA5CD156DDE8C00654101 /* Decimal.cpp */; };
45FEA5D0156DDE8C00654101 /* Decimal.h in Headers */ = {isa = PBXBuildFile; fileRef = 45FEA5CE156DDE8C00654101 /* Decimal.h */; settings = {ATTRIBUTES = (Private, ); }; };
4634592C1AC2271000ECB71C /* PowerObserverMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4634592B1AC2271000ECB71C /* PowerObserverMac.cpp */; };
@@ -9272,7 +9271,6 @@
45830D4C1679B4F800ACF8C3 /* AutoscrollController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutoscrollController.h; sourceTree = "<group>"; };
458FE4071589DF0B005609E6 /* RenderSearchField.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSearchField.cpp; sourceTree = "<group>"; };
458FE4081589DF0B005609E6 /* RenderSearchField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSearchField.h; sourceTree = "<group>"; };
- 45BAC2AF1360BBAB005DA258 /* IconURL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IconURL.h; sourceTree = "<group>"; };
45FEA5CD156DDE8C00654101 /* Decimal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Decimal.cpp; sourceTree = "<group>"; };
45FEA5CE156DDE8C00654101 /* Decimal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Decimal.h; sourceTree = "<group>"; };
4634592B1AC2271000ECB71C /* PowerObserverMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PowerObserverMac.cpp; sourceTree = "<group>"; };
@@ -24401,7 +24399,6 @@
7C4189AB1B07C170000FA757 /* GlobalEventHandlers.idl */,
2442BBF81194C9D300D49469 /* HashChangeEvent.h */,
8482B7441198C32E00BFB005 /* HashChangeEvent.idl */,
- 45BAC2AF1360BBAB005DA258 /* IconURL.h */,
C3CF17A015B0063F00276D39 /* IdTargetObserver.cpp */,
C3CF17A115B0063F00276D39 /* IdTargetObserver.h */,
C3CF17A215B0063F00276D39 /* IdTargetObserverRegistry.cpp */,
@@ -26338,7 +26335,6 @@
51E1ECBE0C91C90400DC255B /* IconDatabaseClient.h in Headers */,
513F14540AB634C400094DDF /* IconLoader.h in Headers */,
51E1ECC10C91C90400DC255B /* IconRecord.h in Headers */,
- 45BAC2B01360BBAB005DA258 /* IconURL.h in Headers */,
51BA4ACC1BBC5BDD00DF3D6D /* IDBBackingStore.h in Headers */,
C585A66311D4FAC5004C3E4B /* IDBBindingUtilities.h in Headers */,
517B25AA1CC82B2A0061C011 /* IDBConnectionProxy.h in Headers */,
Deleted: trunk/Source/WebCore/dom/IconURL.h (200518 => 200519)
--- trunk/Source/WebCore/dom/IconURL.h 2016-05-06 20:37:16 UTC (rev 200518)
+++ trunk/Source/WebCore/dom/IconURL.h 2016-05-06 20:38:55 UTC (rev 200519)
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- * Copyright (C) 2015 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:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 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.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
- * OWNER OR 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.
- */
-
-#ifndef IconURL_h
-#define IconURL_h
-
-// FIXME: Rename this header to IconType.h unless we bring back the concept of an "icon URL" structure.
-
-namespace WebCore {
-
-enum IconType {
- InvalidIcon = 0,
- Favicon = 1,
- TouchIcon = 1 << 1,
- TouchPrecomposedIcon = 1 << 2,
-};
-
-}
-
-#endif // IconURL_h
Modified: trunk/Source/WebCore/html/HTMLLinkElement.cpp (200518 => 200519)
--- trunk/Source/WebCore/html/HTMLLinkElement.cpp 2016-05-06 20:37:16 UTC (rev 200518)
+++ trunk/Source/WebCore/html/HTMLLinkElement.cpp 2016-05-06 20:38:55 UTC (rev 200519)
@@ -495,7 +495,7 @@
return getAttribute(typeAttr);
}
-IconType HTMLLinkElement::iconType() const
+Optional<LinkRelAttribute::IconType> HTMLLinkElement::iconType() const
{
return m_relAttribute.iconType;
}
@@ -510,7 +510,7 @@
HTMLElement::addSubresourceAttributeURLs(urls);
// Favicons are handled by a special case in LegacyWebArchive::create()
- if (m_relAttribute.iconType != InvalidIcon)
+ if (m_relAttribute.iconType)
return;
if (!m_relAttribute.isStyleSheet)
Modified: trunk/Source/WebCore/html/HTMLLinkElement.h (200518 => 200519)
--- trunk/Source/WebCore/html/HTMLLinkElement.h 2016-05-06 20:37:16 UTC (rev 200518)
+++ trunk/Source/WebCore/html/HTMLLinkElement.h 2016-05-06 20:38:55 UTC (rev 200519)
@@ -54,7 +54,7 @@
const AtomicString& type() const;
- IconType iconType() const;
+ Optional<LinkRelAttribute::IconType> iconType() const;
// the icon size string as parsed from the HTML attribute
String iconSizes();
Modified: trunk/Source/WebCore/html/LinkRelAttribute.cpp (200518 => 200519)
--- trunk/Source/WebCore/html/LinkRelAttribute.cpp 2016-05-06 20:37:16 UTC (rev 200518)
+++ trunk/Source/WebCore/html/LinkRelAttribute.cpp 2016-05-06 20:38:55 UTC (rev 200519)
@@ -46,13 +46,11 @@
if (equalLettersIgnoringASCIICase(rel, "stylesheet"))
isStyleSheet = true;
else if (equalLettersIgnoringASCIICase(rel, "icon") || equalLettersIgnoringASCIICase(rel, "shortcut icon"))
- iconType = Favicon;
-#if ENABLE(TOUCH_ICON_LOADING)
+ iconType = IconType::Favicon;
else if (equalLettersIgnoringASCIICase(rel, "apple-touch-icon"))
- iconType = TouchIcon;
+ iconType = IconType::TouchIcon;
else if (equalLettersIgnoringASCIICase(rel, "apple-touch-icon-precomposed"))
- iconType = TouchPrecomposedIcon;
-#endif
+ iconType = IconType::TouchPrecomposedIcon;
else if (equalLettersIgnoringASCIICase(rel, "dns-prefetch"))
isDNSPrefetch = true;
else if (RuntimeEnabledFeatures::sharedFeatures().linkPreloadEnabled() && equalLettersIgnoringASCIICase(rel, "preload"))
@@ -72,13 +70,11 @@
else if (equalLettersIgnoringASCIICase(word, "alternate"))
isAlternate = true;
else if (equalLettersIgnoringASCIICase(word, "icon"))
- iconType = Favicon;
-#if ENABLE(TOUCH_ICON_LOADING)
+ iconType = IconType::Favicon;
else if (equalLettersIgnoringASCIICase(word, "apple-touch-icon"))
- iconType = TouchIcon;
+ iconType = IconType::TouchIcon;
else if (equalLettersIgnoringASCIICase(word, "apple-touch-icon-precomposed"))
- iconType = TouchPrecomposedIcon;
-#endif
+ iconType = IconType::TouchPrecomposedIcon;
#if ENABLE(LINK_PREFETCH)
else if (equalLettersIgnoringASCIICase(word, "prefetch"))
isLinkPrefetch = true;
Modified: trunk/Source/WebCore/html/LinkRelAttribute.h (200518 => 200519)
--- trunk/Source/WebCore/html/LinkRelAttribute.h 2016-05-06 20:37:16 UTC (rev 200518)
+++ trunk/Source/WebCore/html/LinkRelAttribute.h 2016-05-06 20:38:55 UTC (rev 200519)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 Google Inc. All rights reserved.
+ * 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
@@ -29,17 +30,22 @@
*
*/
-#ifndef LinkRelAttribute_h
-#define LinkRelAttribute_h
+#pragma once
-#include "IconURL.h"
#include <wtf/Forward.h>
+#include <wtf/Optional.h>
namespace WebCore {
struct LinkRelAttribute {
+ enum class IconType {
+ Favicon,
+ TouchIcon,
+ TouchPrecomposedIcon,
+ };
+
bool isStyleSheet { false };
- IconType iconType { InvalidIcon };
+ Optional<IconType> iconType;
bool isAlternate { false };
bool isDNSPrefetch { false };
bool isLinkPreload { false };
@@ -53,5 +59,3 @@
};
}
-
-#endif
Modified: trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp (200518 => 200519)
--- trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp 2016-05-06 20:37:16 UTC (rev 200518)
+++ trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp 2016-05-06 20:38:55 UTC (rev 200519)
@@ -241,7 +241,7 @@
static bool relAttributeIsStyleSheet(const String& attributeValue)
{
LinkRelAttribute parsedAttribute { attributeValue };
- return parsedAttribute.isStyleSheet && !parsedAttribute.isAlternate && parsedAttribute.iconType == InvalidIcon && !parsedAttribute.isDNSPrefetch;
+ return parsedAttribute.isStyleSheet && !parsedAttribute.isAlternate && !parsedAttribute.iconType && !parsedAttribute.isDNSPrefetch;
}
void setUrlToLoad(const String& value, bool allowReplacement = false)
Modified: trunk/Source/WebCore/loader/FrameLoader.h (200518 => 200519)
--- trunk/Source/WebCore/loader/FrameLoader.h 2016-05-06 20:37:16 UTC (rev 200518)
+++ trunk/Source/WebCore/loader/FrameLoader.h 2016-05-06 20:38:55 UTC (rev 200519)
@@ -35,7 +35,6 @@
#include "CachePolicy.h"
#include "FrameLoaderStateMachine.h"
#include "FrameLoaderTypes.h"
-#include "IconURL.h"
#include "LayoutMilestones.h"
#include "MixedContentChecker.h"
#include "Page.h"
Modified: trunk/Source/WebCore/loader/FrameLoaderClient.h (200518 => 200519)
--- trunk/Source/WebCore/loader/FrameLoaderClient.h 2016-05-06 20:37:16 UTC (rev 200518)
+++ trunk/Source/WebCore/loader/FrameLoaderClient.h 2016-05-06 20:38:55 UTC (rev 200519)
@@ -31,7 +31,6 @@
#define FrameLoaderClient_h
#include "FrameLoaderTypes.h"
-#include "IconURL.h"
#include "LayoutMilestones.h"
#include "ResourceLoadPriority.h"
#include <functional>
@@ -52,8 +51,6 @@
#endif
#endif
-typedef class _jobject* jobject;
-
#if PLATFORM(COCOA)
OBJC_CLASS NSArray;
OBJC_CLASS NSCachedURLResponse;
Modified: trunk/Source/WebCore/loader/icon/IconController.cpp (200518 => 200519)
--- trunk/Source/WebCore/loader/icon/IconController.cpp 2016-05-06 20:37:16 UTC (rev 200518)
+++ trunk/Source/WebCore/loader/icon/IconController.cpp 2016-05-06 20:38:55 UTC (rev 200519)
@@ -79,8 +79,10 @@
return result;
for (auto& linkElement : childrenOfType<HTMLLinkElement>(*head)) {
- if (!(linkElement.iconType() & Favicon))
+ if (!linkElement.iconType())
continue;
+ if (*linkElement.iconType() != LinkRelAttribute::IconType::Favicon)
+ continue;
if (linkElement.href().isEmpty())
continue;
result = linkElement.href();