diff options
Diffstat (limited to 'WebCore/html')
-rw-r--r-- | WebCore/html/HTMLLinkElement.cpp | 21 | ||||
-rw-r--r-- | WebCore/html/HTMLLinkElement.h | 7 | ||||
-rw-r--r-- | WebCore/html/PreloadScanner.cpp | 6 |
3 files changed, 34 insertions, 0 deletions
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; } |