Title: [111851] trunk
- Revision
- 111851
- Author
- [email protected]
- Date
- 2012-03-23 05:23:57 -0700 (Fri, 23 Mar 2012)
Log Message
TouchAdjustment does not correct for frame position
https://bugs.webkit.org/show_bug.cgi?id=82043
Patch by Allan Sandfeld Jensen <[email protected]> on 2012-03-23
Reviewed by Kenneth Rohde Christiansen.
Source/WebCore:
Convert geometry to window coordinates before calculating distance.
Test: touchadjustment/iframe.html
* page/TouchAdjustment.cpp:
(WebCore::TouchAdjustment::distanceSquaredToTargetCenterLine):
LayoutTests:
Add test that will fail if frame position is not adjusted for.
* touchadjustment/iframe-expected.txt: Added.
* touchadjustment/iframe.html: Added.
* touchadjustment/resources/inner-frame.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (111850 => 111851)
--- trunk/LayoutTests/ChangeLog 2012-03-23 12:17:39 UTC (rev 111850)
+++ trunk/LayoutTests/ChangeLog 2012-03-23 12:23:57 UTC (rev 111851)
@@ -1,3 +1,16 @@
+2012-03-23 Allan Sandfeld Jensen <[email protected]>
+
+ TouchAdjustment does not correct for frame position
+ https://bugs.webkit.org/show_bug.cgi?id=82043
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Add test that will fail if frame position is not adjusted for.
+
+ * touchadjustment/iframe-expected.txt: Added.
+ * touchadjustment/iframe.html: Added.
+ * touchadjustment/resources/inner-frame.html: Added.
+
2012-03-23 Csaba Osztrogonác <[email protected]>
[Qt] Unreviewed gardening, skip a failing test.
Added: trunk/LayoutTests/touchadjustment/iframe-expected.txt (0 => 111851)
--- trunk/LayoutTests/touchadjustment/iframe-expected.txt (rev 0)
+++ trunk/LayoutTests/touchadjustment/iframe-expected.txt 2012-03-23 12:23:57 UTC (rev 111851)
@@ -0,0 +1,13 @@
+
+Test touch-adjustment on links in an iframe. Making sure we iframe position is correctly adjusted for.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Test fat direct touches.
+PASS adjustedNode.id is "a1"
+PASS adjustedNode.id is "a2"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/touchadjustment/iframe.html (0 => 111851)
--- trunk/LayoutTests/touchadjustment/iframe.html (rev 0)
+++ trunk/LayoutTests/touchadjustment/iframe.html 2012-03-23 12:23:57 UTC (rev 111851)
@@ -0,0 +1,51 @@
+<html>
+<head>
+ <script src=""
+ <style>
+ #myframe { position: absolute; left: 200px; top: 100px; width: 400px; height: 300px;}
+ </style>
+</head>
+<body _onload_="runTests()">
+
+<iframe id=myframe src=""
+
+<p id='description'></p>
+<div id='console'></div>
+
+<script>
+ 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()
+ {
+ debug('Test fat direct touches.');
+
+ adjustedNode = testRoundTouch(260, 200, 200);
+ shouldBeEqualToString('adjustedNode.id', 'a1');
+
+ adjustedNode = testRoundTouch(340, 200, 200);
+ shouldBeEqualToString('adjustedNode.id', 'a2');
+
+ }
+ function runTests()
+ {
+ if (window.layoutTestController && window.internals && internals.touchNodeAdjustedToBestClickableNode) {
+ description('Test touch-adjustment on links in an iframe. Making sure we iframe position is correctly adjusted for.');
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ testDirectTouches();
+ isSuccessfullyParsed();
+ layoutTestController.notifyDone();
+ }
+ }
+</script>
+</body>
+</html>
\ No newline at end of file
Added: trunk/LayoutTests/touchadjustment/resources/inner-frame.html (0 => 111851)
--- trunk/LayoutTests/touchadjustment/resources/inner-frame.html (rev 0)
+++ trunk/LayoutTests/touchadjustment/resources/inner-frame.html 2012-03-23 12:23:57 UTC (rev 111851)
@@ -0,0 +1,16 @@
+<html>
+<head>
+ <style>
+ div {position: absolute; }
+ </style>
+</head>
+<body>
+<div id=d1 style="width:200px;">
+ <a href="" id=a1>Link 1</a>
+</div>
+<div id=d2 style="left:200px;width:200px;">
+ <a href="" id=a2>Link 2</a>
+</div>
+</table>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (111850 => 111851)
--- trunk/Source/WebCore/ChangeLog 2012-03-23 12:17:39 UTC (rev 111850)
+++ trunk/Source/WebCore/ChangeLog 2012-03-23 12:23:57 UTC (rev 111851)
@@ -1,3 +1,17 @@
+2012-03-23 Allan Sandfeld Jensen <[email protected]>
+
+ TouchAdjustment does not correct for frame position
+ https://bugs.webkit.org/show_bug.cgi?id=82043
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Convert geometry to window coordinates before calculating distance.
+
+ Test: touchadjustment/iframe.html
+
+ * page/TouchAdjustment.cpp:
+ (WebCore::TouchAdjustment::distanceSquaredToTargetCenterLine):
+
2012-03-23 Vlad Voicu <[email protected]>
Fixed minor WebInspector display issue
Modified: trunk/Source/WebCore/page/TouchAdjustment.cpp (111850 => 111851)
--- trunk/Source/WebCore/page/TouchAdjustment.cpp 2012-03-23 12:17:39 UTC (rev 111850)
+++ trunk/Source/WebCore/page/TouchAdjustment.cpp 2012-03-23 12:23:57 UTC (rev 111851)
@@ -24,6 +24,7 @@
#include "ContainerNode.h"
#include "FloatPoint.h"
#include "FloatQuad.h"
+#include "FrameView.h"
#include "HTMLLabelElement.h"
#include "HTMLNames.h"
#include "IntPoint.h"
@@ -174,6 +175,10 @@
// and gives the same result in all untransformed cases, and in transformed cases still
// gives a better distance-function than the distance to the center-point.
IntRect rect = subtarget.boundingBox();
+ ASSERT(subtarget.node()->document());
+ ASSERT(subtarget.node()->document()->view());
+ // Convert from frame coordinates to window coordinates.
+ rect = subtarget.node()->document()->view()->contentsToWindow(rect);
return rect.distanceSquaredFromCenterLineToPoint(touchHotspot);
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes