17 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
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
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
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
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
3a2f287d71 ES6ify /gr-diff-builder/*
Bug: Issue 6179
Change-Id: I9d72fb89a3c3ad916c9097bdf6e5fb31a1dd4cf0
2017-05-18 00:32:33 +00: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
Wyatt Allen
d0dd392794 Establish annotation pipeline
Apply diff annotations (intraline differences and comment ranges) by
executing the annotation layers in order to each line. The diff builder
maintains an ordered array of annotation layers which are communicated
to GrDiffBuilder subclass instances. The builder also listens to each
layer for notifications that annotations have changed for some line
range and re-renders (i.e. re-applies the pipeline on DIV.contentText
elements) accordingly.

Change-Id: Iea0599d4869cafaadc0974158153a91d927913e8
2016-07-20 12:25:40 -07:00
Wyatt Allen
7f2bd97901 Separates diff processing from diff building
Moves the diff-processing functionality of the gr-diff-builder component
into a new gr-diff-processor component which exposes a promise-based
interface. This is step one of creating an asynchronous (non-blocking)
diff rendering system.

As much as possible, this change is a transfer of code (with tests) from
one component to another, making it easier to verify that functionality
has not changed. Cleanup of the code, and refactoring it into a
more-testable form will come with later changes.

Feature: Issue 3916
Change-Id: I875b03b20bf953b128cbe3c5001ba1f8eba12c61
2016-06-27 16:44:19 -07:00
Wyatt Allen
16810999f6 Prevent redefinition of class libraries
A number of classes used in PolyGerrit are defined in vanilla JS files
that are included multiple times by various elements.  For example,
gr-diff-line.js is included by the gr-diff-builder and by gr-diff
elements. Adds #ifndef-style guards to each of these libraries to
prevent redefinition and avoid different elements potentially referring
to different versions of the same class.

Change-Id: I45e3ba425a59989b328475b1fe58fd9f350c8ae0
2016-06-27 09:43:06 -07:00
Viktar Donich
0f02cda57e Make gr-builder a Polymer component
Updated tests, fixed draft comments, context expanding.

Change-Id: Ic4bd9682c63edd8e80fbc2abcb4fa5e406a202ab
2016-06-03 10:22:47 -07:00
Andrew Bonventre
6c9d862e10 Revert "Make gr-builder a Polymer component"
This reverts commit 56689af0f92ce13f90ff9369544c5f9cc0412f09.

Reason for revert: This change broke adding draft comments in the diff
view.

Change-Id: Icfbd3eb4e24cce3e1690e7eaf12e14e5705c7e3e
2016-06-03 13:07:33 +00:00
Viktar Donich
56689af0f9 Make gr-builder a Polymer component
Change-Id: I0d99775332b0ef473459ad481970ad6033427c7d
2016-06-02 13:09:39 -07:00