111 Commits

Author SHA1 Message Date
Wyatt Allen
12f92ebdae Merge changes I5726cae3,Ie3acbfa4
* changes:
  Use --dialog-background-color in more dialogs
  Rework some CSS constant usage
2018-05-01 01:40:00 +00:00
Kasper Nilsson
a840929c0c Use --deemphasized-text-color in context expander
A recent change removed the --gr-button-color mixin, but did not set the
proper button color in the context expander.

Change-Id: I92393097fb4c3cc8b7b024ea90bac9d63610e81d
2018-04-30 10:56:21 -07:00
Kasper Nilsson
e46284e4c2 Rework some CSS constant usage
Usage of the --header-background-color constant in place of #eee was a
bit aggressive. This change modifies the styling to use constants that
have a more consistent usage (table-header-background-color, for
instance) and also introduces another new color,
--chip-background-color, for styling chips.

Bug: Issue 8809
Change-Id: Ie3acbfa4d221acc4f210f76bbb425a21e7f8b63e
2018-04-30 10:21:34 -07:00
Kasper Nilsson
83d8aaceec Use CSS variables in the diff
Change-Id: I35734f619ce10eb66b343c318148ed3ed24cc802
2018-04-21 14:10:11 +02:00
Kasper Nilsson
6fa20d3b3d Major refactor of button styles
Declares several CSS variables for styling buttons throughout the app
and uses them.

Removes the concept of a 'tertiary' button -- primary and secondary have
the exact same styling, so all tertiary buttons are changed to secondary
buttons and the existing secondary button (only replyBtn) is changed to
a primary button.

Also removes some of the many ways to modify a button color and
background -- there is no need for mixins to specifically style various
attributes of the paper-button when the ability to apply any styles
directly to it (via @apply --gr-button) is already supported.

Change-Id: I19a4114764df80b06175032b228a6ec63b414089
2018-04-20 14:02:59 +02:00
Kasper Nilsson
3f2dd67472 Replace #eee with header-background-color
Change-Id: I17bb95f92129afd3f2528f5e52462d1c56ad7a1f
2018-04-19 13:35:13 +00:00
Kasper Nilsson
b0d03d047a Introduce deemphasized-text-color
Introduces and standardizes the various shades of medium dark gray used
throughout the app to #616161, or Material Gray 600.

Change-Id: I311155cfdba4381643451233dfafbfbdacd55e90
2018-04-19 08:21:49 +00:00
Wyatt Allen
13c5e1dde5 Merge "Refactor syntax highlighting palette" 2018-04-18 13:28:33 +00:00
Kasper Nilsson
889ca950f9 Refactor syntax highlighting palette
Puts the palette into variables set by the app theme.

TODO: Refactor the app theme into app theme and syntax theme, but keep
the variable usage added in this change.

Change-Id: I4fe0789af3f7bbc1b8b0568f62bc58814a0d571d
2018-04-18 12:19:11 +02:00
Kasper Nilsson
fc208bad8a Make context expander non-monospaced
Bug: Issue 8783
Change-Id: I3069c03778d76f491a2673b5080e5623031844c4
2018-04-18 09:54:49 +02:00
Kasper Nilsson
c4f41031b9 Use view-background-color throughout the app
Change-Id: Ib74162411afde7cdb2121f5e7b78e81a97341bfd
2018-04-17 11:33:22 +02:00
Kasper Nilsson
92ad99f345 Use the same text color throughout the app
Change-Id: I55f83e0dbdd83efcbe179683b87060440908e789
2018-04-16 10:15:33 +02:00
Kasper Nilsson
c828098853 Use the same border color throughout the app
With this change, all CSS border declarations that specify some shade of
gray are modified to use the one unified --border-color declaration in
app-theme.html.

Further followup with UX is required to ensure that the shade of gray
chosen is the correct one -- for now, the most-used one is used.

Change-Id: I2134ebf4a459ba040e01856c11389780307d8648
2018-04-13 21:23:07 +00:00
Viktar Donich
60cbd2f4c6 Don't constrain max diff line length to 80ch via CSS
Because CJK (Chinese-Japanese-Korean) glyphs may have variable width.

Bug: Issue 7984
Change-Id: Ifef672f03329db3770279f28f50033bd50f23934
2018-04-11 13:36:37 -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
Paladox none
0e7367ceea Fix gr-diff to shows diff background colours
Change background: to background-image as background:
will overide any background-* vars.

Bug: Issue 8612
Change-Id: Ibc6632d09a0f258e852d21b13ff05bb68dd00ad0
2018-03-22 18:30:46 +00:00
Becky Siegel
7982f5ca7f Update background image to single pixel for line limit
Change-Id: I0f53e2490ffe066eabf826f7857a9e5ad04078bf
2018-03-20 10:40:44 -07:00
Becky Siegel
d3cd125ea6 Add a line limit indicator in fit to screen mode
When the width of the screen is larger than the line limit, a line will
be visible to indicate the line limit. When the screen is narrower than
the line limit, the indicator is not visible.

Bug: Issue 4813
Change-Id: I06cd97c10c33c4eb9e73340752b9254f10239ddb
2018-03-19 15:29:09 -07:00
Becky Siegel
377e289120 Revert "Replace gr-fixed-panel with position:sticky"
This reverts commit 368641eb4f91f8dbb2fbb2f3e958aa2797fba93b.

Reason for revert: This introduced a bug which causes horizontal
scrolling on pages with a vertical scroll bar, due to 100vw hot taking
into account the width of the scroll bar. This is not an easy fix, so
reverting this change, at least for now.

Change-Id: Iff02ec60e02c85593dafdb3f9c5f99cf6cfac2ab
2018-03-15 12:37:31 -07:00
Becky Siegel
7295918697 Update 'show more' diff section colors
Bug: Issue 6291
Change-Id: I44aa99172e6f69488ab23ea96cc20028a444b1d7
2018-03-12 08:49:04 -07:00
Becky Siegel
368641eb4f Replace gr-fixed-panel with position:sticky
Also fixes the positioning of the footer.

Bug: Issue 7200
Change-Id: I482582a7f174b51ccfd179943ebac231f08ce03e
2018-03-08 10:43:39 -08:00
Wyatt Allen
8b45290ed2 Report proportion of due_to_rebase chunks in loaded diffs
Change-Id: If48e4194352456d25e99e9f4d9df331226a3af4a
2018-02-14 13:06:32 -08: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
d450a9eb57 Respect default font size preference from browsers
We encountered an issue where PolyGerrit was not respecting browser
font preferences. Browser font preferences include both a default font
size and a minimum font size.

In the event that a font declared in px is smaller than the minimum font
size, the size is increased to equal the minimum font size. However,
if the font is declared in px and greater than the minimum, the
preferred font size is not taken into account.

Browsers' default font size is 16px [1], So instead of declaring the
base font in px (previously 13px), this change makes it a percentage
of the default font size. If the user has changed their default, this
is taken into account.

From this point, all other fonts will be declared in rems, which makes
it easier to base the new size off of the base font size of the <html>
tag, rather than ems which bases it on the container[2]. This allows us
to declare font sizes in a way more similar to pixels, yet relative.

A follow-up change will change all font size declaration to use rem from
em for consistency.

[1] https://stackoverflow.com/questions/29511983/is-the-default-font-size-of-every-browser-16px-why
[2] https://webdesign.tutsplus.com/tutorials/comprehensive-guide-when-to-use-em-vs-rem--cms-23984

Bug: Issue 8157
Change-Id: I04ec2c861b2fb288ec7556dfb655d7feea9c9157
2018-01-27 00:29:32 +00:00
Luís Oliveira
40eb3f47cc Avoid spurious newlines in diffs with CRLF line endings
Commit d5d9a13ec8fa62f0c36df7b75a2231663056668f fixed Issue 5091 by
adding a newline to the end of each diff line. In files with CRLF line
endings, this causes spurious newlines as described in Issue 7164.

This tweaks the aforementioned fix to specifically target empty lines
thereby still ensuring that (empty) diff lines don't collapse to 0px
height while avoiding inserting spurious newlines elsewhere.

Bug: Issue 7164
Change-Id: Iafbbf004cfb588fc123988674bbce8dfabf4d2b8
2018-01-24 11:22:30 +00: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
Viktar Donich
a28dee069f Weblinks API for embedded scenario using Gerrit.Nav interface
Gerrit.Nav.setup() now takes a weblinks generator function as a third
parameter. Here's the function signature:

``` js
Gerrit.Nav.setup(navigate, generateUrl, generateWeblinks)
```

Weblinks generator function takes single payload parameter with
`type` property that determines which part of the UI is the consumer of
the weblinks. `type` property can be one of `file`, `change`, or
`patchset`.

For `file` type, payload will also contain string properties:
`repo`, `commit`, `file`.

For `pachset` type, payload will also contain string properties:
`repo`, `commit`.

For `change` type, payload will also contain string properties:
`repo`, `commit`.

If server provides weblinks, those will be passed as `options.weblinks`
property on the main payload object.

Change-Id: I0d9de3a295435304e2b6aad551112440075cf098
2017-12-08 20:20:10 -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
Becky Siegel
7fc7762ca0 Remove double line, padding, and drop shadow from inline diff view
Bug: Issue 7859
Change-Id: I56bae94e11e57dd4126518f29d5b2d08777f8a8e
2017-11-28 15:49:20 -08: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
Becky Siegel
6ca31cac3a Revert "Weblinks API for embedded scenario"
This reverts commit 253d1faa9ef7ac18116ba7493e4ae2e76df34388.

Reason for revert: breaks diff views

Change-Id: Iaeadcdca1156e4f7a3bb2a118a766a24f808348c
2017-11-22 01:15:23 +00:00
Viktar Donich
253d1faa9e Weblinks API for embedded scenario
In embedded scenario, Gerrit.Weblinks.setup may be called to set a
weblinks generator function.

Weblinks generator function takes single payload parameter with
`type` property that determines which part of the UI is the consumer of
the weblinks. `type` property can be one of `file`, `change`, or
`patchset`.

For `file` type, payload will also contain string properties:
`repo`, `commit`, `file`.

For `pachset` type, payload will also contain string properties:
`repo`, `commit`.

For `change` type, payload will also contain string properties:
`repo`, `commit`.

If server provides weblinks, those will be passed as `options.weblinks`
property on the main payload object.

Change-Id: Ie0f9edf959365869aa6eac6413d1efe29b61c9cb
2017-11-17 11:52:19 -08:00
Wyatt Allen
0309756d48 Fix column width styles for blame when fit-to-screen is enabled
Change-Id: I073658de061f1512b16e08b4540f23b864698a60
2017-09-30 14:54:01 +01: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
Kasper Nilsson
380bf8ba6b Disable diff comments on edit patchsets
Includes a minor refactor of gr-diff comment construction logic.

Bug: Issue 4437
Change-Id: I0428fead7a9d1f1dc5d6aa9efc3d81ecbe6b5c64
2017-08-09 21:17:31 +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
Wyatt Allen
dc8782d762 Centralized comment requests
Formerly, gr-diff would make its own REST calls for diff comments in the
patch range and path being viewed. However, these calls by the diff view
were redundant to the more general comment requests made by either
gr-diff-view (which requests all comments to support skipping to the
next file with comments) or gr-change-view (which requests comments
individually for each inline diff).

With this change, the diff component no longer loads comments for
itself, but is rather provided the comments from its host view via a
public property. In this way the host view can load the more-general
comment data, and filter it down for the diff view's params.

Introduces the gr-comment-api component to simplify loading and
filtering diff comments for use by diff views. By using this new
component:
* The diff view makes only one request for comments (including drafts
  and robot comments) to support skipping to the next comment and
  displaying comments in the diff view.
* The change view makes only one request for comments for all inline
  diffs.

Bug: Issue 5299
Change-Id: Ia14a01619f1f9881aa0d253fd3f49af9a17f3dce
2017-08-01 14:15:38 -07:00
Wyatt Allen
f07c69ce99 Merge "Revert "Remove styles for dueToRebase chunks"" 2017-07-20 18:08:49 +00:00
Alice Kober-Sotzek
4cb04e13cd Revert "Remove styles for dueToRebase chunks"
This reverts commit e048852365d1c7fc92bea2f597f117c13140f9a0.

Reason for revert: Highlighting which hunks were introduced by a rebase
is done as best-effort and will be clearly stated as such when we
announce this feature. Hence, we expect at least some false-negatives
at the moment (which we intend to get rid off over time). There aren't
any false-positives which we know of at the moment.

Change-Id: I103dbe8bea98d0bb7a417c02d371c2864dca015d
2017-07-20 16:32:58 +00:00
Becky Siegel
08ca826bce Fix the target row highlight on Firefox
Previiously, when pressing j/k on a change view and a horizontal line
appeared, in firefox, the rows jumped around a bit, as the bottom
border added an additional pixel of height.

Instead, this change uses a box shadow to simulate a bottom border.
The box shadow approach did not work on the table row, but instead had
to be applied to the table cell itself (in the target row)

Bug: Issue 6079
Change-Id: I7b80ef119f5ef0c8ad6cad51858edf2ac9c325da
2017-06-29 17:14:38 +00:00
Wyatt Allen
e048852365 Remove styles for dueToRebase chunks
While the due_to_rebase signal gives false-positives and false-negatives
(Issue 6583) do not style the marked chunks differently.

Change-Id: Ic716dcf259c4f4f0ef09510e37ce744c1d4082e0
2017-06-27 09:32:34 -07:00
Wyatt Allen
6df3f492b9 Confirmation for rendering large diffs with whole file
If the user views a very large diff while "Whole file" is enabled in
their preferences, rendering may lock up their browser. With this
change, instead of rendering, users are warned and allowed to bypass the
warning (risking browser lock up) or render with a context that is less
than whole file.

Bug: Issue 6402
Change-Id: I6e97c06598fb5f6900c925127ab6a99693b8aa7f
2017-06-15 12:02:35 -07:00
Wyatt Allen
380ad8210b Remove GPU acceleration hinting for diff scroll
Bug: Issue 6378
Change-Id: I5550bd6a0bad95b0c113c3b75fafe2c25c038b0d
2017-06-13 09:12:24 -07:00
Alice Kober-Sotzek
d1a2e07e4f Merge changes from topic 'improve-diff-for-rebase'
* changes:
  Highlight hunks which are due to rebase on PolyGerrit
  Copy due_to_rebase to subgroups in gr-diff-processor
  Move diff tests from RevisionIT to RevisionDiffIT
  Mark hunks which are present due to a rebase when diffing patch sets
2017-06-12 13:20:22 +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
Becky Siegel
cb9afdc18b Fix line numbers in shadow-dom
Another border-box issue, this time with .lineNum:before.

Bug: Issue 6372
Change-Id: Ic6521090775f2a990b4fa7b7f36c5989151ce2ac
2017-06-09 00:12:43 +00:00