Chromium Code Reviews| Index: LayoutTests/touchadjustment/pseudo-element.html |
| diff --git a/LayoutTests/touchadjustment/big-div.html b/LayoutTests/touchadjustment/pseudo-element.html |
| similarity index 60% |
| copy from LayoutTests/touchadjustment/big-div.html |
| copy to LayoutTests/touchadjustment/pseudo-element.html |
| index 80d0e0e523f54f5356045fa32f75855e14adfdd9..06cf167df0b831393bf44e8d0478d274c286dcec 100644 |
| --- a/LayoutTests/touchadjustment/big-div.html |
| +++ b/LayoutTests/touchadjustment/pseudo-element.html |
| @@ -1,20 +1,22 @@ |
| <!DOCTYPE html> |
| -<html> |
| -<head> |
| - <title>Touch Adjustment : Too aggresive adjustments for large elements - bug 91262</title> |
| - <script src="../resources/js-test.js"></script> |
| - <script src="resources/touchadjustment.js"></script> |
| - <style> |
| - #targetDiv { |
| - background: #00f; |
| - height: 400px; |
| - width: 400px; |
| - } |
| - </style> |
| -</head> |
| - |
| -<body> |
| - |
| +<title>Touch Adjustment: Shouldn't return pseudo elements - bug 395942</title> |
| +<script src="../resources/js-test.js"></script> |
| +<script src="resources/touchadjustment.js"></script> |
| +<style> |
| + #targetDiv { |
| + height: 0; |
| + width: 0; |
| + } |
| + #targetDiv:after { |
| + display: block; |
| + position: relative; |
| + left: 50px; |
| + background-color: blue; |
| + width: 50px; |
| + height: 50px; |
| + content: ''; |
| + } |
| +</style> |
| <div id="targetDiv"> |
| </div> |
| @@ -35,21 +37,38 @@ |
| targetBounds = findAbsoluteBounds(element); |
| + // Adjust for offset to the pseudo element |
| + targetBounds = { |
| + left: targetBounds.left + 50, |
| + top: targetBounds.top, |
| + width: 50, |
| + height: 50 |
| + } |
|
kevers
2014/07/25 20:46:55
nit: missing trailing semicolon.
|
| + |
| var touchRadius = 10; |
| var offset = touchRadius / 2; |
| var midX = targetBounds.left + targetBounds.width / 2; |
| var midY = targetBounds.top + targetBounds.height / 2; |
| - debug('\nOverlapping touch above the target should snap to the top of the target element.'); |
| + debug('Test touch area contained within the pseudo element.'); |
| + testTouch(midX, midY, touchRadius, targetBounds); |
| + debug(''); |
| + |
| + debug('Overlapping touch above the target should snap to the top of the pseudo element.'); |
| testTouch(midX, targetBounds.top - offset, touchRadius, targetBounds); |
| - debug('\nOverlapping touch below the target should snap to the bottom of the target element.'); |
| + debug(''); |
| + |
| + debug('Overlapping touch below the target should snap to the bottom of the pseudo element.'); |
| testTouch(midX, targetBounds.top + targetBounds.height + offset, touchRadius, targetBounds); |
| - debug('\nOverlapping touch left of the target should snap to the left side of the target element.'); |
| + debug(''); |
| + |
| + debug('Overlapping touch left of the target should snap to the left side of the pseudo element.'); |
| testTouch(targetBounds.left - offset, midY, touchRadius, targetBounds); |
| - debug('\nOverlapping touch right of the target should snap to the right side of the target element.'); |
| + debug(''); |
| + |
| + debug('Overlapping touch right of the target should snap to the right side of the pseudo element.'); |
| testTouch(targetBounds.left + targetBounds.width + offset, midY, touchRadius, targetBounds); |
| - debug('\nTest touch area contained within the target element.'); |
| - testTouch(midX, midY, touchRadius, targetBounds); |
| + debug(''); |
| } |
| function testTouch(touchX, touchY, radius, targetBounds) { |
| @@ -74,14 +93,9 @@ |
| shouldBeTrue('adjustedPoint.y <= touchBounds.y + touchBounds.height'); |
| } |
| - function runTests() |
| - { |
| - if (window.testRunner && window.internals && internals.touchNodeAdjustedToBestClickableNode) { |
| - description('Test touch adjustment on a large div. The adjusted touch point should lie inside the target element and within the touch area.'); |
| - runTouchTests(); |
| - } |
| + description('Test touch adjustment over pseudo elements. Pseudo elements should be candidates for adjustment, but should not themselves be returned as valid target nodes.'); |
| + |
| + if (window.internals) { |
|
kevers
2014/07/25 20:46:55
Should we be testing for window.testRunner as well
|
| + runTouchTests(); |
| } |
| - runTests(); |
| </script> |
| -</body> |
| -</html> |