summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
-rw-r--r--WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp9
-rw-r--r--WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h2
-rw-r--r--WebKit/android/jni/WebCoreFrameBridge.cpp19
-rw-r--r--WebKit/android/jni/WebCoreFrameBridge.h2
9 files changed, 72 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)
diff --git a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp
index 92d3294..7554a84 100644
--- a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp
+++ b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp
@@ -243,6 +243,14 @@ void FrameLoaderClientAndroid::dispatchDidReceiveIcon() {
}
}
+void FrameLoaderClientAndroid::dispatchDidReceiveTouchIconURL(const String& url) {
+ ASSERT(m_frame);
+ // Do not report sub frame touch icons
+ if (m_frame->tree() && m_frame->tree()->parent())
+ return;
+ m_webFrame->didReceiveTouchIconURL(url);
+}
+
void FrameLoaderClientAndroid::dispatchDidStartProvisionalLoad() {
notImplemented();
}
@@ -1050,4 +1058,5 @@ void FrameLoaderClientAndroid::didAddIconForPageUrl(const String& pageUrl) {
dispatchDidReceiveIcon();
}
}
+
}
diff --git a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h
index d491750..e0de972 100644
--- a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h
+++ b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.h
@@ -185,6 +185,8 @@ namespace android {
virtual void registerForIconNotification(bool listen = true);
+ virtual void dispatchDidReceiveTouchIconURL(const String& url);
+
// WebIconDatabaseClient api
virtual void didAddIconForPageUrl(const String& pageUrl);
diff --git a/WebKit/android/jni/WebCoreFrameBridge.cpp b/WebKit/android/jni/WebCoreFrameBridge.cpp
index b856e10..f47603b 100644
--- a/WebKit/android/jni/WebCoreFrameBridge.cpp
+++ b/WebKit/android/jni/WebCoreFrameBridge.cpp
@@ -136,6 +136,7 @@ struct WebFrame::JavaBrowserFrame
jmethodID mWindowObjectCleared;
jmethodID mSetProgress;
jmethodID mDidReceiveIcon;
+ jmethodID mDidReceiveTouchIconUrl;
jmethodID mUpdateVisitedHistory;
jmethodID mHandleUrl;
jmethodID mCreateWindow;
@@ -182,6 +183,8 @@ WebFrame::WebFrame(JNIEnv* env, jobject obj, jobject historyList, WebCore::Page*
"(I)V");
mJavaFrame->mDidReceiveIcon = env->GetMethodID(clazz, "didReceiveIcon",
"(Landroid/graphics/Bitmap;)V");
+ mJavaFrame->mDidReceiveTouchIconUrl = env->GetMethodID(clazz, "didReceiveTouchIconUrl",
+ "(Ljava/lang/String;)V");
mJavaFrame->mUpdateVisitedHistory = env->GetMethodID(clazz, "updateVisitedHistory",
"(Ljava/lang/String;Z)V");
mJavaFrame->mHandleUrl = env->GetMethodID(clazz, "handleUrl",
@@ -206,6 +209,7 @@ WebFrame::WebFrame(JNIEnv* env, jobject obj, jobject historyList, WebCore::Page*
LOG_ASSERT(mJavaFrame->mWindowObjectCleared, "Could not find method windowObjectCleared");
LOG_ASSERT(mJavaFrame->mSetProgress, "Could not find method setProgress");
LOG_ASSERT(mJavaFrame->mDidReceiveIcon, "Could not find method didReceiveIcon");
+ LOG_ASSERT(mJavaFrame->mDidReceiveTouchIconUrl, "Could not find method didReceiveTouchIconUrl");
LOG_ASSERT(mJavaFrame->mUpdateVisitedHistory, "Could not find method updateVisitedHistory");
LOG_ASSERT(mJavaFrame->mHandleUrl, "Could not find method handleUrl");
LOG_ASSERT(mJavaFrame->mCreateWindow, "Could not find method createWindow");
@@ -575,6 +579,21 @@ WebFrame::didReceiveIcon(WebCore::Image* icon)
}
void
+WebFrame::didReceiveTouchIconURL(const WebCore::String& url)
+{
+#ifdef ANDROID_INSTRUMENT
+ TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
+#endif
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
+ jstring jUrlStr = env->NewString((unsigned short*)url.characters(),
+ url.length());
+
+ env->CallVoidMethod(mJavaFrame->frame(env).get(),
+ mJavaFrame->mDidReceiveTouchIconUrl, jUrlStr);
+ checkException(env);
+}
+
+void
WebFrame::updateVisitedHistory(const WebCore::KURL& url, bool reload)
{
#ifdef ANDROID_INSTRUMENT
diff --git a/WebKit/android/jni/WebCoreFrameBridge.h b/WebKit/android/jni/WebCoreFrameBridge.h
index 5bfd1fb..6b5c90c 100644
--- a/WebKit/android/jni/WebCoreFrameBridge.h
+++ b/WebKit/android/jni/WebCoreFrameBridge.h
@@ -89,6 +89,8 @@ class WebFrame : public WebCoreRefObject {
const WebCore::String userAgentForURL(const WebCore::KURL* url);
void didReceiveIcon(WebCore::Image* icon);
+
+ void didReceiveTouchIconURL(const WebCore::String& url);
void updateVisitedHistory(const WebCore::KURL& url, bool reload);