7 Commits

Author SHA1 Message Date
Kasper Nilsson
708d34fb1f Fix comment selection and copy behavior
This change adds logic that applies a CSS class whenever mouseDown
occurs inside of a comment thread that makes comment messages
highlightable. This replicates the existing functionality of GWTUI. In
addition, logic for copying the messages of multiple comments at once
is included.

Bug: Issue 4494
Change-Id: Id8e49e500c8d48dbba661b885050657dd4cfc0be
2016-09-16 13:51:13 -07:00
Wyatt Allen
b1fbd9b310 Normalize selection ranges for copy
At the time that syntax highlighting DOM was introduced, the offsets of
selection ranges had been broken. In change [1] Kasper fixed this for
GR-DIFF-HIGHLIGHT with selection normalization functions. However,
selections for copying code as implemented in GR-DIFF-SELECTION were
still un-normalized.

With this change, the normalization functionality introduced in [1] is
moved to a JS library so that it can be used by both components. Tests
are updated.

[1] I26c61ca706575ea5df6e3b7b18a27225834396e8

Change-Id: I35ab0f71a46b3fc1d7356a314a0cae856f2ef28e
2016-09-14 10:13:46 -07:00
Wyatt Allen
9fcec7437f Generate clipboard data via diff rather than DOM reconstruction
This change uses a new method of generating the clipboard data that
circumvents several strange issues caused by shadow/shady DOM. This
new method is much more legible and abstracts more logic away from the
DOM.

Bug: Issue 4494
Change-Id: I8c186d6cbbe9536548d934f734856b1f9ced1a26
2016-09-13 14:24:57 -07:00
Kasper Nilsson
8bfab3ff24 Hotfix Safari WCT issues
This change fixes two minor issues in Safari.
- In gr-diff-highlight, Safari does not support NodeList.forEach.
- In gr-diff-selection_test, a test that should have been failing (a
  selection class was missing) was not being run in Chrome/CI. A prior
  commit modified the CSS selectors that enable text selection, and the
  test was not changed to reflect this.

  SHA of the offending commit: 613b49c

Change-Id: I7ef3b017be9ae731496609430e3856f58e5bd24e
2016-09-07 23:39:06 +00:00
Kasper Nilsson
613b49c64e Fix copy/paste in diff view
The addition of syntax highlighting silently broke copy/paste
functionality due to the addition of another layer of div nesting.

Related to this bug are some issues with correct text selection in
unified diff view, so this patch addresses them as well.

Bug: Issue 4317
Change-Id: Iac7379de4131ab4e44905a54218d42fcfe67ce62
2016-08-29 16:18:47 -07:00
Viktar Donich
01c211af6e Gr-diff-selection tests to work in Safari
Change-Id: I31e232acf4d53d521d38d6b2b14f5c39146c05d1
2016-06-13 14:32:24 -07:00
Viktar Donich
e1341972d1 Move text selection out of gr-diff.
Change-Id: I0734653066a1bb78f95c141aa8202fad315b13c0
2016-06-10 12:18:25 -07:00