9 Commits

Author SHA1 Message Date
Becky Siegel
8d92d53db5 Annotation updates
Change-Id: I146f76b9dcc1a92e18acec01481ad280fb431868
2017-08-12 11:49:52 -07:00
Kasper Nilsson
fbad19e18e Catch-all fix for merged linter errors
Bug: Issue 6179
Change-Id: I436b6dbd88e83b4d901d5446a0c7900678be157d
2017-05-17 17:17:25 -07:00
Kasper Nilsson
efddea62fa ES6ify /gr-diff-highlight/*
Bug: Issue 6179
Change-Id: I82ae4ef1557dafdcaf80e332c2c713fcc609a006
2017-05-17 11:31:32 -07:00
Wyatt Allen
d970500d62 Annotate trailing whitespace per user preference
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
2016-11-20 13:31:30 -08:00
Viktar Donich
056fa71f5d Range comments tabs fixes
- Allow range comments to start at a tab.
- Preserve tabs within selected comment range.

Bug: Issue 4253
Change-Id: Ia1ebdcc2e22a1fdad9619cf9ded5db3c80ebe648
2016-07-14 12:39:33 -07:00
Wyatt Allen
3d2e13c21b Organizes gr-annotation tests and fixes splitTextNode bug
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
2016-07-13 16:06:09 -07:00
Viktar Donich
59ae69dd9c Fix lint error
Change-Id: If0b10e4427a7a6d4dfb5fe056d9d6131fbbdda41
2016-07-13 10:01:14 -07:00
Wyatt Allen
dd0adf26aa Adds general annotation function to gr-annotation
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
2016-07-12 18:39:35 +00:00
Wyatt Allen
32e3e23449 Creates gr-annotation library housing DOM-splitting and annotation tools
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
2016-07-12 10:46:54 -07:00