[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9
benm at google.com
benm at google.com
Thu Feb 4 21:30:57 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 0086cf026b16f1f32d3d638fbb1e34a09386b011
Author: benm at google.com <benm at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Jan 28 11:00:35 2010 +0000
[Android] [Qt] Touch event page co-ordinates are incorrect when touch is received in an iframe.
https://bugs.webkit.org/show_bug.cgi?id=34162
Reviewed by Simon Hausmann.
WebCore:
The pageX/pageY co-ordinates of a touch event should be relative to the containing frame, not the main frame. This change implements that and also updates the existing touch-inside-iframe test to also examine the page co-ordinates.
* dom/Touch.cpp:
(WebCore::Touch::Touch): Remove dead code.
* dom/Touch.h: Remove dead code.
* page/EventHandler.cpp:
(WebCore::EventHandler::handleTouchEvent): Rename framePoint to pagePoint, as it seems a clearer name. Also adjust the pagePoint to be relative to the touch target element's containing frame rather than the main frame.
* platform/PlatformTouchEvent.h: Rename Android specific constructor parameter to better reflect it's contents.
* platform/PlatformTouchPoint.h: Ditto.
* platform/android/PlatformTouchEventAndroid.cpp: Ditto.
* platform/android/PlatformTouchPointAndroid.cpp: Ditto.
LayoutTests:
Update the existing iframe touch event test to also examine the page co-ordinates of the touch that is received.
* fast/events/touch/resources/touch-inside-iframe2.html:
* fast/events/touch/touch-inside-iframe-expected.txt:
* fast/events/touch/touch-inside-iframe.html:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53994 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 55acebd..cb682e2 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2010-01-28 Ben Murdoch <benm at google.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Android] [Qt] Touch event page co-ordinates are incorrect when touch is received in an iframe.
+ https://bugs.webkit.org/show_bug.cgi?id=34162
+
+ Update the existing iframe touch event test to also examine the page co-ordinates of the touch that is received.
+
+ * fast/events/touch/resources/touch-inside-iframe2.html:
+ * fast/events/touch/touch-inside-iframe-expected.txt:
+ * fast/events/touch/touch-inside-iframe.html:
+
2010-01-28 Xan Lopez <xlopez at igalia.com>
[GTK] Can DnD files to our filechooser widget (<input type="file">)
diff --git a/LayoutTests/fast/events/touch/resources/touch-inside-iframe2.html b/LayoutTests/fast/events/touch/resources/touch-inside-iframe2.html
index d1114bc..34bc461 100644
--- a/LayoutTests/fast/events/touch/resources/touch-inside-iframe2.html
+++ b/LayoutTests/fast/events/touch/resources/touch-inside-iframe2.html
@@ -1,8 +1,8 @@
<html>
-<body>
-<div id='mydiv' style='width:100px;height:100px;'></div>
+<body onload="parent.runTest()">
+<div id='mydiv' style='width:100px;height:100px;position:absolute;top:0px; left:0px; background-color:blue;'></div>
<script type='text/javascript'>
-document.getElementById('mydiv').addEventListener('touchstart', function() { parent.testComplete(); }, false);
+document.getElementById('mydiv').addEventListener('touchstart', function() { parent.testComplete(event); }, false);
</script>
</body>
</html>
diff --git a/LayoutTests/fast/events/touch/touch-inside-iframe-expected.txt b/LayoutTests/fast/events/touch/touch-inside-iframe-expected.txt
index f76f21f..17b655e 100644
--- a/LayoutTests/fast/events/touch/touch-inside-iframe-expected.txt
+++ b/LayoutTests/fast/events/touch/touch-inside-iframe-expected.txt
@@ -1,4 +1,12 @@
-Test that touch events are sent to iframes that listen for them even if the parent frame does not listen for them.
-PASS
+Test iframes receive touches correctly.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS touch.pageX is 50
+PASS touch.pageY is 50
+PASS successfullyParsed is true
+
+TEST COMPLETE
diff --git a/LayoutTests/fast/events/touch/touch-inside-iframe.html b/LayoutTests/fast/events/touch/touch-inside-iframe.html
index 706108c..b9162c3 100644
--- a/LayoutTests/fast/events/touch/touch-inside-iframe.html
+++ b/LayoutTests/fast/events/touch/touch-inside-iframe.html
@@ -1,31 +1,42 @@
<html>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+<script src="../../js/resources/js-test-post-function.js"></script>
+<body>
+<iframe style="position:absolute; top:100px; left:100px;" src="./resources/touch-inside-iframe2.html"></iframe>
+<p id="description"></p>
+<div id="console"></div>
<script type="text/javascript">
-if (window.layoutTestController)
+description('Test iframes receive touches correctly.');
+
+var touch = null;
+
+function testComplete(event)
{
- layoutTestController.dumpAsText();
- layoutTestController.waitUntilDone();
+ touch = event.touches[0];
+ shouldBe("touch.pageX", "50");
+ shouldBe("touch.pageY", "50");
+ isSuccessfullyParsed();
+ layoutTestController.notifyDone();
}
-function runTest()
-{
- if (window.eventSender)
- {
- eventSender.addTouchPoint(50, 150);
+function runTest() {
+ if (window.eventSender) {
+ // Touch the center of the div in the iframe.
+ // 100px is offset to iframe in main frame,
+ // 2px for the iframe border, 50px to get to centre of the div.
+ eventSender.addTouchPoint(152, 152);
eventSender.touchStart();
+ } else {
+ debug('This test requires DRT.');
}
}
-function testComplete()
-{
- document.getElementById('console').innerText = 'PASS';
- layoutTestController.notifyDone();
+if (window.layoutTestController) {
+ layoutTestController.waitUntilDone();
}
+
+var successfullyParsed = true;
</script>
-<body onload="runTest();">
-<p>Test that touch events are sent to iframes that listen for them even if the parent frame does not listen for them.</p>
-<div id="console">
-<p>FAIL - no touchstart received!</p>
-</div>
-<iframe src="./resources/touch-inside-iframe2.html" />
</body>
</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 6afcb7c..686f16f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2010-01-28 Ben Murdoch <benm at google.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Android] [Qt] Touch event page co-ordinates are incorrect when touch is received in an iframe.
+ https://bugs.webkit.org/show_bug.cgi?id=34162
+
+ The pageX/pageY co-ordinates of a touch event should be relative to the containing frame, not the main frame. This change implements that and also updates the existing touch-inside-iframe test to also examine the page co-ordinates.
+
+ * dom/Touch.cpp:
+ (WebCore::Touch::Touch): Remove dead code.
+ * dom/Touch.h: Remove dead code.
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::handleTouchEvent): Rename framePoint to pagePoint, as it seems a clearer name. Also adjust the pagePoint to be relative to the touch target element's containing frame rather than the main frame.
+ * platform/PlatformTouchEvent.h: Rename Android specific constructor parameter to better reflect it's contents.
+ * platform/PlatformTouchPoint.h: Ditto.
+ * platform/android/PlatformTouchEventAndroid.cpp: Ditto.
+ * platform/android/PlatformTouchPointAndroid.cpp: Ditto.
+
2010-01-28 Yury Semikhatsky <yurys at chromium.org>
Reviewed by Pavel Feldman.
diff --git a/WebCore/dom/Touch.cpp b/WebCore/dom/Touch.cpp
index 41d5c19..4ea83da 100644
--- a/WebCore/dom/Touch.cpp
+++ b/WebCore/dom/Touch.cpp
@@ -55,11 +55,10 @@ static int contentsY(Frame* frame)
Touch::Touch(Frame* frame, EventTarget* target, unsigned identifier,
int screenX, int screenY, int pageX, int pageY)
- : m_frame(frame)
- , m_target(target)
+ : m_target(target)
, m_identifier(identifier)
- , m_clientX(pageX - contentsX(m_frame.get()))
- , m_clientY(pageY - contentsY(m_frame.get()))
+ , m_clientX(pageX - contentsX(frame))
+ , m_clientY(pageY - contentsY(frame))
, m_screenX(screenX)
, m_screenY(screenY)
, m_pageX(pageX)
@@ -67,16 +66,6 @@ Touch::Touch(Frame* frame, EventTarget* target, unsigned identifier,
{
}
-void Touch::updateLocation(int screenX, int screenY, int pageX, int pageY)
-{
- m_clientX = pageX - contentsX(m_frame.get());
- m_clientY = pageY - contentsY(m_frame.get());
- m_screenX = screenX;
- m_screenY = screenY;
- m_pageX = pageX;
- m_pageY = pageY;
-}
-
} // namespace WebCore
#endif
diff --git a/WebCore/dom/Touch.h b/WebCore/dom/Touch.h
index cf39faf..ceb8ae7 100644
--- a/WebCore/dom/Touch.h
+++ b/WebCore/dom/Touch.h
@@ -45,9 +45,6 @@ public:
screenY, pageX, pageY));
}
- void updateLocation(int screenX, int screenY, int pageX, int pageY);
-
- Frame* frame() const { return m_frame.get(); }
EventTarget* target() const { return m_target.get(); }
unsigned identifier() const { return m_identifier; }
int clientX() const { return m_clientX; }
@@ -61,7 +58,6 @@ private:
Touch(Frame* frame, EventTarget* target, unsigned identifier,
int screenX, int screenY, int pageX, int pageY);
- RefPtr<Frame> m_frame;
RefPtr<EventTarget> m_target;
unsigned m_identifier;
int m_clientX;
diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp
index 49df1d4..9e4d47f 100644
--- a/WebCore/page/EventHandler.cpp
+++ b/WebCore/page/EventHandler.cpp
@@ -2549,8 +2549,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
@@ -2563,17 +2563,22 @@ 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());
- RefPtr<Touch> touch = Touch::create(m_frame, target, point.id(),
+ RefPtr<Touch> touch = Touch::create(doc->frame(), target, point.id(),
point.screenPos().x(), point.screenPos().y(),
adjustedPageX, adjustedPageY);
if (event.type() == TouchStart && !i) {
m_touchEventTarget = target;
m_firstTouchScreenPos = point.screenPos();
- m_firstTouchPagePos = framePoint;
+ m_firstTouchPagePos = pagePoint;
}
if (point.state() == PlatformTouchPoint::TouchReleased)
diff --git a/WebCore/platform/PlatformTouchEvent.h b/WebCore/platform/PlatformTouchEvent.h
index 0563197..0d2d035 100644
--- a/WebCore/platform/PlatformTouchEvent.h
+++ b/WebCore/platform/PlatformTouchEvent.h
@@ -56,7 +56,7 @@ public:
#if PLATFORM(QT)
PlatformTouchEvent(QTouchEvent*);
#elif PLATFORM(ANDROID)
- PlatformTouchEvent(const IntPoint& absolutePagePos, TouchEventType, PlatformTouchPoint::State);
+ PlatformTouchEvent(const IntPoint& windowPos, TouchEventType, PlatformTouchPoint::State);
#endif
TouchEventType type() const { return m_type; }
diff --git a/WebCore/platform/PlatformTouchPoint.h b/WebCore/platform/PlatformTouchPoint.h
index 53bd8ae..2df9e31 100644
--- a/WebCore/platform/PlatformTouchPoint.h
+++ b/WebCore/platform/PlatformTouchPoint.h
@@ -47,7 +47,7 @@ public:
#if PLATFORM(QT)
PlatformTouchPoint(const QTouchEvent::TouchPoint&);
#elif PLATFORM(ANDROID)
- PlatformTouchPoint(const IntPoint& absolutePagePos, State);
+ PlatformTouchPoint(const IntPoint& windowPos, State);
#endif
int id() const { return m_id; }
diff --git a/WebCore/platform/android/PlatformTouchEventAndroid.cpp b/WebCore/platform/android/PlatformTouchEventAndroid.cpp
index e4af8a3..65d787d 100644
--- a/WebCore/platform/android/PlatformTouchEventAndroid.cpp
+++ b/WebCore/platform/android/PlatformTouchEventAndroid.cpp
@@ -30,14 +30,14 @@
namespace WebCore {
-PlatformTouchEvent::PlatformTouchEvent(const IntPoint& absolutePagePos, TouchEventType type, PlatformTouchPoint::State state)
+PlatformTouchEvent::PlatformTouchEvent(const IntPoint& windowPos, TouchEventType type, PlatformTouchPoint::State state)
: m_type(type)
, m_ctrlKey(false)
, m_altKey(false)
, m_shiftKey(false)
, m_metaKey(false)
{
- m_touchPoints.append(PlatformTouchPoint(absolutePagePos, state));
+ m_touchPoints.append(PlatformTouchPoint(windowPos, state));
}
}
diff --git a/WebCore/platform/android/PlatformTouchPointAndroid.cpp b/WebCore/platform/android/PlatformTouchPointAndroid.cpp
index d790855..f134c0e 100644
--- a/WebCore/platform/android/PlatformTouchPointAndroid.cpp
+++ b/WebCore/platform/android/PlatformTouchPointAndroid.cpp
@@ -30,11 +30,11 @@
namespace WebCore {
-PlatformTouchPoint::PlatformTouchPoint(const IntPoint& absolutePagePos, State state)
+PlatformTouchPoint::PlatformTouchPoint(const IntPoint& windowPos, State state)
: m_id(0)
, m_state(state)
- , m_screenPos(absolutePagePos)
- , m_pos(absolutePagePos) { }
+ , m_screenPos(windowPos)
+ , m_pos(windowPos) { }
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list