summaryrefslogtreecommitdiffstats
path: root/WebCore
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore')
-rw-r--r--WebCore/WebCorePrefixAndroid.h3
-rw-r--r--WebCore/html/HTMLLinkElement.cpp21
-rw-r--r--WebCore/html/HTMLLinkElement.h7
-rw-r--r--WebCore/html/PreloadScanner.cpp6
-rw-r--r--WebCore/loader/FrameLoaderClient.h3
5 files changed, 40 insertions, 0 deletions
diff --git a/WebCore/WebCorePrefixAndroid.h b/WebCore/WebCorePrefixAndroid.h
index fb01e21..a23718f 100644
--- a/WebCore/WebCorePrefixAndroid.h
+++ b/WebCore/WebCorePrefixAndroid.h
@@ -147,3 +147,6 @@ typedef unsigned char flex_uint8_t;
// Animated GIF support.
#define ANDROID_ANIMATED_GIF
+
+// apple-touch-icon support in <link> tags
+#define ANDROID_APPLE_TOUCH_ICON
diff --git a/WebCore/html/HTMLLinkElement.cpp b/WebCore/html/HTMLLinkElement.cpp
index 76a9703..a1ebbc5 100644
--- a/WebCore/html/HTMLLinkElement.cpp
+++ b/WebCore/html/HTMLLinkElement.cpp
@@ -52,6 +52,9 @@ HTMLLinkElement::HTMLLinkElement(const QualifiedName& qName, Document *doc, bool
, m_alternate(false)
, m_isStyleSheet(false)
, m_isIcon(false)
+#ifdef ANDROID_APPLE_TOUCH_ICON
+ , m_isTouchIcon(false)
+#endif
, m_isDNSPrefetch(false)
, m_createdByParser(createdByParser)
{
@@ -113,7 +116,11 @@ StyleSheet* HTMLLinkElement::sheet() const
void HTMLLinkElement::parseMappedAttribute(MappedAttribute *attr)
{
if (attr->name() == relAttr) {
+#ifdef ANDROID_APPLE_TOUCH_ICON
+ tokenizeRelAttribute(attr->value(), m_isStyleSheet, m_alternate, m_isIcon, m_isTouchIcon, m_isDNSPrefetch);
+#else
tokenizeRelAttribute(attr->value(), m_isStyleSheet, m_alternate, m_isIcon, m_isDNSPrefetch);
+#endif
process();
} else if (attr->name() == hrefAttr) {
m_url = document()->completeURL(parseURL(attr->value()));
@@ -133,7 +140,11 @@ void HTMLLinkElement::parseMappedAttribute(MappedAttribute *attr)
}
}
+#ifdef ANDROID_APPLE_TOUCH_ICON
+void HTMLLinkElement::tokenizeRelAttribute(const AtomicString& rel, bool& styleSheet, bool& alternate, bool& icon, bool& touchIcon, bool& dnsPrefetch)
+#else
void HTMLLinkElement::tokenizeRelAttribute(const AtomicString& rel, bool& styleSheet, bool& alternate, bool& icon, bool& dnsPrefetch)
+#endif
{
styleSheet = false;
icon = false;
@@ -143,6 +154,10 @@ void HTMLLinkElement::tokenizeRelAttribute(const AtomicString& rel, bool& styleS
styleSheet = true;
else if (equalIgnoringCase(rel, "icon") || equalIgnoringCase(rel, "shortcut icon"))
icon = true;
+#ifdef ANDROID_APPLE_TOUCH_ICON
+ else if (equalIgnoringCase(rel, "apple-touch-icon"))
+ touchIcon = true;
+#endif
else if (equalIgnoringCase(rel, "dns-prefetch"))
dnsPrefetch = true;
else if (equalIgnoringCase(rel, "alternate stylesheet") || equalIgnoringCase(rel, "stylesheet alternate")) {
@@ -178,6 +193,12 @@ void HTMLLinkElement::process()
if (m_isIcon && m_url.isValid() && !m_url.isEmpty())
document()->setIconURL(m_url.string(), type);
+#ifdef ANDROID_APPLE_TOUCH_ICON
+ if (m_isTouchIcon && m_url.isValid() && !m_url.isEmpty())
+ document()->frame()->loader()->client()
+ ->dispatchDidReceiveTouchIconURL(m_url.string());
+#endif
+
if (m_isDNSPrefetch && m_url.isValid() && !m_url.isEmpty())
prefetchDNS(m_url.host());
diff --git a/WebCore/html/HTMLLinkElement.h b/WebCore/html/HTMLLinkElement.h
index aacac92..acecc92 100644
--- a/WebCore/html/HTMLLinkElement.h
+++ b/WebCore/html/HTMLLinkElement.h
@@ -93,7 +93,11 @@ public:
virtual bool isURLAttribute(Attribute*) const;
+#ifdef ANDROID_APPLE_TOUCH_ICON
+ static void tokenizeRelAttribute(const AtomicString& value, bool& stylesheet, bool& alternate, bool& icon, bool& touchIcon, bool& dnsPrefetch);
+#else
static void tokenizeRelAttribute(const AtomicString& value, bool& stylesheet, bool& alternate, bool& icon, bool& dnsPrefetch);
+#endif
virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
@@ -110,6 +114,9 @@ protected:
bool m_alternate;
bool m_isStyleSheet;
bool m_isIcon;
+#ifdef ANDROID_APPLE_TOUCH_ICON
+ bool m_isTouchIcon;
+#endif
bool m_isDNSPrefetch;
bool m_createdByParser;
};
diff --git a/WebCore/html/PreloadScanner.cpp b/WebCore/html/PreloadScanner.cpp
index 1c1d28a..6ea4451 100644
--- a/WebCore/html/PreloadScanner.cpp
+++ b/WebCore/html/PreloadScanner.cpp
@@ -707,8 +707,14 @@ void PreloadScanner::processAttribute()
bool alternate = false;
bool icon = false;
bool dnsPrefetch = false;
+#ifdef ANDROID_APPLE_TOUCH_ICON
+ bool touchIcon = false;
+ HTMLLinkElement::tokenizeRelAttribute(value, styleSheet, alternate, icon, touchIcon, dnsPrefetch);
+ m_linkIsStyleSheet = styleSheet && !alternate && !icon && !touchIcon && !dnsPrefetch;
+#else
HTMLLinkElement::tokenizeRelAttribute(value, styleSheet, alternate, icon, dnsPrefetch);
m_linkIsStyleSheet = styleSheet && !alternate && !icon && !dnsPrefetch;
+#endif
} else if (attribute == charsetAttr)
m_charset = value;
}
diff --git a/WebCore/loader/FrameLoaderClient.h b/WebCore/loader/FrameLoaderClient.h
index 5e5191b..e64dee9 100644
--- a/WebCore/loader/FrameLoaderClient.h
+++ b/WebCore/loader/FrameLoaderClient.h
@@ -222,6 +222,9 @@ namespace WebCore {
virtual void didPerformFirstNavigation() const = 0; // "Navigation" here means a transition from one page to another that ends up in the back/forward list.
virtual void registerForIconNotification(bool listen = true) = 0;
+#ifdef ANDROID_APPLE_TOUCH_ICON
+ virtual void dispatchDidReceiveTouchIconURL(const String& url) = 0;
+#endif
#if PLATFORM(MAC)
#if ENABLE(MAC_JAVA_BRIDGE)