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
A major source of latency in creating comments in large diffs stems from
GR-DIFF-SELECTION applying selection-restricting classes to a parent of
the diff. When the diff contains a large number of lines (and thus a
large number of elements) applying a class forces a style recompute for
the substantial subtree.
This change optimizes this in two ways:
* **Initialize to the right side:** The selection-restricting class is
initialized to the right side, before the diff is even completely
built. This eliminates the need for a recomputation preceding the
first comment add on the right side (the most-likely side to be
interacted with).
* **Minimize the number of class modifications:** only add or remove
classes when necessary. This eliminates recomputes for consecutive
mousedown events that occur on the a common diff side.
On an i7 MBP, this eliminates ~120ms for the first comment on the right
and ~40ms for subsequent such comments.
Change-Id: Ibb8a7eca0398a5c7265dc1385967bce3dae5e5ef