Diff
Modified: trunk/LayoutTests/ChangeLog (128998 => 128999)
--- trunk/LayoutTests/ChangeLog 2012-09-19 14:04:58 UTC (rev 128998)
+++ trunk/LayoutTests/ChangeLog 2012-09-19 14:08:21 UTC (rev 128999)
@@ -1,3 +1,22 @@
+2012-09-19 Rick Byers <[email protected]>
+
+ Do touch adjustment on GestureTapDown
+ https://bugs.webkit.org/show_bug.cgi?id=96677
+
+ Reviewed by Antonio Gomes.
+
+ Make a few tweaks to the touchadjustment.js infrastructure to make it
+ simpler and easier to use. Add a test for touch-adjustment of
+ GestureTapDown events (based on touch-links-longpress).
+
+ * touchadjustment/resources/touchadjustment.js:
+ (touchPoint.return.left.x.radiusX.top.y.radiusY.width.radiusX.2.height.radiusY.2.get x):
+ (touchPoint.return.get y):
+ (touchPoint):
+ (offsetTouchPoint):
+ * touchadjustment/touch-links-active-expected.txt: Added.
+ * touchadjustment/touch-links-active.html: Added.
+
2012-09-19 Christophe Dumez <[email protected]>
[EFL] Skip fast/dom/message-port-deleted-by-accessor.html
Modified: trunk/LayoutTests/platform/qt/Skipped (128998 => 128999)
--- trunk/LayoutTests/platform/qt/Skipped 2012-09-19 14:04:58 UTC (rev 128998)
+++ trunk/LayoutTests/platform/qt/Skipped 2012-09-19 14:08:21 UTC (rev 128999)
@@ -425,6 +425,10 @@
# https://bugs.webkit.org/show_bug.cgi?id=87088
fast/js/names.html
+# Don't have GestureLongPress, GestureTapCancel event types
+touchadjustment/touch-links-longpress.html
+touchadjustment/touch-links-active.html
+
# =========================================================================== #
# Feature not yet supported. #
# =========================================================================== #
@@ -2738,9 +2742,6 @@
# ENABLE(WIDGET_REGION) is disabled
fast/css/widget-region-parser.html
-# https://bugs.webkit.org/show_bug.cgi?id=92914
-touchadjustment/touch-links-longpress.html
-
# [Qt][GTK] REGRESSION(r125251): It made svg/custom/use-instanceRoot-as-event-target.xhtml assert and flakey
# https://bugs.webkit.org/show_bug.cgi?id=93812
svg/custom/use-instanceRoot-as-event-target.xhtml
Modified: trunk/LayoutTests/touchadjustment/resources/touchadjustment.js (128998 => 128999)
--- trunk/LayoutTests/touchadjustment/resources/touchadjustment.js 2012-09-19 14:04:58 UTC (rev 128998)
+++ trunk/LayoutTests/touchadjustment/resources/touchadjustment.js 2012-09-19 14:08:21 UTC (rev 128999)
@@ -96,12 +96,15 @@
{
if (!radiusY)
radiusY = radiusX;
- var touchpoint = new Object();
- touchpoint.left = x - radiusX;
- touchpoint.top = y - radiusY;
- touchpoint.width = radiusX * 2;
- touchpoint.height = radiusY * 2;
- return touchpoint;
+
+ return {
+ left: x - radiusX,
+ top: y - radiusY,
+ width: radiusX * 2,
+ height: radiusY * 2,
+ get x() { return this.left + this.width/2; },
+ get y() { return this.top + this.height/2; }
+ };
}
function offsetTouchPoint(bounds, relativePosition, touchOffset, touchRadiusX, touchRadiusY)
@@ -109,9 +112,10 @@
if (!touchRadiusY)
touchRadiusY = touchRadiusX;
- var touchpoint = {left : bounds.left, top: bounds.top };
+ // Start with the center of the touch at the top-left of the bounds.
+ var touchpoint = touchPoint(bounds.left, bounds.top, touchRadiusX, touchRadiusY);
- // Set center point for touch.
+ // Adjust the touch point as requested.
switch (relativePosition) {
case 'center':
touchpoint.left += bounds.width / 2;
@@ -149,12 +153,6 @@
touchpoint.left += bounds.width / 2;
touchpoint.top += bounds.height + touchOffset;
}
- // Adjust from touch center to top-left corner.
- touchpoint.left -= touchRadiusX;
- touchpoint.top -= touchRadiusY;
- touchpoint.width = 2 * touchRadiusX;
- touchpoint.height = 2 * touchRadiusY;
-
return touchpoint;
}
Added: trunk/LayoutTests/touchadjustment/touch-links-active-expected.txt (0 => 128999)
--- trunk/LayoutTests/touchadjustment/touch-links-active-expected.txt (rev 0)
+++ trunk/LayoutTests/touchadjustment/touch-links-active-expected.txt 2012-09-19 14:08:21 UTC (rev 128999)
@@ -0,0 +1,17 @@
+Tests that tapDown will trigger the active state.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Testing indirect hits.
+PASS isLinkActive() is true
+PASS isLinkActive() is true
+PASS isLinkActive() is true
+Testing direct hits.
+PASS isLinkActive() is true
+PASS isLinkActive() is true
+PASS isLinkActive() is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/touchadjustment/touch-links-active.html (0 => 128999)
--- trunk/LayoutTests/touchadjustment/touch-links-active.html (rev 0)
+++ trunk/LayoutTests/touchadjustment/touch-links-active.html 2012-09-19 14:08:21 UTC (rev 128999)
@@ -0,0 +1,144 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Touch Adjustment : Testing that active will be set on a tapDown - bug 96677</title>
+ <script src=""
+ <script src=""
+ <style>
+ #sandbox {
+ position: absolute;
+ left: 0px;
+ top: 100px;
+ }
+ a {
+ background-color: rgb(255,255,255);
+ }
+ a:active {
+ background-color: rgb(0,0,255);
+ }
+ </style>
+</head>
+
+<body>
+
+<div id="sandbox">
+<p><a href="" id="link1">I</a> propose to consider <a href="" id="link2">the question</a>, "Can machines think?"<br>This should begin with definitions of the meaning of the terms "machine" and <a href="" id="link3">"think."</a></p>
+</div>
+
+<p id='description'></p>
+<div id='console'></div>
+
+<script>
+ var element;
+ var adjustedNode;
+ // Set up shortcut access to elements
+ var e = {};
+ ['sandbox', 'link1', 'link2', 'link3'].forEach(function(a) {
+ e[a] = document.getElementById(a);
+ });
+
+ var curElement;
+
+ function isLinkActive()
+ {
+ // These need to match the background-color used above, after round-tripping.
+ var defaultColor = "rgb(255, 255, 255)";
+ var activeColor = "rgb(0, 0, 255)";
+
+ color = window.getComputedStyle(curElement).backgroundColor;
+ if (color == activeColor)
+ return true;
+ if (color != defaultColor)
+ testFailed('Got unexpected backgroundColor: ' + color);
+ return false;
+ }
+
+ function testTapDown(touchpoint, element)
+ {
+ curElement = element;
+ if (isLinkActive()) testFailed('Link unexpectedly active on entry');
+ eventSender.gestureTapDown(touchpoint.x, touchpoint.y, touchpoint.width, touchpoint.height);
+ shouldBeTrue("isLinkActive()");
+ eventSender.gestureTapCancel(touchpoint.x, touchpoint.y);
+ if (isLinkActive()) testFailed('Link unexpectedly active on exit');
+ }
+
+ // FIXME: Why doesn't the approach in findAbsoluteBounds work correctly here?
+ // I'll investigate/fix along with http://wkb.ug/96810
+ function getBounds(node)
+ {
+ var bounds = node.getBoundingClientRect();
+ return {
+ left: bounds.left,
+ top: bounds.top,
+ width: bounds.right - bounds.left,
+ height: bounds.bottom - bounds.top
+ };
+ }
+
+ function testDirectTouch(element)
+ {
+ // Touch directly in the center of the element.
+ var touchpoint = offsetTouchPoint(getBounds(element), 'center', 0, 20, 30);
+ if (document.elementFromPoint(touchpoint.x, touchpoint.y) != element)
+ testFailed('Direct touch ended up on some other element');
+ testTapDown(touchpoint, element);
+ }
+
+ function isDescendantOf(parent, child)
+ {
+ var n = child;
+ while(n) {
+ if(n==parent)
+ return true;
+ n = n.parentNode;
+ }
+ return false;
+ }
+
+ function testIndirectTouch(element)
+ {
+ // Touch just right of the element.
+ var touchpoint = offsetTouchPoint(getBounds(element), 'right', 10, 30, 20);
+ if (isDescendantOf(element, document.elementFromPoint(touchpoint.x, touchpoint.y)))
+ testFailed('Indirect touch ended up still on top of the element');
+ testTapDown(touchpoint, element);
+ }
+
+ function testDirectTouches()
+ {
+ debug('Testing direct hits.');
+ testDirectTouch(e.link1);
+ testDirectTouch(e.link2);
+ testDirectTouch(e.link3);
+ }
+
+ function testIndirectTouches()
+ {
+ debug('Testing indirect hits.');
+ testIndirectTouch(e.link1);
+ testIndirectTouch(e.link2);
+ testIndirectTouch(e.link3);
+ }
+
+ function runTests()
+ {
+ if (!window.eventSender) {
+ debug('This test requires DumpRenderTree');
+ return;
+ }
+ if (!window.eventSender.gestureTapDown) {
+ debug('GestureTapDown not supported by this platform');
+ return;
+ }
+
+ description('Tests that tapDown will trigger the active state.');
+ testIndirectTouches();
+ testDirectTouches();
+ e.sandbox.style.display = 'none';
+ }
+ runTests();
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (128998 => 128999)
--- trunk/Source/WebCore/ChangeLog 2012-09-19 14:04:58 UTC (rev 128998)
+++ trunk/Source/WebCore/ChangeLog 2012-09-19 14:08:21 UTC (rev 128999)
@@ -1,3 +1,18 @@
+2012-09-19 Rick Byers <[email protected]>
+
+ Do touch adjustment on GestureTapDown
+ https://bugs.webkit.org/show_bug.cgi?id=96677
+
+ Reviewed by Antonio Gomes.
+
+ Do touch adjustment on GestureTapDown exactly as for GestureTap today.
+
+ Test: touchadjustment/touch-links-active.html
+
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::handleGestureEvent):
+ (WebCore::EventHandler::adjustGesturePosition):
+
2012-09-19 Vsevolod Vlasov <[email protected]>
Unreviewed another follow up Apple Win build fix for r128992.
Modified: trunk/Source/WebCore/page/EventHandler.cpp (128998 => 128999)
--- trunk/Source/WebCore/page/EventHandler.cpp 2012-09-19 14:04:58 UTC (rev 128998)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2012-09-19 14:08:21 UTC (rev 128999)
@@ -2414,10 +2414,15 @@
if (gestureEvent.type() == PlatformEvent::GestureScrollEnd || gestureEvent.type() == PlatformEvent::GestureScrollUpdate)
eventTarget = m_scrollGestureHandlingNode.get();
+ IntPoint adjustedPoint = gestureEvent.position();
HitTestRequest::HitTestRequestType hitType = HitTestRequest::TouchEvent;
- if (gestureEvent.type() == PlatformEvent::GestureTapDown)
+ if (gestureEvent.type() == PlatformEvent::GestureTapDown) {
+#if ENABLE(TOUCH_ADJUSTMENT)
+ if (!gestureEvent.area().isEmpty())
+ adjustGesturePosition(gestureEvent, adjustedPoint);
+#endif
hitType |= HitTestRequest::Active;
- else if (gestureEvent.type() == PlatformEvent::GestureTap || gestureEvent.type() == PlatformEvent::GestureTapDownCancel)
+ } else if (gestureEvent.type() == PlatformEvent::GestureTap || gestureEvent.type() == PlatformEvent::GestureTapDownCancel)
hitType |= HitTestRequest::Release;
else
hitType |= HitTestRequest::Active | HitTestRequest::ReadOnly;
@@ -2426,7 +2431,7 @@
hitType |= HitTestRequest::ReadOnly;
if (!eventTarget || !(hitType & HitTestRequest::ReadOnly)) {
- IntPoint hitTestPoint = m_frame->view()->windowToContents(gestureEvent.position());
+ IntPoint hitTestPoint = m_frame->view()->windowToContents(adjustedPoint);
HitTestResult result = hitTestResultAtPoint(hitTestPoint, false, false, DontHitTestScrollbars, hitType);
eventTarget = result.targetNode();
}
@@ -2574,6 +2579,7 @@
Node* targetNode = 0;
switch (gestureEvent.type()) {
case PlatformEvent::GestureTap:
+ case PlatformEvent::GestureTapDown:
bestClickableNodeForTouchPoint(gestureEvent.position(), IntSize(gestureEvent.area().width() / 2, gestureEvent.area().height() / 2), adjustedPoint, targetNode);
break;
case PlatformEvent::GestureLongPress:
Modified: trunk/Tools/ChangeLog (128998 => 128999)
--- trunk/Tools/ChangeLog 2012-09-19 14:04:58 UTC (rev 128998)
+++ trunk/Tools/ChangeLog 2012-09-19 14:08:21 UTC (rev 128999)
@@ -1,3 +1,14 @@
+2012-09-19 Rick Byers <[email protected]>
+
+ Do touch adjustment on GestureTapDown
+ https://bugs.webkit.org/show_bug.cgi?id=96677
+
+ Reviewed by Antonio Gomes.
+
+ Allow radius to be set for GestureTapDown events.
+ * DumpRenderTree/chromium/TestRunner/EventSender.cpp:
+ (EventSender::gestureEvent):
+
2012-09-19 Christophe Dumez <[email protected]>
[EFL] EFL's DRT does not support overriding 'WebKitCSSRegionsEnabled' preference
Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/EventSender.cpp (128998 => 128999)
--- trunk/Tools/DumpRenderTree/chromium/TestRunner/EventSender.cpp 2012-09-19 14:04:58 UTC (rev 128998)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/EventSender.cpp 2012-09-19 14:08:21 UTC (rev 128999)
@@ -1188,6 +1188,10 @@
case WebInputEvent::GestureTapDown:
event.x = point.x;
event.y = point.y;
+ if (arguments.size() >= 4) {
+ event.data.tapDown.width = static_cast<float>(arguments[2].toDouble());
+ event.data.tapDown.height = static_cast<float>(arguments[3].toDouble());
+ }
break;
case WebInputEvent::GestureTapCancel:
event.x = point.x;