Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Unified Diff: LayoutTests/touchadjustment/resources/touchadjustment.js

Issue 10988006: Merge 128999 - Do touch adjustment on GestureTapDown (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1271/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/platform/qt/Skipped ('k') | LayoutTests/touchadjustment/touch-links-active.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/touchadjustment/resources/touchadjustment.js
===================================================================
--- LayoutTests/touchadjustment/resources/touchadjustment.js (revision 129420)
+++ LayoutTests/touchadjustment/resources/touchadjustment.js (working copy)
@@ -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;
}
« no previous file with comments | « LayoutTests/platform/qt/Skipped ('k') | LayoutTests/touchadjustment/touch-links-active.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698