summaryrefslogtreecommitdiffstats
path: root/WebCore/html
diff options
context:
space:
mode:
authorLeon Clarke <leonclarke@google.com>2010-07-12 16:00:49 +0100
committerLeon Clarke <leonclarke@google.com>2010-07-12 16:52:19 +0100
commit5d6f8ef31d11ee66598999b1b749ba9ff767e4d5 (patch)
treed6ade236b43a3dd8c80c6ffff695fbc5fea10d71 /WebCore/html
parentf5a7037b5d31f66594af3428b1ffba88b4cc8d3b (diff)
downloadexternal_webkit-5d6f8ef31d11ee66598999b1b749ba9ff767e4d5.zip
external_webkit-5d6f8ef31d11ee66598999b1b749ba9ff767e4d5.tar.gz
external_webkit-5d6f8ef31d11ee66598999b1b749ba9ff767e4d5.tar.bz2
Copy back the upstreamed version of prefetch
https://bugs.webkit.org/show_bug.cgi?id=3652 Change-Id: Ibda522afed15e7581019a198e773785b7cad57ca
Diffstat (limited to 'WebCore/html')
-rw-r--r--WebCore/html/HTMLLinkElement.cpp38
-rw-r--r--WebCore/html/HTMLLinkElement.h31
2 files changed, 12 insertions, 57 deletions
diff --git a/WebCore/html/HTMLLinkElement.cpp b/WebCore/html/HTMLLinkElement.cpp
index 64a52cc..eff250a 100644
--- a/WebCore/html/HTMLLinkElement.cpp
+++ b/WebCore/html/HTMLLinkElement.cpp
@@ -41,9 +41,6 @@
#include "ScriptEventListener.h"
#include "Settings.h"
#include <wtf/StdLibExtras.h>
-#if PLATFORM(ANDROID) && ENABLE(LINK_PREFETCH)
-#include "CachedLinkPrefetch.h"
-#endif
namespace WebCore {
@@ -55,9 +52,6 @@ inline HTMLLinkElement::HTMLLinkElement(const QualifiedName& tagName, Document*
, m_loading(false)
, m_createdByParser(createdByParser)
, m_shouldProcessAfterAttach(false)
-#if PLATFORM(ANDROID) && ENABLE(LINK_PREFETCH)
- , m_timer(this, &HTMLLinkElement::timerFired)
-#endif
{
ASSERT(hasTagName(linkTag));
}
@@ -137,10 +131,6 @@ void HTMLLinkElement::parseMappedAttribute(Attribute* attr)
setDisabledState(!attr->isNull());
else if (attr->name() == onbeforeloadAttr)
setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, attr));
-#if PLATFORM(ANDROID) && ENABLE(LINK_PREFETCH)
- else if (attr->name() == onloadAttr)
- setAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(this, attr));
-#endif
else {
if (attr->name() == titleAttr && m_sheet)
m_sheet->setTitle(attr->value());
@@ -154,7 +144,7 @@ void HTMLLinkElement::tokenizeRelAttribute(const AtomicString& rel, RelAttribute
relAttribute.m_isIcon = false;
relAttribute.m_isAlternate = false;
relAttribute.m_isDNSPrefetch = false;
-#if PLATFORM(ANDROID) && ENABLE(LINK_PREFETCH)
+#if ENABLE(LINK_PREFETCH)
relAttribute.m_isLinkPrefetch = false;
#endif
#ifdef ANDROID_APPLE_TOUCH_ICON
@@ -173,7 +163,7 @@ void HTMLLinkElement::tokenizeRelAttribute(const AtomicString& rel, RelAttribute
#endif
else if (equalIgnoringCase(rel, "dns-prefetch"))
relAttribute.m_isDNSPrefetch = true;
-#if PLATFORM(ANDROID) && ENABLE(LINK_PREFETCH)
+#if ENABLE(LINK_PREFETCH)
else if (equalIgnoringCase(rel, "prefetch"))
relAttribute.m_isLinkPrefetch = true;
#endif
@@ -221,14 +211,9 @@ void HTMLLinkElement::process()
if (m_relAttribute.m_isDNSPrefetch && m_url.isValid() && !m_url.isEmpty())
ResourceHandle::prepareForURL(m_url);
-#if PLATFORM(ANDROID) && ENABLE(LINK_PREFETCH)
- if (m_relAttribute.m_isLinkPrefetch && m_url.isValid()) {
- m_cachedLinkPrefetch = document()->docLoader()->requestLinkPrefetch(m_url);
- m_loading = true;
-
- if (m_cachedLinkPrefetch)
- m_cachedLinkPrefetch->addClient(this);
- }
+#if ENABLE(LINK_PREFETCH)
+ if (m_relAttribute.m_isLinkPrefetch && m_url.isValid())
+ document()->docLoader()->requestLinkPrefetch(m_url);
#endif
bool acceptIfTypeContainsTextCSS = document()->page() && document()->page()->settings() && document()->page()->settings()->treatsAnyTextCSSLinkAsStylesheet();
@@ -393,19 +378,6 @@ bool HTMLLinkElement::isLoading() const
return static_cast<CSSStyleSheet *>(m_sheet.get())->isLoading();
}
-#if PLATFORM(ANDROID) && ENABLE(LINK_PREFETCH)
-void HTMLLinkElement::notifyFinished(CachedResource*)
-{
- if (!m_timer.isActive())
- m_timer.startOneShot(0);
-}
-
-void HTMLLinkElement::timerFired(Timer<HTMLLinkElement>*)
-{
- dispatchEvent(Event::create(eventNames().loadEvent, false, false));
-}
-#endif
-
bool HTMLLinkElement::sheetLoaded()
{
if (!isLoading() && !isDisabled() && !isAlternate()) {
diff --git a/WebCore/html/HTMLLinkElement.h b/WebCore/html/HTMLLinkElement.h
index a2d88c2..8fb93ba 100644
--- a/WebCore/html/HTMLLinkElement.h
+++ b/WebCore/html/HTMLLinkElement.h
@@ -27,16 +27,11 @@
#include "CachedResourceClient.h"
#include "CachedResourceHandle.h"
#include "HTMLElement.h"
-#if PLATFORM(ANDROID) && ENABLE(LINK_PREFETCH)
-#include "Timer.h"
-#endif
namespace WebCore {
class CachedCSSStyleSheet;
-#if PLATFORM(ANDROID) && ENABLE(LINK_PREFETCH)
class CachedLinkPrefetch;
-#endif
class KURL;
class HTMLLinkElement : public HTMLElement, public CachedResourceClient {
@@ -50,15 +45,16 @@ public:
bool m_isTouchIcon;
bool m_isPrecomposedTouchIcon;
#endif
-#if PLATFORM(ANDROID) && ENABLE(LINK_PREFETCH)
+#if ENABLE(LINK_PREFETCH)
bool m_isLinkPrefetch;
#endif
- RelAttribute() : m_isStyleSheet(false), m_isIcon(false), m_isAlternate(false), m_isDNSPrefetch(false)
-#ifdef ANDROID_APPLE_TOUCH_ICON
- , m_isTouchIcon(false), m_isPrecomposedTouchIcon(false)
-#endif
-#if PLATFORM(ANDROID) && ENABLE(LINK_PREFETCH)
+ RelAttribute()
+ : m_isStyleSheet(false)
+ , m_isIcon(false)
+ , m_isAlternate(false)
+ , m_isDNSPrefetch(false)
+#if ENABLE(LINK_PREFETCH)
, m_isLinkPrefetch(false)
#endif
{ };
@@ -99,10 +95,6 @@ private:
// from CachedResourceClient
virtual void setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CachedCSSStyleSheet* sheet);
-#if PLATFORM(ANDROID) && ENABLE(LINK_PREFETCH)
- virtual void notifyFinished(CachedResource*);
-#endif
-
virtual bool sheetLoaded();
bool isAlternate() const { return m_disabledState == Unset && m_relAttribute.m_isAlternate; }
@@ -128,9 +120,6 @@ private:
#endif
private:
-#if PLATFORM(ANDROID) && ENABLE(LINK_PREFETCH)
- void timerFired(Timer<HTMLLinkElement>*);
-#endif
HTMLLinkElement(const QualifiedName&, Document*, bool createdByParser);
enum DisabledState {
@@ -141,9 +130,6 @@ private:
CachedResourceHandle<CachedCSSStyleSheet> m_cachedSheet;
RefPtr<CSSStyleSheet> m_sheet;
-#if PLATFORM(ANDROID) && ENABLE(LINK_PREFETCH)
- CachedResourceHandle<CachedLinkPrefetch> m_cachedLinkPrefetch;
-#endif
KURL m_url;
String m_type;
String m_media;
@@ -152,9 +138,6 @@ private:
bool m_loading;
bool m_createdByParser;
bool m_shouldProcessAfterAttach;
-#if PLATFORM(ANDROID) && ENABLE(LINK_PREFETCH)
- Timer<HTMLLinkElement> m_timer;
-#endif
};
} //namespace