summaryrefslogtreecommitdiffstats
path: root/WebCore/page
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-01-22 10:40:22 +0000
committerBen Murdoch <benm@google.com>2010-01-26 10:27:58 +0000
commit9c3f8716aa3ce8ca612b4200c02a8530cfd599ba (patch)
tree0bd79bee3e85d0ce37cb8eee4f19d365b8a885b0 /WebCore/page
parent09cf43c86944667327521b6be03733519a63a6e0 (diff)
downloadexternal_webkit-9c3f8716aa3ce8ca612b4200c02a8530cfd599ba.zip
external_webkit-9c3f8716aa3ce8ca612b4200c02a8530cfd599ba.tar.gz
external_webkit-9c3f8716aa3ce8ca612b4200c02a8530cfd599ba.tar.bz2
absoluteToLocal works with a page co-ordinate that is relative to the top left of the containing frame's document, so fix a bug in the WebCore touch event handler where the wrong page co-ordinates were being passed to the Touch construtor. This part of the change should be upstreamed to webkit.
Also fix a crash when a touchCancel event is sent to a plugin because touchCancel, like touchend is not guaranteed to have data in touches, but will have data in changedTouches. Change-Id: I5345d7baf4e4325b24fbc5fbe60132dafb80e006
Diffstat (limited to 'WebCore/page')
-rw-r--r--WebCore/page/EventHandler.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp
index a7dc13a..1d5941b 100644
--- a/WebCore/page/EventHandler.cpp
+++ b/WebCore/page/EventHandler.cpp
@@ -2589,8 +2589,8 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event)
for (int i = 0; i < points.size(); ++i) {
const PlatformTouchPoint& point = points[i];
- IntPoint framePoint = documentPointForWindowPoint(m_frame, point.pos());
- HitTestResult result = hitTestResultAtPoint(framePoint, /*allowShadowContent*/ false);
+ IntPoint pagePoint = documentPointForWindowPoint(m_frame, point.pos());
+ HitTestResult result = hitTestResultAtPoint(pagePoint, /*allowShadowContent*/ false);
Node* target = result.innerNode();
// Touch events should not go to text nodes
@@ -2603,8 +2603,13 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event)
if (!doc->hasListenerType(Document::TOUCH_LISTENER))
continue;
- int adjustedPageX = lroundf(framePoint.x() / m_frame->pageZoomFactor());
- int adjustedPageY = lroundf(framePoint.y() / m_frame->pageZoomFactor());
+ if (m_frame != doc->frame()) {
+ // pagePoint should always be relative to the target elements containing frame.
+ pagePoint = documentPointForWindowPoint(doc->frame(), point.pos());
+ }
+
+ int adjustedPageX = lroundf(pagePoint.x() / m_frame->pageZoomFactor());
+ int adjustedPageY = lroundf(pagePoint.y() / m_frame->pageZoomFactor());
if ( (event.type() == TouchStart
#if PLATFORM(ANDROID)
@@ -2614,10 +2619,10 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event)
) && !i) {
m_touchEventTarget = target;
m_firstTouchScreenPos = point.screenPos();
- m_firstTouchPagePos = framePoint;
+ m_firstTouchPagePos = pagePoint;
}
- RefPtr<Touch> touch = Touch::create(m_frame, m_touchEventTarget.get(), point.id(),
+ RefPtr<Touch> touch = Touch::create(doc->frame(), m_touchEventTarget.get(), point.id(),
point.screenPos().x(), point.screenPos().y(),
adjustedPageX, adjustedPageY);