| <!DOCTYPE html> |
| <html> |
| <body> |
| <p>This tests selecting content starting in a shadow tree inside a <code>user-select: all</code> in an editable region in to outside the editable region.<br> |
| To manually test, select "hello world WebKit rocks" below by a mouse drag from "h" to "s". WebKit should select "hello".</p> |
| <div id="container"><div contenteditable><div style="user-select: all">world</div> WebKit</div>rocks</div> |
| <script> |
| |
| const host = document.createElement('div'); |
| container.firstChild.prepend(host); |
| const shadowRoot = host.attachShadow({mode: 'closed'}); |
| shadowRoot.textContent = 'hello '; |
| |
| if (window.eventSender) { |
| eventSender.dragMode = false; |
| eventSender.mouseMoveTo(container.offsetLeft + 1, container.offsetTop + 5); |
| eventSender.mouseDown(); |
| eventSender.mouseMoveTo(container.offsetLeft + container.offsetWidth - 5, container.offsetTop + container.offsetHeight - 5); |
| eventSender.mouseUp(); |
| if (getSelection().startContainer.getRootNode() != document) |
| document.write("The start container's root node was not the document"); |
| if (getSelection().startContainer != getSelection().endContainer) |
| document.write("The end container was different from the start container"); |
| if (getSelection().getRangeAt(0).startContainer.getRootNode() != document) |
| document.write("The range's start container's root node was not the document"); |
| if (getSelection().getRangeAt(0).endContainer != getSelection().getRangeAt(0).startContainer) |
| document.write("The range's end container was different from its start container"); |
| } |
| |
| </script> |
| </body> |
| </html> |