99 Commits

Author SHA1 Message Date
Kasper Nilsson
2a3f59fdab Modernize image diff layout
As per UX instructions, adds a border between the images and replaces
the image outline with a box shadow.

Change-Id: Iec157ce7e346cab217a49d6fcee5977c1702478c
2018-08-01 12:29:19 -07:00
Wyatt Allen
37df38cb08 Remove accidentally merged console log
Change-Id: I6a2fa337cff78ce7fd4ef46d2a5780faab76edc9
2018-07-10 16:27:23 -07:00
Viktar Donich
e4851aa931 Use Polymer.dom() for image endpoint
This is required to correctly instantiate and query endpoint params

Change-Id: I8f048e342530da98ed14f93a59b2a27d4a1b0040
2018-06-11 20:15:28 +00:00
Kasper Nilsson
9635449f51 Reformat DOM surrounding image diff endpoint
Puts the plugin endpoint in a <td> with a colspan that allows the other
columns (e.g. line number col) to be sized independently. Also renames
the endpoint from 'imageDiff' to 'image-diff' in keeping with the
pattern set by other plugin endpoints.

Change-Id: If11066e7694d0459b3257b42abe308685975bf9b
2018-06-06 17:00:11 -07:00
Kasper Nilsson
decbe5fd74 Add plugin endpoint for image diffs
Adds a <gr-endpoint-decorator> in an image diff. The existing
side-by-side image diff format will remain (at least for now), and the
diff of the images will be shown centered between and below them. This
is done to not disrupt the existing table formatting.

Change-Id: Id6453ea1ee2897393b5acdb6f0cd2168892d33ab
2018-05-29 13:51:46 -07:00
Becky Siegel
8b60a5100b Fix links in gr-diff showContext buttons
Previously, when gr-diff-builder generated context buttons, it reset the
textContent after gr-button was created. This ended up removing the
paper-button from inside gr-button, and hence lost all button like
qualities.

This change replaces with the appropriate Polymer DOM API, and modifies
the gr-button styles accordingly.

Bug: Issue 8626
Change-Id: Ic9a33c6bc74d676b21a039dd8714e4001bcda207
2018-03-26 14:47:01 -07:00
Dave Borowitz
8cdc76ba4c Add @license tags to PG HTML and JS assets
These tags are preserved by the Closure compiler and vulcanize in order
to serve the license notices embedded in the outputs. In a standalone
Gerrit server, these license are also covered in the LICENSES.txt served
with the documentation. When serving PG assets from a CDN, it's less
obvious what the corresponding LICENSES.txt file is, since the CDN is
not directly linked to a running Gerrit server. Safer to embed the
licenses in the assets themselves.

Change-Id: Id1add1451fad1baa7916882a6bda02c326ccc988
2018-03-26 10:47:55 -04:00
Becky Siegel
a638c38bce Merge "Update comment thread creation/removal to no longer use locationRange" 2018-02-13 17:27:54 +00:00
Wyatt Allen
f5f6899752 Simplify CSS for diff line numbers
Line numbers in diffs had been specified in data-attributes and CSS to
avoid including them in pasteboard selections. However, we have since
moved to a different system that avoids including non diff content in
selections, and this CSS needlessly complicates style application.

With this change, diff line numbers show content, and the relevant CSS
is simplified. This provides a small, but measurable diff render
performance improvement.

Change-Id: Iad062553be533ead1dd29eaaacd5af8867249a16
2018-02-13 01:40:22 +00:00
Becky Siegel
bbde672af0 Update comment thread creation/removal to no longer use locationRange
Follow-up to https://gerrit-review.googlesource.com/c/gerrit/+/157590
which no longer used locationRange to group comments together into
threads. However, locationRange was still used for a few other things
including thread removal, which could result in a bug if there were
two threads that had the same locationRange and the wrong one was
found first.

Things included in this change:
1. Determine whether a thread group exists
   - This is identified as it was before. The thread group now gets a
     commentSide attribute, as it can pass it to all of its children
     (the same for all).
2. Determine if a thread exists within the group for a given range in a
   group
   - The range object is now included as an attribute on the comment
     thread instead of the locationRange string.
3. Be able to remove a thread group
   - A rootId attribute is now stored on the comment thread, which is
     data bound to each comment. When a comment is removed, it finds the
     thread with the rootId within the thread group to remove.
   - In the event that a thread group only contains a single draft,
     there is no roottId.

Change-Id: I4f7804ac02f4259b4964c6333d258f0fc3b29d24
2018-02-12 17:36:33 -08:00
Wyatt Allen
e515ff6c12 Do not collapse line numbers that are indicated in the URL
When users navigate to the diff view with a line number specified at the
end, depending on their context preference, the line might be in a
shared region that gets collapsed when the diff renders. With this
change, the location specified in the URL is prevented from being
collapsed by marking it as a "key" location.

Bug: Issue 5247
Change-Id: Ifd5827cd922b022cddb1601911a9ecea6a054f35
2018-01-22 14:03:24 -08:00
Ravi Mistry
9214bb2bec Check in GrDiffBuilder._renderContentByRange that el exists
gr-diff-builder should not try to re-render an element that does not
exist.

Context: When the lines specified in
https://gerrit.googlesource.com/gerrit/+/master/polygerrit-ui/app/samples/coverage-plugin.html#32
is not yet visible on the page it throws a JS error in the console.

Bug: https://bugs.chromium.org/p/skia/issues/detail?id=7081
Change-Id: Ia5051c8df2ef4a1c4f4f9b09f6aec68b4fd69fdf
2018-01-03 10:58:08 -05:00
Jeremy Roman
b4f32f7fee Use the basic multiplication sign for image dimensions.
The present symbol is "n-ary times operator" (U+2A09), from
the supplemental mathematical operators block, which renders
a much larger glyph than typical for basic multiplication.

This change replaces it with "multiplication sign" (U+00D7),
from the Latin-1 supplement block. It is the symbol ordinarily
used for multiplication (including dimensions), and is also
likely present in more fonts.

Change-Id: Id0e168bc61e25924e6b651587dc6b19a06c185f7
2018-01-02 18:29:48 +00:00
Becky Siegel
d655104c18 Add toast that explains user preference errors
Bug: Issue 7866
Change-Id: I09b3574a445ff8893c98eccaaa5377c2e7574a1d
2017-12-18 14:23:12 -08:00
Wyatt Allen
617adb42a6 Merge "Add ability to add annotation layers from plugins" 2017-12-01 17:46:24 +00:00
Ravi Mistry
af1e0f8bf6 Add ability to add annotation layers from plugins
Highlights:
* Adds a new getDiffLayers function to gr-js-api-interface.js. This is
  invoked by gr-diff-builder.html when gathering annotation layers.
* New annotationApi function in gr-public-js-api.js for plugins to call.
* The annotationApi function returns an instance of the new
  GrAnnotationActionsInterface in gr-annotation-actions-js-api.js
* GrAnnotationActionsInterface has an API for the plugin to register an
  addLayerFunction and an optional method to call to get a notify callback.
* The new samples/coverage-plugin.html is an end-to-end example of how
  to invoke the new APIs to annotate lines.

Bug: Issue 7339
Change-Id: Ie51845e0b3564953aba5d7d41986cedce0337073
2017-11-29 12:27:51 -05:00
Wyatt Allen
bde59814e6 Merge "Introduce diff builder for binary files" 2017-11-28 00:47:27 +00:00
Wyatt Allen
c56ece73e2 Support creating comments on merge parents
Bug: Issue 4760
Change-Id: I66ced578819b6f48d7d1535a54f1debf0e35374e
2017-11-27 11:09:58 -08:00
Wyatt Allen
bae435c7a6 Introduce diff builder for binary files
Binary files cannot be diffed like text, but for some binary changes,
the diff algorithm does yield binary differences as text. With this
change, the diff builder and processor are taught to render a special
message for (non-image) binary diffs, and will ignore the text
representation of the delta.

Bug: Issue 4031
Change-Id: I2dcdbe9def006de827a37c35c42606bc1c9cf4fc
2017-11-27 11:00:08 -08:00
Nick Carter
8b4b718d54 GrDiffBuilder: performance optimizations for building diff rows
This shows a nearly 4x improvement (in Chrome) for building
the DOM structure for a large diff. (this doesn't include
style calculation and layout, which is still expensive).

Bug: Issue 6514
Change-Id: Id06db0c9a281b846078aef0e6d584e1fa3c03d0f
2017-11-20 21:33:00 +00:00
Peter Burns
d78b793cf7 Convert the simplest cases of <content> to <slot>
The <content> element is deprecated, part of the Shadow DOM v0 API
which has been supplanted by Shadow DOM v1's <slot> element. For very
simple uses – like those in this change – this change should be safe
and will not require changes to the usage sites of your element.
Therefore, these changes are backwards-compatible with Polymer 1.0
applications.

As <content> is the more powerful API, Polymer 1.0 supports both
<content> and <slot> by converting <slot> back into <content> at
runtime. Polymer 2.0 only supports <slot>. There will likely never be
cross-browser native support for <content>, while Safari and Chrome
already support <slot> natively.

PiperOrigin-RevId: 174107440
Change-Id: I21fd97ff6efe95231089f98853146353e0e4ebf2
2017-11-02 19:56:28 -07:00
Wyatt Allen
ed628d7f37 Show blame in diff
With this change a blame column is added to the left side of diff
tables. The column is empty and hidden until blame is loaded. A button
is added to the change view to trigger a load of the blame for that
diff, as well as a unload it if already loaded. In this stage, the blame
information is non-interactive and only displays the SHA, date and
commit author.

Feature: Issue 6075
Change-Id: Ifcb951265d0e6339094e6b7c9574ec9c69e60b51
2017-09-27 18:55:42 -04:00
Wyatt Allen
1b8631f4dd Upgrade gr-diff-builder_test.html to use sandbox generally
Some sub-suites of the gr-diff-builder tests already used Sinon
sandboxes, but no sandbox had been setup for the tests overall. With
this change all tests in this file are upgraded to use the sandbox.

Change-Id: I778f5e68ee5fb8e73e9b5245252b18f934ebfee1
2017-09-22 11:30:48 -07:00
Becky Siegel
8d92d53db5 Annotation updates
Change-Id: I146f76b9dcc1a92e18acec01481ad280fb431868
2017-08-12 11:49:52 -07:00
Wyatt Allen
f0eb4bbf53 Harden gr-formatted-text agains slow/failed project configs
Formerly, if a formatted text component tried to render without the
project config (used by inner linked text components) it would
temporarily fall-back to rendering the unformatted (and un-linkified)
text via `.textContent` -- mirroring the behavior of gr-linked-text.

The result is formatted text elements (when rendered without a project
config) appear as one long line of text. Unlike linkification, however,
text can be accurately formatted with or without the project config --
so this disruptive, poor UX is unnecessary.

The formatted text component is updated to format text when the project
config has not provided, and to re-render when the config has been
provided.

In order to propagate project config loads to the formatted text
components hosted by diff comments, the REST calls must be made by the
diff thread component. To make this call, the thread must have the
project's name, so gr-diff-builder is updated to provide this name to
thread components.

Bug: Issue 6686
Change-Id: I8d09c740930500e99cb5f87b92f4d72f3f50a9ce
2017-08-01 16:14:45 -07:00
Kasper Nilsson
076adcd4f8 Fix errors introduced by eslint^4.0.0
The release of eslint 4 introduced some breaking changes -- a full
upgrade guide can be found here [1].

In this change, the "no-useless-escape" and "indent" rules are disabled,
"indent" being replaced with "indent-legacy" to minimize breaks due to
lint. Also, extra spaces before comments and other assorted new lint
issues are corrected.

The long-term plan is to move away from the deprecated "indent-legacy"
rule and also reenable the "no-useless-escape" rule, but for now we
want to minimize breakages and not affect PG developer velocity.

[1] http://eslint.org/docs/user-guide/migrating-to-4.0.0

Change-Id: I8044256c95e3fe3f94fa9acc7922600908f8a0f4
2017-07-05 19:34:14 +00:00
Alice Kober-Sotzek
ec44e83877 Highlight hunks which are due to rebase on PolyGerrit
Change-Id: Ifd31c8b2d31d71ff19060da56d81b64954f4fdb7
2017-06-09 13:38:50 +02:00
Kasper Nilsson
40ea3ade99 Improve a11y for diff viewing
Adds an aria-label to added and removed rows marking the row as "added"
or "removed" for screen readers. As part of this change, the <tr>
elements that make up the diff are now focusable.

Test plan:
- Somewhat included as a part of testing this functionality is the use
of WCT's a11ySuite function[1]. This will be introduced in a later
change.

[1] https://goo.gl/P15eE6

Bug: Issue 6435
Change-Id: I676fc171d404ca6e8e9276965192b1452595fa61
2017-06-06 17:25:32 -07:00
Mike Samuel
e07c4b2ea1 Add polygerrit-ui/app/test/common-test-setup.html
This is a partial roll-forward of c/106190

This replaces all loads of iron-test-helpers with a load of a file
that wraps it, and adds that file to test files that do not currently
load iron-test-helpers.

A future CL will also install polymer-resin via common-test-helpers.html.

I tested by running

$ WCT_ARGS="-l chrome" ./polygerrit-ui/app/run_test.sh

Change-Id: Ifb3cd2c8db13d724f57e56e7e78045470d103a43
2017-06-05 22:10:12 +00:00
Wyatt Allen
21e6b7f207 Close race condition that mixed content from other diffs
Previously, when a diff was reloaded, it would clear the diff content
(the previous diff) and open requests for the data regarding the new
diff. When the requests finished, it would cancel async processing and
start it again on the new data. In this arrangement, a narrow race
condition was present where the async rendering could emit a diff from
the previous diff after the diff table had been cleared, but before the
network requests resolved -- resulting is content form the previous diff
appearing in the new one.

With this change, the async processing is cancelled at the same time
that the diff content is cleared.

Bug: Issue 6170
Change-Id: Ie5a807082ab51156595f9eeb9ba6c958d41e890a
2017-06-05 09:19:00 -07:00
Wyatt Allen
c601abccc3 Revert "Polygerrit now loads polymer-resin"
This reverts commit 0895052c01ac5ac657a9763d2ad9967d9ae55c18.

Reason for revert: issue 6387

Change-Id: I14e00addeab53606952aa3ea2d45a74eac7a9d8a
2017-06-02 09:37:37 -07:00
Mike Samuel
0895052c01 Polygerrit now loads polymer-resin
polymer-resin intercepts polymer property assignments
before they reach XSS-vulnerable sinks like `href="..."`
and text nodes in `<script>` elements.

This follows the instructions in WORKSPACE for adding a new bower
dependency with kaspern's tweak to use the dependency in a rule so
that it's found.  //lib/js/bower_components.bzl has already been
rolled-back per those instructions.

The license is the polymer license as can be seen at
https://github.com/Polymer/polymer-resin/blob/master/LICENSE though
I'm not sure that //tools/js/bower2bazel.py recognizes it as such.

Docs for the added component are available at
https://github.com/Polymer/polymer-resin/blob/master/README.md
https://github.com/Polymer/polymer-resin/blob/master/getting-started.md

With this change, when I introduce an XSS vulnerability as below,
polymer-resin intercepts and stops it.

Patch that introduces a strawman vulnerability.

--- a/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header.js
+++ b/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header.js
@@ -55,6 +55,10 @@
         url: '/q/status:abandoned',
         name: 'Abandoned',
       },
+      {
+        url: location.hash.replace(/^#/, '') || 'http://example.com/#fragment_echoed_here',
+        name: 'XSS Me',
+      },
     ],
   }];

---

Address kaspern's and paladox's comments.

---

Undo version bumps for bower dependencies.

---

Change Soy index template to parallel app/index.html.

---

update polymer-resin to version 1.1.1-beta

----

Load polymer-resin into polygerrit-ui/**/*_test.html

After this, I ran the tests with
  -l chrome
  -l firefox

I ran a handful of tests with -p and observed that the
console shows "initResin" is called before test cases start
executing.

These changes were done programmaticly by running the script below
(approximately) thus:
```
gerrit/ $ cd polygerrit-ui/app
app/ $ find . -name \*test.html | xargs perl hack-tests.pl
```

```
use strict;

sub removeResin($) {
  my $s = $_[0];
  $s =~ s@<link rel="import" href="[^"]*/polymer-resin/[^"]*"[^>]*>\n?@@;
  $s =~ s@<script src="[^"]*/polymer-resin/[^"]*"></script>\n?@@;
  $s =~ s@<script>\s*security\.polymer_resin.*?</script>\n?@@s;
  return $s;
}

for my $f (@ARGV) {
  next if $f =~ m@/bower_components/|/node_modules/@;

  system('git', 'checkout', $f);
  print "$f\n";

  my @lines = ();
  open(IN, "<$f") or die "$f: $!";
  my $maxLineOfMatch = 0;
  while (<IN>) {
    push(@lines, $_);
    # Put a marker after core loading directives.
    $maxLineOfMatch = scalar(@lines)
      if m@/webcomponentsjs/|/polymer[.]html\b|/browser[.]js@;
  }
  close(IN) or die "$f: $!";

  die "$f missing loading directives" unless $maxLineOfMatch;

  # Given ./a/b/c/my_test.html, $pathToRoot is "../../.."
  # assuming no non-leading . or .. components in the path from find.
  my $pathToRoot = $f;
  $pathToRoot =~ s@^\.\/@@;
  $pathToRoot =~ s@^(.*?/)?app/@@;
  $pathToRoot =~ s@\/[^\/]*$@@;
  $pathToRoot =~ s@[^/]+@..@g;

  my $nLines = scalar(@lines);
  open(OUT, ">$f") or die "$f: $!";

  # Output the lines up to the last polymer-resin dependency
  # loaded explicitly by this test.
  my $before = join '', @lines[0..($maxLineOfMatch - 1)];
  $before = removeResin($before);
  print OUT "$before";

  # Dump out the lines that load polymer-resin and configure it for
  # polygerrit.
  if (1) {
      print OUT qq'<link rel="import" href="$pathToRoot/bower_components/polymer-resin/standalone/polymer-resin-debug.html"/>
<script>
security.polymer_resin.install({allowedIdentifierPrefixes: [\'\']});
</script>
    ';
  }

  # Emit any remaining lines.
  my $after = join '', @lines[$maxLineOfMatch..$#lines];
  $after = removeResin($after);
  $after =~ s/^\n*//;
  print OUT "$after";

  close(OUT) or die "$f: $!";
}
```

---

update polymer-resin to version 1.2.1-beta

---

update Soy index template to new style polymer-resin initialization

----

fix lint warnings

----

Load test/common-test-setup.html into *_test.html

Instead of inserting instructions to load and initialize polymer-resin into
every test file, add a common-test-setup.html that does that and also fold
iron-test-helpers loading into it.

----

imported files do not need to load webcomponentsjs

Change-Id: I71221c36ed8a0fe7f8720c1064a2fcc9555bb8df
2017-05-30 23:16:09 -04:00
Kasper Nilsson
3a2f287d71 ES6ify /gr-diff-builder/*
Bug: Issue 6179
Change-Id: I9d72fb89a3c3ad916c9097bdf6e5fb31a1dd4cf0
2017-05-18 00:32:33 +00:00
Wyatt Allen
b5e44d8cd2 Fix custom event to recompute diff cursor stops on context show
Bug: Issue 6188
Change-Id: If038b2e7dc9c070e69eb5264a94ea707f4847c46
2017-05-15 09:12:45 -07:00
Becky Siegel
70a8269b52 Add diff preferences to change view
Noteworthy decisions:
- Preferences are hidden when diff prefs are not loaded or the user is not
logged in.
- Preferences are hidden on small screens
- The trigger button is in gr-change-view but the gr-diff-preferences
  is part of gr-file-list. This is because gr-file-list because diff
  preferences and local preferences are more closely tied with that
  than the change view. In order to put it in the change view, local
  prefs would also have to be two-way bound back.

Also fixes computePrefsButtonHidden in gr-diff-view as well. The
function did not work as intended before. If preferences didn't exist,
the function would not get called, and the container would not be
hidden.

Bug: Issue 5426
Change-Id: I361cdf132c6e15b5ae2f15e62af318cfa05161ce
2017-05-10 15:55:57 -07:00
Wyatt Allen
2830ec831c Additional restrictions in MIME type in image diffs
Change-Id: Ib17e0a9edd792864ae67271cc9756df0790d57e8
2017-04-18 15:42:13 -07:00
Wyatt Allen
170fa5b805 Fix added and removed images
Runtime errors occurred when image diffs showed added or removed images
(as opposed to modified images). With this change, test cases are added
to encode behavior against future regressions, and diff builder logic is
updated to avoid the error.

Bug: Issue 5995
Change-Id: If04220256074dac245b971e6229f0dae4a175689
2017-04-13 11:40:15 -07:00
Becky Siegel
7fe6a3b4cc Don't show binary image content & fix image label
Previously there were times when binary data from an image diff would
display. This change adds a check in the diff processor for image diffs
and does not display anything other than the file line in that case.

This change also addresses an issue where the label is calculated too
soon. The image size (if it exists) is supposed to be included as part
of the label, but often this was calculated before the image was done
rendering, so it didn't display.

Bug: Issue 5887
Change-Id: I9cd1ad0c3f2603492d7d84892147bd6852bbae29
2017-03-31 10:11:16 -07:00
Viktar Donich
29e1ce5e84 Collection of prospective test flake fixes
Potentially related:
https://github.com/Polymer/web-component-tester/issues/505

Bug: Issue 5792
Change-Id: I9ab6e8e40d9811dd52906335426764c052907609
2017-03-30 13:46:58 -07:00
Becky Siegel
0727efa3d1 Implement isOnParent as functions rather than an attribute on comments
Previously, the rest api interface set '__isOnParent' for comments.
When comments were added, the property from the comment thread
'isOnParent' was passed as a property. When the draft was saved, it was
expecting '__isOnParent' rather than 'isOnParent' and this caused
comments to show up on the wrong side after saved/refreshed, because
'__isOnParent' was undefined.

Instead of changing to either '__isOnParent' which would be strange to
pass as an attribute or 'isOnParent' which would look like it came from
the api directly, this change introduces isOnParent functions so that
translation doesn't need to be done with the API.

Bug: Issue 5831
Change-Id: I3b849ba5878275cda0a39638626a12bd51341a29
2017-03-21 14:57:58 -07:00
Becky Siegel
cd2d4232f1 Reduce confusion between side and commentSide
Use '__isOnParent' as a boolean in place if 'side' ('PARENT vs
'REVISION').  In doing so, it's necessary to convert to/from 'side'
whenever interacting with the REST API.

Change-Id: Ic023c9be1969597e4b9c73a51cfed9f5eb9bc23e
2017-03-15 13:50:21 -07:00
Wyatt Allen
8fd847fb77 Initialize diff cursors as soon as diffs render content
Previously diff cursors initialized when their diffs completely finished
rendering. This means waiting longer than needed because the diff render
process includes processing and rendering syntax highlights whereas the
diff cursor only needs to wait on the content of the diff.

With this change diffs fire an event when they've finished with their
content only, and diff cursors await this event instead of the full
render.

Bug: Issue 5681
Change-Id: Ida9da83a20fe4c2dcd8920304504ec7e1185eb5d
2017-03-01 17:19:00 -08:00
Viktar Donich
c6894439c6 Take tab size into account for line-wrapping
Previously, the logic was only checking exact line wrap boundaries and
missed tabs advancing over the boundary.

Also, line breaks were added inside span elements wrapping tabs, which
prevented correct rendering.

Bug: Issue 5597
Change-Id: I750547cb574c02965d5a30ba57f791841779297a
2017-02-22 14:56:22 -08:00
Becky Siegel
a88f8c82d4 Fix corner case where storage gets duplicated for patchsets
Previously, there was an issue where if you create a draft comment in
side by side view and switch to unified view, the comment thinks it's in
the later patch set rather than the earlier one and a second copy gets
added to local storage with the later patchset as a component of the
key.

This was because the the thread group assumed all threads inside of it
had the same patch number. This change fixes that, so in the event that
a user switches from side by side to unified, the patch number will get
taken from the comment rather than the thread group.

Bug: Issue 5493
Change-Id: I7f00997bcb2e6f1001a5d58ac206acf5af3367d2
2017-02-10 14:52:57 -08:00
Wyatt Allen
3d8dc2edda Merge "Render inline diffs sequentially" 2017-02-08 00:42:09 +00:00
Wyatt Allen
206966a5ae Render inline diffs sequentially
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
2017-02-07 16:17:56 -08:00
Becky Siegel
41bdc04cb8 Don't merge threads on same line left/right
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
2017-02-07 21:00:52 +00:00
Wyatt Allen
e153473446 Merge "Fix lint errors" 2017-02-02 01:45:00 +00:00
Wyatt Allen
455c91c88b Merge "Allow multiple threads per line, with different ranges" 2017-02-02 00:39:40 +00:00
Becky Siegel
562a30493e Allow multiple threads per line, with different ranges
- 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
2017-02-01 16:10:08 -08:00