diff options
author | allan.jensen@nokia.com <allan.jensen@nokia.com@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2012-09-17 15:02:41 +0000 |
---|---|---|
committer | allan.jensen@nokia.com <allan.jensen@nokia.com@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2012-09-17 15:02:41 +0000 |
commit | 599d33ceb61725336b7b7dd62b6480c6b0bb1622 (patch) | |
tree | 338e256cada8e8a8efeb7f2877369ca2431fa5eb /third_party/WebKit/LayoutTests/touchadjustment | |
parent | 815d3df21d44083d29b9bd2bfba24b31d42e9f5d (diff) | |
download | chromium_src-599d33ceb61725336b7b7dd62b6480c6b0bb1622.zip chromium_src-599d33ceb61725336b7b7dd62b6480c6b0bb1622.tar.gz chromium_src-599d33ceb61725336b7b7dd62b6480c6b0bb1622.tar.bz2 |
[TouchAdjustment] Adjusted point outside bounds for non-rectilinear targets
https://bugs.webkit.org/show_bug.cgi?id=96098
Reviewed by Antonio Gomes.
Source/WebCore:
Simplifies how snapTo tries to restrict the adjustment to the touch-area, and
at the same fix it to give better guarantees.
Test: touchadjustment/rotated-node.html
* page/TouchAdjustment.cpp:
(WebCore::TouchAdjustment::snapTo):
LayoutTests:
Expands the test of rotated nodes to also perform checks of the validity of the adjusted points.
* touchadjustment/resources/touchadjustment.js:
(adjustTouchPoint):
* touchadjustment/rotated-node-expected.txt:
* touchadjustment/rotated-node.html:
git-svn-id: svn://svn.chromium.org/blink/trunk@128757 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Diffstat (limited to 'third_party/WebKit/LayoutTests/touchadjustment')
3 files changed, 30 insertions, 2 deletions
diff --git a/third_party/WebKit/LayoutTests/touchadjustment/resources/touchadjustment.js b/third_party/WebKit/LayoutTests/touchadjustment/resources/touchadjustment.js index 547546c..f9b7d9d 100644 --- a/third_party/WebKit/LayoutTests/touchadjustment/resources/touchadjustment.js +++ b/third_party/WebKit/LayoutTests/touchadjustment/resources/touchadjustment.js @@ -64,7 +64,6 @@ function shouldBeWithin(adjustedPoint, targetArea) { } } - function testTouchPoint(touchpoint, targetNode, allowTextNodes) { var adjustedNode = internals.touchNodeAdjustedToBestClickableNode(touchpoint.left, touchpoint.top, touchpoint.width, touchpoint.height, document); @@ -81,6 +80,12 @@ function testTouchPointContextMenu(touchpoint, targetNode, allowTextNodes) shouldBeNode(adjustedNode, targetNode); } +function adjustTouchPoint(touchpoint) +{ + var adjustedPoint = internals.touchPositionAdjustedToBestClickableNode(touchpoint.left, touchpoint.top, touchpoint.width, touchpoint.height, document); + return adjustedPoint; +} + function adjustTouchPointContextMenu(touchpoint) { var adjustedPoint = internals.touchPositionAdjustedToBestContextMenuNode(touchpoint.left, touchpoint.top, touchpoint.width, touchpoint.height, document); diff --git a/third_party/WebKit/LayoutTests/touchadjustment/rotated-node-expected.txt b/third_party/WebKit/LayoutTests/touchadjustment/rotated-node-expected.txt index f035cb7..87f5f84 100644 --- a/third_party/WebKit/LayoutTests/touchadjustment/rotated-node-expected.txt +++ b/third_party/WebKit/LayoutTests/touchadjustment/rotated-node-expected.txt @@ -20,6 +20,12 @@ PASS adjusted node was DIV#rotated. Near Misses PASS adjusted node was DIV#container. PASS adjusted node was DIV#container. + +Adjusted point within bounds +PASS adjusted point was within (0,-20)x(40,40) +PASS adjusted point was within (40,40)x(40,40) +PASS adjusted point was within (-40,40)x(80,40) +PASS adjusted point was within (50,-20)x(40,80) PASS successfullyParsed is true TEST COMPLETE diff --git a/third_party/WebKit/LayoutTests/touchadjustment/rotated-node.html b/third_party/WebKit/LayoutTests/touchadjustment/rotated-node.html index 3401637..372582f 100644 --- a/third_party/WebKit/LayoutTests/touchadjustment/rotated-node.html +++ b/third_party/WebKit/LayoutTests/touchadjustment/rotated-node.html @@ -46,7 +46,7 @@ function testDirectTouches() { debug('Direct Touches'); - + testTouchPoint(touchPoint(30, 30, 20), e.rotated); testTouchPoint(touchPoint(20, 30, 20), e.rotated); testTouchPoint(touchPoint(40, 30, 20), e.rotated); @@ -75,6 +75,22 @@ testTouchPoint(touchPoint(70, 60, 20), e.container); } + function testAdjustedPoints() + { + debug('\nAdjusted point within bounds'); + var adjustedPoint = adjustTouchPoint(touchPoint(20, 0, 20)) + shouldBeWithin(adjustedPoint, touchPoint(20, 0, 20)); + + adjustedPoint = adjustTouchPoint(touchPoint(60, 60, 20)) + shouldBeWithin(adjustedPoint, touchPoint(60, 60, 20)); + + adjustedPoint = adjustTouchPoint(touchPoint(0, 60, 40, 20)) + shouldBeWithin(adjustedPoint, touchPoint(0, 60, 40, 20)); + + adjustedPoint = adjustTouchPoint(touchPoint(70, 20, 20, 40)) + shouldBeWithin(adjustedPoint, touchPoint(70, 20, 20, 40)); + } + function runTests() { document.addEventListener('click', function() {}, false); @@ -82,6 +98,7 @@ description(document.title); testDirectTouches(); testAdjustedTouches(); + testAdjustedPoints() e.container.style.display = 'none'; } } |