Chromium Code Reviews| Index: LayoutTests/touchadjustment/resources/touchadjustment.js |
| diff --git a/LayoutTests/touchadjustment/resources/touchadjustment.js b/LayoutTests/touchadjustment/resources/touchadjustment.js |
| index 2a3aa3d6716a82bb9f2589f1bbfbffadda3372e0..46a7142c1dc3a48746a264e62c5b4ef1d7b3cb9e 100644 |
| --- a/LayoutTests/touchadjustment/resources/touchadjustment.js |
| +++ b/LayoutTests/touchadjustment/resources/touchadjustment.js |
| @@ -63,9 +63,30 @@ function shouldBeWithin(adjustedPoint, targetArea) { |
| } |
| } |
| -function testTouchPoint(touchpoint, targetNode, allowTextNodes) |
| +function shadowHost(node) |
| { |
| - var adjustedNode = internals.touchNodeAdjustedToBestClickableNode(touchpoint.left, touchpoint.top, touchpoint.width, touchpoint.height, document); |
| + while (node != null) { |
| + // Not exactly the best method of detecting shadow root as other things can have a document fragment too. |
|
Rick Byers
2014/07/10 20:09:10
You could just look for the presence of the 'host'
Zeeshan Qureshi
2014/07/10 20:46:16
Done.
|
| + if (node.nodeType == 11) |
| + return node.host; |
| + node = node.parentNode; |
| + } |
| + return node; |
| +} |
| + |
| +function touchNodeAdjustedToBestClickableNode(left, top, width, height, doc, disallowShadowDOM) |
|
Rick Byers
2014/07/10 20:09:10
nit: rather than add this new function, might as w
Zeeshan Qureshi
2014/07/10 20:46:16
The only reason to keep that was because nested-sh
|
| +{ |
| + var adjustedNode = internals.touchNodeAdjustedToBestClickableNode(left, top, width, height, doc); |
| + if (disallowShadowDOM && adjustedNode && adjustedNode.nodeType == 1) { |
| + while (shadowHost(adjustedNode)) |
| + adjustedNode = shadowHost(adjustedNode); |
| + } |
| + return adjustedNode; |
| +} |
| + |
| +function testTouchPoint(touchpoint, targetNode, allowTextNodes, disallowShadowDOM) |
| +{ |
| + var adjustedNode = touchNodeAdjustedToBestClickableNode(touchpoint.left, touchpoint.top, touchpoint.width, touchpoint.height, document, disallowShadowDOM); |
| if (!allowTextNodes && adjustedNode && adjustedNode.nodeType == 3) |
| adjustedNode = adjustedNode.parentNode; |
| shouldBeNode(adjustedNode, targetNode); |