| <p>We delay focus until mouse up if the mouse down occurs inside a focusable node that is inside an already focused node. But we shouldn't delay focus unless the mouse down occurs in an already focused node. The text field below should be focused. <b>To run manually, select everything from 'foo' though 'baz', then mouse down inside the text field.</b></p> |
| <div id="div"><div>foo</div><input type="text" id="field"><div>baz</div></div> |
| |
| <script> |
| function runTest() { |
| if (!window.testRunner) |
| return; |
| var field = document.getElementById("field"); |
| var div = document.getElementById("div"); |
| var selection = window.getSelection(); |
| selection.setBaseAndExtent(div, 0, div, div.childNodes.length); |
| |
| var x, y; |
| x = field.offsetParent.offsetLeft + field.offsetLeft + field.offsetWidth / 2; |
| y = field.offsetParent.offsetTop + field.offsetTop + field.offsetHeight / 2; |
| eventSender.mouseMoveTo(x, y); |
| eventSender.mouseDown(); |
| } |
| |
| runTest(); |
| </script> |