Changeset 132929 in webkit


Ignore:
Timestamp:
Oct 30, 2012 11:44:42 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[touchadjustment] touch-links-longpress tests passes incorrectly
https://bugs.webkit.org/show_bug.cgi?id=96810

Patch by Rick Byers <rbyers@chromium.org> on 2012-10-30
Reviewed by Antonio Gomes.

Tools:

Add support for suppling width/height information for longpress
gesture (as for other gestures like tapDown) for the purposes
of touch adjustment.

  • DumpRenderTree/chromium/TestRunner/src/EventSender.cpp:

(WebTestRunner):
(WebTestRunner::EventSender::gestureEvent):

LayoutTests:

Fix touch-links-longpress test to be consistent with touch-links-active.
Now it's actually touching where we intended - at the center of the
touch region identified instead of the top/left corner. Also pass
the width/height of the touch to EventSender in order to enable touch
adjustment.

Also adds checks to verify that our touches are actually landing on
or outside the element we're targetting as desired.

  • touchadjustment/resources/touchadjustment.js:

(findAbsoluteBounds): Update to support both inline and block nodes (clientHeight is 0 for inline nodes)

  • touchadjustment/touch-links-active.html: Use updated findAbsoluteBounds
  • touchadjustment/touch-links-longpress.html:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r132924 r132929  
     12012-10-30  Rick Byers  <rbyers@chromium.org>
     2
     3        [touchadjustment] touch-links-longpress tests passes incorrectly
     4        https://bugs.webkit.org/show_bug.cgi?id=96810
     5
     6        Reviewed by Antonio Gomes.
     7
     8        Fix touch-links-longpress test to be consistent with touch-links-active.
     9        Now it's actually touching where we intended - at the center of the
     10        touch region identified instead of the top/left corner.  Also pass
     11        the width/height of the touch to EventSender in order to enable touch
     12        adjustment.
     13
     14        Also adds checks to verify that our touches are actually landing on
     15        or outside the element we're targetting as desired.
     16
     17        * touchadjustment/resources/touchadjustment.js:
     18        (findAbsoluteBounds): Update to support both inline and block nodes (clientHeight is 0 for inline nodes)
     19        * touchadjustment/touch-links-active.html: Use updated findAbsoluteBounds
     20        * touchadjustment/touch-links-longpress.html:
     21
    1222012-10-30  Dan Bernstein  <mitz@apple.com>
    223
  • trunk/LayoutTests/platform/qt/TestExpectations

    r132923 r132929  
    449449touchadjustment/touch-links-active.html
    450450
     451# Don't have width/height on GestureLongPress necessary to enable adjustment
     452touchadjustment/touch-links-longpress.html
     453
    451454# ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING) is disabled
    452455fast/dom/timer-throttling-hidden-page.html
  • trunk/LayoutTests/touchadjustment/resources/touchadjustment.js

    r128999 r132929  
    1 /* function for finding the absolute bounds of a node */
     1/* function for finding the absolute bounds of a node (both inline and block) */
    22function findAbsoluteBounds(node)
    33{
    4     var bounds = {left: 0, top: 0};
    5     bounds.width = node.clientWidth;
    6     bounds.height = node.clientHeight;
    7     do {
    8         bounds.left += node.offsetLeft;
    9         bounds.top += node.offsetTop;
    10     } while (node = node.offsetParent);
    11     return bounds;
     4    var bounds = node.getBoundingClientRect();
     5    return {
     6        left: bounds.left,
     7        top: bounds.top,
     8        width: bounds.right - bounds.left,
     9        height: bounds.bottom - bounds.top
     10    };
    1211}
    1312
  • trunk/LayoutTests/touchadjustment/touch-links-active.html

    r128999 r132929  
    6464    }
    6565
    66     // FIXME: Why doesn't the approach in findAbsoluteBounds work correctly here?
    67     // I'll investigate/fix along with http://wkb.ug/96810
    68     function getBounds(node)
    69     {
    70       var bounds = node.getBoundingClientRect();
    71       return {
    72           left: bounds.left,
    73           top: bounds.top,
    74           width: bounds.right - bounds.left,
    75           height: bounds.bottom - bounds.top
    76       };   
    77     }
    78    
    7966    function testDirectTouch(element)
    8067    {
    8168        // Touch directly in the center of the element.
    82         var touchpoint = offsetTouchPoint(getBounds(element), 'center', 0, 20, 30);
     69        var touchpoint = offsetTouchPoint(findAbsoluteBounds(element), 'center', 0, 20, 30);
    8370        if (document.elementFromPoint(touchpoint.x, touchpoint.y) != element)
    8471            testFailed('Direct touch ended up on some other element');
     
    10087    {
    10188        // Touch just right of the element.
    102         var touchpoint = offsetTouchPoint(getBounds(element), 'right', 10, 30, 20);
     89        var touchpoint = offsetTouchPoint(findAbsoluteBounds(element), 'right', 10, 30, 20);
    10390        if (isDescendantOf(element, document.elementFromPoint(touchpoint.x, touchpoint.y)))
    10491            testFailed('Indirect touch ended up still on top of the element');
  • trunk/LayoutTests/touchadjustment/touch-links-longpress.html

    r124642 r132929  
    3737    {
    3838        if (eventSender.gestureLongPress)
    39             eventSender.gestureLongPress(touchpoint.left, touchpoint.top);
     39            eventSender.gestureLongPress(touchpoint.x, touchpoint.y, touchpoint.width, touchpoint.height);
    4040        else
    4141            debug("gestureLongPress not implemented by this platform.");
     
    4646        // Touch directly in the center of the element.
    4747        var touchpoint = offsetTouchPoint(findAbsoluteBounds(element), 'center', 0, 20, 30);
     48        if (document.elementFromPoint(touchpoint.x, touchpoint.y) != element)
     49            testFailed('Direct touch ended up on some other element');
    4850        testLongPress(touchpoint);
    4951    }
     
    5355        // Touch just right of the element.
    5456        var touchpoint = offsetTouchPoint(findAbsoluteBounds(element), 'right', 10, 30, 20);
     57        if (isDescendantOf(element, document.elementFromPoint(touchpoint.x, touchpoint.y)))
     58            testFailed('Indirect touch ended up still on top of the element');
    5559        testLongPress(touchpoint);
     60    }
     61
     62    function isDescendantOf(parent, child)
     63    {
     64        var n = child;
     65        while(n) {
     66            if(n==parent)
     67                return true;
     68            n = n.parentNode;
     69        }
     70        return false;
    5671    }
    5772
  • trunk/Tools/ChangeLog

    r132925 r132929  
     12012-10-30  Rick Byers  <rbyers@chromium.org>
     2
     3        [touchadjustment] touch-links-longpress tests passes incorrectly
     4        https://bugs.webkit.org/show_bug.cgi?id=96810
     5
     6        Reviewed by Antonio Gomes.
     7
     8        Add support for suppling width/height information for longpress
     9        gesture (as for other gestures like tapDown) for the purposes
     10        of touch adjustment.
     11
     12        * DumpRenderTree/chromium/TestRunner/src/EventSender.cpp:
     13        (WebTestRunner):
     14        (WebTestRunner::EventSender::gestureEvent):
     15
    1162012-10-29  Anders Carlsson  <andersca@apple.com>
    217
  • trunk/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp

    r132781 r132929  
    12011201        event.x = point.x;
    12021202        event.y = point.y;
     1203        if (arguments.size() >= 4) {
     1204            event.data.tapDown.width = static_cast<float>(arguments[2].toDouble());
     1205            event.data.tapDown.height = static_cast<float>(arguments[3].toDouble());
     1206        }
    12031207        break;
    12041208    case WebInputEvent::GestureTwoFingerTap:
Note: See TracChangeset for help on using the changeset viewer.