Add a simple annotation layer that marks trailing whitespace in diffs
(guarded by the `show_whitespace_errors` diff preference). The newly
supported diff preference is added to both diff preference controls. The
requirement that all annotation layers must implement `addListener` is
relaxed as the trailing whitespace layer is the third layer that doesn't
use it.
Adds tests for the layer and the diff preference.
Feature: Issue 4836
Change-Id: Ifba05216bf0bc3c0a8a094f5ef392b983091d59f
- Allow range comments to start at a tab.
- Preserve tabs within selected comment range.
Bug: Issue 4253
Change-Id: Ia1ebdcc2e22a1fdad9619cf9ded5db3c80ebe648
Moves the tests for gr-annotation functions into their own test file and
fixes a subtle bug regarding `splitTextNode`'s Unicode branch.
In the DOM implementation of `node.splitText`, `node` is kept in the DOM
and its `textContent` is modified, whereas the Unicode path of
`splitTextNode` would replace it with an entirely new Text node. This
led to the function behaving differently when the Node contained or
did not contain astral code-points.
With this change, `splitTextNode` more-closely behaves like `splitText`
and this behavior is captured in a new unit-test.
Change-Id: I70460694040ba9a3c49937aaafc9db261ca3be3d
Adds the `annotateElement` function to the gr-annotation library, which
applies an annotation to an element's text at the specified range as
deeply as possible.
Change-Id: I5e38a9718fc00df860e8b12a16e551ccc1b57722
The gr-diff-highlight library contained a number of generic DOM
manipulation methods that are of use elsewhere, including the variants
of `_splitNode` and `_wrapInHighlight`. This change moves these
functions into their own library called gr-annotation.js.
Change-Id: I0daf3193ef460b76e9348d6286d50a824b6a5986