With native Shadow DOM, the selections returned by document.getSelection() cannot reference the elements actually making up the diff because those live in the Shadow DOM of gr-diff. Instead, a shadowRoot.getSelection() method is offered that works as the pre-Shadow DOM Selection used to, but that one is only available from gr-diff. This change moves listening for the selectionchange event and retrieving the selection to gr-diff, which then delegates the extraction and normalization of the ranges to gr-diff-highlight (it's current location). This change also fixes an incompatibility with native Shadow DOM in gr-selection-action-box, where a call to parentElement cannot cross the Shadow DOM boundary and needs special handling to retrieve the Shadow Host. Together these changes fix creating range comments for native Shadow DOM. Bug: Issue 6372 Change-Id: I4bce21025ab5a4c06d77db096d6aa56e7840987b
34 KiB
34 KiB