Title: [111852] trunk
- Revision
- 111852
- Author
- [email protected]
- Date
- 2012-03-23 05:41:07 -0700 (Fri, 23 Mar 2012)
Log Message
Touch adjustment forgets some subtarget quads.
https://bugs.webkit.org/show_bug.cgi?id=82044
Patch by Allan Sandfeld Jensen <[email protected]> on 2012-03-23
Reviewed by Kenneth Rohde Christiansen.
Source/WebCore:
Do not uncritically skip all nodes that are ancestors to other test results.
Instead return the inner-most element if multiple nodes have the same distance.
Test: touchadjustment/block-testing.html
* page/TouchAdjustment.cpp:
(WebCore::TouchAdjustment::compileSubtargetList):
(WebCore::TouchAdjustment::findNodeWithLowestDistanceMetric):
LayoutTests:
* touchadjustment/block-testing-expected.txt: Added.
* touchadjustment/block-testing.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (111851 => 111852)
--- trunk/LayoutTests/ChangeLog 2012-03-23 12:23:57 UTC (rev 111851)
+++ trunk/LayoutTests/ChangeLog 2012-03-23 12:41:07 UTC (rev 111852)
@@ -1,5 +1,15 @@
2012-03-23 Allan Sandfeld Jensen <[email protected]>
+ Touch adjustment forgets some subtarget quads.
+ https://bugs.webkit.org/show_bug.cgi?id=82044
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ * touchadjustment/block-testing-expected.txt: Added.
+ * touchadjustment/block-testing.html: Added.
+
+2012-03-23 Allan Sandfeld Jensen <[email protected]>
+
TouchAdjustment does not correct for frame position
https://bugs.webkit.org/show_bug.cgi?id=82043
Added: trunk/LayoutTests/touchadjustment/block-testing-expected.txt (0 => 111852)
--- trunk/LayoutTests/touchadjustment/block-testing-expected.txt (rev 0)
+++ trunk/LayoutTests/touchadjustment/block-testing-expected.txt 2012-03-23 12:41:07 UTC (rev 111852)
@@ -0,0 +1,11 @@
+Some text. Some text. A link
+Test touch-adjustment on a block where we also touch the inner text and outside link.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS adjustedNode.id is "div1"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/touchadjustment/block-testing.html (0 => 111852)
--- trunk/LayoutTests/touchadjustment/block-testing.html (rev 0)
+++ trunk/LayoutTests/touchadjustment/block-testing.html 2012-03-23 12:41:07 UTC (rev 111852)
@@ -0,0 +1,57 @@
+<html>
+<head>
+ <script src=""
+ <style>
+ #div1 { position: absolute; left: 50px; top: 50px; width: 200px; height: 50px;}
+ #div2 { position: absolute; left: 50px; top: 100px; width: 200px; height: 50px;}
+ </style>
+</head>
+<body _onload_="runTests()">
+
+<div id=div1 _onclick_=doSomething>
+Some text.
+</div>
+
+<div id=div2>
+Some text. <a id=a1 href="" link</a>
+</div>
+
+<p id='description'></p>
+<div id='console'></div>
+
+<script>
+ function doSomething() {
+ // Do something!
+ }
+
+ function testRoundTouch(x, y, radius)
+ {
+ var x = x - radius;
+ var y = y - radius;
+ var width = radius * 2;
+ var height = radius * 2;
+ var adjustedNode = internals.touchNodeAdjustedToBestClickableNode(x, y, width, height, document);
+ if (adjustedNode.nodeType == 3) // TEXT node
+ adjustedNode = adjustedNode.parentNode;
+ return adjustedNode;
+ }
+ function testDirectTouches()
+ {
+ adjustedNode = testRoundTouch(200, 90, 200);
+ shouldBeEqualToString('adjustedNode.id', 'div1');
+
+ }
+ function runTests()
+ {
+ if (window.layoutTestController && window.internals && internals.touchNodeAdjustedToBestClickableNode) {
+ description('Test touch-adjustment on a block where we also touch the inner text and outside link.');
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ testDirectTouches();
+ isSuccessfullyParsed();
+ layoutTestController.notifyDone();
+ }
+ }
+</script>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (111851 => 111852)
--- trunk/Source/WebCore/ChangeLog 2012-03-23 12:23:57 UTC (rev 111851)
+++ trunk/Source/WebCore/ChangeLog 2012-03-23 12:41:07 UTC (rev 111852)
@@ -1,5 +1,21 @@
2012-03-23 Allan Sandfeld Jensen <[email protected]>
+ Touch adjustment forgets some subtarget quads.
+ https://bugs.webkit.org/show_bug.cgi?id=82044
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Do not uncritically skip all nodes that are ancestors to other test results.
+ Instead return the inner-most element if multiple nodes have the same distance.
+
+ Test: touchadjustment/block-testing.html
+
+ * page/TouchAdjustment.cpp:
+ (WebCore::TouchAdjustment::compileSubtargetList):
+ (WebCore::TouchAdjustment::findNodeWithLowestDistanceMetric):
+
+2012-03-23 Allan Sandfeld Jensen <[email protected]>
+
TouchAdjustment does not correct for frame position
https://bugs.webkit.org/show_bug.cgi?id=82043
Modified: trunk/Source/WebCore/page/TouchAdjustment.cpp (111851 => 111852)
--- trunk/Source/WebCore/page/TouchAdjustment.cpp 2012-03-23 12:23:57 UTC (rev 111851)
+++ trunk/Source/WebCore/page/TouchAdjustment.cpp 2012-03-23 12:41:07 UTC (rev 111852)
@@ -119,10 +119,6 @@
unsigned length = intersectedNodes.length();
for (unsigned i = 0; i < length; ++i) {
Node* const node = intersectedNodes.item(i);
- if (responderMap.contains(node))
- // Skip nodes that are direct ancestors of other candidates. They would hit-test
- // against the same absolute quads.
- continue;
Vector<Node*> visitedNodes;
Node* respondingNode = 0;
for (Node* visitedNode = node; visitedNode; visitedNode = visitedNode->parentOrHostNode()) {
@@ -189,7 +185,6 @@
bool findNodeWithLowestDistanceMetric(Node*& targetNode, IntPoint& targetPoint, const IntPoint& touchHotspot, const IntRect& touchArea, SubtargetGeometryList& subtargets, DistanceFunction distanceFunction)
{
targetNode = 0;
-
float bestDistanceMetric = INFINITY;
SubtargetGeometryList::const_iterator it = subtargets.begin();
const SubtargetGeometryList::const_iterator end = subtargets.end();
@@ -200,6 +195,10 @@
targetPoint = roundedIntPoint(it->quad().center());
targetNode = node;
bestDistanceMetric = distanceMetric;
+ } else if (distanceMetric == bestDistanceMetric) {
+ // Try to always return the inner-most element.
+ if (node->isDescendantOf(targetNode))
+ targetNode = node;
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes