summaryrefslogtreecommitdiffstats
path: root/WebCore/dom/Document.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/dom/Document.cpp')
-rw-r--r--WebCore/dom/Document.cpp74
1 files changed, 20 insertions, 54 deletions
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index f146761..d031853 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -171,12 +171,10 @@
#include "SVGStyleElement.h"
#endif
-#if ENABLE(TOUCH_EVENTS) // Android
-#include "TouchEvent.h"
#if PLATFORM(ANDROID)
+// FIXME: We shouldn't be including this from WebCore!
#include "WebViewCore.h"
#endif
-#endif
#ifdef ANDROID_META_SUPPORT
#include "Settings.h"
@@ -191,6 +189,11 @@
#include "TimeCounter.h"
#endif
+#if ENABLE(TOUCH_EVENTS)
+#include "ChromeClient.h"
+#include "TouchEvent.h"
+#endif
+
#if ENABLE(WML)
#include "WMLDocument.h"
#include "WMLElement.h"
@@ -371,9 +374,6 @@ Document::Document(Frame* frame, bool isXHTML)
, m_hasOpenDatabases(false)
#endif
, m_usingGeolocation(false)
-#ifdef ANDROID_MOBILE
- , mExtraLayoutDelay(0)
-#endif
#if ENABLE(WML)
, m_containsWMLContent(false)
#endif
@@ -431,6 +431,7 @@ Document::Document(Frame* frame, bool isXHTML)
m_processingLoadEvent = false;
m_startTime = currentTime();
m_overMinimumLayoutThreshold = false;
+ m_extraLayoutDelay = 0;
initSecurityContext();
initDNSPrefetch();
@@ -1486,18 +1487,6 @@ void Document::detach()
FrameView* view = m_frame->view();
if (view)
view->detachCustomScrollbars();
-
-#if ENABLE(TOUCH_EVENTS) // Android
- // clean up for the top document
- Page* ownerPage = page();
- if (ownerPage && (m_frame == ownerPage->mainFrame())) {
- m_touchEventListeners.clear();
-#if PLATFORM(ANDROID)
- if (view)
- android::WebViewCore::getWebViewCore(view)->needTouchEvents(false);
-#endif
- }
-#endif
}
// indicate destruction mode, i.e. attached() but renderer == 0
@@ -1881,13 +1870,13 @@ bool Document::shouldScheduleLayout()
int Document::minimumLayoutDelay()
{
if (m_overMinimumLayoutThreshold)
- return 0;
+ return m_extraLayoutDelay;
int elapsed = elapsedTime();
m_overMinimumLayoutThreshold = elapsed > cLayoutScheduleThreshold;
// We'll want to schedule the timer to fire at the minimum layout threshold.
- return max(0, cLayoutScheduleThreshold - elapsed);
+ return max(0, cLayoutScheduleThreshold - elapsed) + m_extraLayoutDelay;
}
int Document::elapsedTime() const
@@ -2260,7 +2249,8 @@ void Document::processMetadataSettings(const String& content)
String key(buffer.substring(keyBegin, keyEnd - keyBegin));
String value(buffer.substring(valueBegin, valueEnd - valueBegin));
- frame()->settings()->setMetadataSettings(key, value);
+ if (frame())
+ frame()->settings()->setMetadataSettings(key, value);
}
}
#endif
@@ -3064,7 +3054,7 @@ PassRefPtr<Event> Document::createEvent(const String& eventType, ExceptionCode&
else if (eventType == "SVGZoomEvents")
event = SVGZoomEvent::create();
#endif
-#if ENABLE(TOUCH_EVENTS) // Android
+#if ENABLE(TOUCH_EVENTS)
else if (eventType == "TouchEvent")
event = TouchEvent::create();
#endif
@@ -3104,6 +3094,14 @@ void Document::addListenerTypeIfNeeded(const AtomicString& eventType)
addListenerType(TRANSITIONEND_LISTENER);
else if (eventType == eventNames().beforeloadEvent)
addListenerType(BEFORELOAD_LISTENER);
+ else if (eventType == eventNames().touchstartEvent
+ || eventType == eventNames().touchmoveEvent
+ || eventType == eventNames().touchendEvent
+ || eventType == eventNames().touchcancelEvent) {
+ addListenerType(TOUCH_LISTENER);
+ if (Page* page = this->page())
+ page->chrome()->client()->needTouchEvents(true);
+ }
}
CSSStyleDeclaration* Document::getOverrideStyle(Element*, const String&)
@@ -4675,38 +4673,6 @@ void Document::parseDNSPrefetchControlHeader(const String& dnsPrefetchControl)
m_haveExplicitlyDisabledDNSPrefetch = true;
}
-#if ENABLE(TOUCH_EVENTS) // Android
-void Document::addTouchEventListener(Node* node)
-{
- // Note: we only keep track of touch listener in the top frame
- if (m_frame && m_frame->tree()->parent()) {
- m_frame->page()->mainFrame()->document()->addTouchEventListener(node);
- } else {
-#if PLATFORM(ANDROID)
- if (m_frame && m_frame->view() && m_touchEventListeners.isEmpty())
- android::WebViewCore::getWebViewCore(m_frame->view())->needTouchEvents(true);
-#endif
- m_touchEventListeners.add(node, 0);
- }
-}
-
-void Document::removeTouchEventListener(Node* node)
-{
- // Note: we only keep track of touch listener in the top frame
- if (m_frame && m_frame->tree()->parent()) {
- m_frame->page()->mainFrame()->document()->removeTouchEventListener(node);
- } else {
-#if PLATFORM(ANDROID)
- if (m_frame && m_frame->view() && m_touchEventListeners.size() == 1 &&
- m_touchEventListeners.contains(node))
- android::WebViewCore::getWebViewCore(m_frame->view())->needTouchEvents(false);
-#endif
- m_touchEventListeners.remove(node);
- }
-}
-
-#endif
-
void Document::reportException(const String& errorMessage, int lineNumber, const String& sourceURL)
{
if (DOMWindow* window = domWindow())