Changes with large numbers of files could overwhelm PolyGerrit when a
user selects [Expand all] for inline diffs. This was because the
asynchronous processing/rendering/annotating process would be kicked off
for all unexpanded diffs simultaneously, resulting in browser lock-up
and general slowness even after rendering had completed.
With this change, inline diffs are rendered in serial rather than
parallel. In this way the benefits of the async features of diff
rendering extend to the file list, even for changes with many large
diffs (such as the one in the linked issue).
With this change, the `__expanded` property is removed from file objects
in GR-FILE-LIST. Instead, that element maintains a list
(`_expandedFilePaths`) which records the same information. Because the
expanded files are recorded in a list, however, splices on the list can
be observed, batch diff expansion can be handled sequentially.
Tests are updated to respect the new expanded paths list.
Bug: Issue 5396
Change-Id: Ib83ff5157177e1c890db8a82fbc25df8fecbe065
Goes along with c/95273/. Adds commentSide attribute to comments to see
which side of the diff view they belong on. This is also used as part
of the locationRange for the gr-diff-comment-thread-group, so that two
thread groups can be on the same line or range for the unified group (
one for the right, one for the left).
Note: there is already a 'side' attribute on the gr-diff-comment, which
is confusing. This side actually references 'PARENT' or 'REVISION', to
identify whether the comment belongs to the parent or any revision. On
diffs where two revisions are compared to each other, this cannot be
used to determine left/right. However, because 'side' is part of
the CommentInfo entity[1], it is difficult to change the name and make
more sense out of that.
[1] https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#comment-info
Bug: Issue 5114
Change-Id: I5cc4c17d4bb134e31e5cc07ff9b08ed349488c97
- Add concept of diff comment thread groups, which are all of the
threads at a particular line number.
- The thread group is responsible for breaking up comments into threads
based on the range of the comment.
- Thread groups are ordered by the updated time of the first comment in
the group.
- Thread groups are given a key, based on comment range, which is used
to determine what thread group a new comment should go in (or if it
needs a new one).
Feature: Issue 5292
Change-Id: If544e8bb879262de3ce5397e86124837b66ada04
Diffs in PolyGerrit apply two shades of highlight to changed lines
(light and dark) to indicate the granularity of modifications and to
distinguish intraline edits. However, the logic for choosing the
background shade for diff lines would differ from that of GWT UI diffs
subtly.
+----------------------------------+----------------------------------+
| GWT UI Shading Logic | PG Shading Logic (incorrect) |
+----------------------------------+----------------------------------+
| Diff lines get a dark background | Diff lines get a dark background |
| IFF they appear in a delta chunk | IFF they do NOT contain any |
| that is empty on the left OR | intraline differences. |
| empty on the right. | |
+----------------------------------+----------------------------------+
| Diff lines get a light background otherwise. |
+---------------------------------------------------------------------+
With this change, the shading logic in PolyGerrit is modified to match
that of the GWT UI.
Bug: Issue 4219
Bug: Issue 5117
Change-Id: Ice24292df777118c08c3e73f771720f8a186a183
This change adds an API request to get robot comments for displaying
inline in the diff view. They are styled in a different color, contain
build and robotId information, and a "please fix" action rather than the
standard set of actions.
Feature: Issue 5089
Change-Id: I1f5954a2ed01920bb7c3dc897e3285687ff7d3ca
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
Previously, the line marker was only subtly visible by the highlighted
line number. This change adds a bottom border to the selected line if
the user is using keycodes (j, k, up, down) to more the cursor. When
the escape key is pressed, the distinguished line marker will dissapear.
Feature: Issue 4739
Change-Id: If8c751efc137ef87cfdad1c8bf7d905de1219107
A css rule that was added for the full width diff caused lines to wrap
incorrectly. I've adjusted the style so that it is only present with
the full-width class.
Bug: Issue 4870
Change-Id: Ie94d0a06a125efb9fe7fa25ff7f2d45f54331d64
Previously in Polygerrit, diff views were always displayed in the width
specified in diff preferences. This change gives the option to wrap
lines instead, which takes precedence over column width (the column
width option is hidden when line wrapping is selected), and fits the
diff view to screen.
The gerrit API already supports the 'lineWrapping' preference so this
change uses that already existing option.
Feature: Issue 4809
Change-Id: I0d9e292739b5910abfd04af63ec4c745bf06e446
Diff header scrolls with content and sticks to the top.
Implemented custom gr-header wrapper to accomodate this.
Bug: Issue 4491
Change-Id: I451ecd4f6c454fd9ab3085ad8f9c5bdd27cb9269
This reverts commit a7b89441bda7a1ea7e98969462c2def989bd68c2.
Reason for revert: Got a better idea for app layout, will send follow-up change.
Change-Id: I7b7c86288fb070114e76dd68701e05c539089eab
This reverts commit 37ef1672f9133b605c5e14f8fbcc241d4c40eb50.
Reason for revert: Got a better idea for app layout, will send follow-up change.
Change-Id: I7bfddcef416d44c7af88d74da6b39c2a93565d32
Formerly, GPU rendering was hinted for diff tables on TBODY elements for
scrolling performance on large diffs. This would cause the right border
of the table appear inconsistently in Chrome -- likely as a fluke of
GPU layer compositing. With this change, the entire TABLE is hinted
rather than the TBODIES inside it, allowing them to be composited
together.
Bug: Issue 4801
Change-Id: I952a2d71a2ebd2d92b326b565b85fb55b52927cf
Fixes footer at the bottom of the page for all pages and changes
scrolling behavior for diff page.
On the diff page:
- horizontal scrolling is right above footer when required
- all headers stay in place when scrolling
Bug: Issue 4491
Change-Id: I62fdf130376b210c26fadcadc90bf452361ac15d
Because code comments are rendered using italics, and because italics
can sometimes draw text outside of their bounding boxes, some characters
may be visually obscured when they are adjacent to an annotation with a
background color -- particularly intraline difference annotations. With
this change, intraline difference background is given an alpha channel
so that such characters are not obscured.
Bug: Issue 4785
Change-Id: I5372e6f4def5e69126288965eb9829e5680c2102
+ These were slowing down tests in cases where it would actually hit a
live server, potentially adding the latency from the network to the
test.
+ Other fixes involve removing unused imports of util.js amongst other
small tweaks/fixes.
Bug: Issue 4016
Change-Id: I442deefebeffc6a701e4922faccfe1c74b3a35b6
Added temporary safeguard for the font preferences change so that inputs
are hidden and custom styles are not set if font-size was not part of
the preferneces response.
Change-Id: I5b34b317bf953591889fa25e1c351d4f490d989e
If a file is too large for the server to deliver the diff, the API will
respond with HTTP 409. PolyGerrit interprets th this as a network error
and covers the entire page with an error message. Furthermore, the
handler for loading the diff is not written for this kind of failure and
tries to dereference the diff object -- null in that case.
With this change, the 409 message does not block use of the whole page
and the handler does not break when the diff is null.
Issue: Bug 4770
Change-Id: I68fe50c474fc03d4217e969649f62df38ca5b632
This change adds a font size field in diff preferences in both the
generic preferences page and also the preferences modal from the diff
view. The new field allows users to update their preferred font size
for the diff view to be displayed. This updates both the line number
font size as well as the diff font size.
Feature: Issue 4417
Change-Id: I0fb75fd2186d2ff63b3627e8b0f15f2b3cddbfa3
Refactors bindings in file lists to change the expanded state of a diff
using a property name that does not collide with the hidden attribute.
Change-Id: I7f7e38a910a8d4dd19be2d591033be6f6d3cb7a1
In https://gerrit-review.googlesource.com/c/86117/ the data binding
between the _files array and the dom-repeat in gr-file-list was not
properly enforced. This change fixes that, and also properly
references a static file-list property.
In addition, tests were implemented to ensure this regression is caught
in the future.
Bug: Issue 4575
Change-Id: I32a5645ec47d953ee6a7a71f4b14fc8c9483df3d
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
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
This commit enables the user to manually expand individual diffs
inline in the file list of the change view.
Bug: Issue 4382
Change-Id: I87d5af9971fed3aa5e1eb64523f4623a5ff2ac8d
This change reverts visible tabs to use the » character. A few different
approaches have been used for rendering these tab indicators:
I: Before the Annotation Pipeline, tab indicators were configured by a
class that was optionally applied to tab elements by the diff
builder. The class was guarded by the show_tabs preference and a CSS
rule created a `::before` pseudo element to insert the character.
(Thus also preventing the » from being copyable text.)
II: When the Annotation Pipeline was implemented, the ordering of layers
called for intraline difference elements being rendered *inside* tab
indicators. As a result, the » indicator would sometimes have a
different background than the intraline difference, looking sloppy.
To solve this, the pseudo element was positioned using absolute,
allowing the pseudo element to consume no horizontal space and and
the intraline background to extend across the entire tab.
III:When performance tuning, it was discovered that the
absolute-positioned tab indicators were positioned incorrectly when
GPU acceleration was hinted for the diff, so the containing tab
elements were made relative.
IV: Continuing performance tuning, the tab indicators seemed to slow
scrolling on very large diffs with tabs. It was mistakenly assumed
(by me) that this was related to the pseudo-elements when it was
actually caused by the thousands of positioning contexts they
created using relative and absolute.
Instead they were modified to use strike-through instead of a pseudo
element, which was more-performant, but less-usable (it looked bad).
With this change, we roll-back the clock a little and solve a core
problem: namely that tab indicators were not annotated inside the
intraline differences. Fixing that, positioning tricks are no-longer
needed to make the background look right.
To do this, we decouple the tab elements (which control tab width) from
the tab indicators (which optionally make tabs visible). This is done
using an annotation layer that inserts tab indicator elements wherever
a tab character is used in the source content, and it does so after
intraline differences have been applied.
Bug: Issue 4441
Change-Id: I4fea2a3a20a7039bfeb746bd1e1c1004e43c4801
A source of latency when creating diff comments in large diffs is the
work needed to reflow the diff DOM to make room for the new comment.
This is particularly evident when adding comments to new files because
the diff is built as an addition group representing the entire file, so
the comment causes a reflow on every subsequent line.
This change optimizes this process in three ways.
* **Limit the size of ADD & REMOVE groups:** The diff processor will now
break an add or a remove chunk into a series of smaller chunks of the
same kind. This is controlled by the MAX_GROUP_SIZE constant. In this
way the number of nodes that need to be reflowed when a comment is
added to an add or remove group is limited to the number of subsequent
lines in that group plus the subsequent number of groups.
* **GPU optimize group in general:** Adds CSS properties to diff TBODY
elements (which correspond to groups, for the most part) that trigger
GPU acceleration when available.
* **Apply `table-layout: fixed;`** This style speeds up table reflow in
general.
Change-Id: Ie0e3665b7752fec67f7123cfae70ae99e6f67521
Improves the speed of diff (particularly when scrolling in a large diff)
by removing the hover state for line numbers and by removing the pseudo
elements used in visible tabs.
Change-Id: I3c8687ec282696842b51f8f43b76aa267a1506b1
When a change contains removal of large block of text, in left diff side
it is highlighted with red, and in right side there's a corresponding
empty space. Hiding left diff side leaves gaps in the code.
This change hides those gaps when left diff side is hidden by Shift+A.
Feature: Issue 3926
Change-Id: I11c6574c098a9ecfe58d1804ba57c5c4f97e4d1a
Introduces the gr-syntax-layer element. This element works as an
annotation layer that is configured with the diff and asynchronously
computes/applies syntax for the diff.
Introduces a custom build of Highlight.js which gr-syntax-layer makes
use of. Building the script is documented in
scripts/vendor/highlight/building.md.
The layer is connected to the annotation pipeline in gr-diff-builder as
the lowest layer and syntax processing is triggered only after a diff
has been completely rendered.
A number of styles are added to the gr-diff element for syntax markers.
Tests added for gr-syntax-layer.
Bug: Issue 3916
Change-Id: Ic33e40f4fe39dfce1a62de133cfaf32be5e3f25a