Merge "Fix mention chip"
diff --git a/polygerrit-ui/app/api/diff.ts b/polygerrit-ui/app/api/diff.ts
index aa7aa30..24110ed 100644
--- a/polygerrit-ui/app/api/diff.ts
+++ b/polygerrit-ui/app/api/diff.ts
@@ -401,10 +401,6 @@
value: boolean;
source: 'controls' | 'magnifier';
}
- | {
- type: 'ignore-option-changed';
- ignoreOption: resemble.ComparisonIgnoreOption;
- }
| {type: 'zoom-level-changed'; scale: number | 'fit'}
| {type: 'follow-mouse-changed'; value: boolean}
| {type: 'background-color-changed'; value: string}
diff --git a/polygerrit-ui/app/embed/diff/gr-diff-image-viewer/gr-image-viewer.ts b/polygerrit-ui/app/embed/diff/gr-diff-image-viewer/gr-image-viewer.ts
index 44cef43..e0febdc 100644
--- a/polygerrit-ui/app/embed/diff/gr-diff-image-viewer/gr-image-viewer.ts
+++ b/polygerrit-ui/app/embed/diff/gr-diff-image-viewer/gr-image-viewer.ts
@@ -35,15 +35,6 @@
const AUTOMATIC_BLINK_BUTTON_ACTIVE_AREA_PIXELS = 350;
-const IGNORE_OPTION_DESCRIPTIONS = {
- // resemble.ComparisonIgnoreOption: string
- nothing: 'All differences',
- less: 'Only substantial differences',
- colors: 'Ignore colors changes',
- alpha: 'Ignore alpha channel changes',
- antialiasing: 'Ignore anti-aliasing changes',
-};
-
/**
* This components allows the user to rapidly switch between two given images
* rendered in the same location, to make subtle differences more noticeable.
@@ -63,9 +54,6 @@
*/
@property({type: Boolean}) automaticBlink = false;
- @property({type: String})
- ignoreOption: resemble.ComparisonIgnoreOption = 'less';
-
@state() protected baseSelected = false;
@state() protected scaledSelected = true;
@@ -312,12 +300,6 @@
#highlight-changes {
margin: var(--spacing-m) var(--spacing-xl);
}
- #ignore-option-intro {
- margin: 0 var(--spacing-xl);
- }
- .ignoreOption {
- margin: 0 var(--spacing-xxl);
- }
gr-overview-image {
min-width: 200px;
min-height: 150px;
@@ -509,31 +491,6 @@
`
: '';
- let ignoreOptionRadioGroup;
- if (this.diffHighlightSrc && this.showHighlight) {
- for (const [ignoreOption, description] of Object.entries(
- IGNORE_OPTION_DESCRIPTIONS
- ) as [resemble.ComparisonIgnoreOption, String][]) {
- const id = `ignore-${String(ignoreOption)}`;
- ignoreOptionRadioGroup = html`
- ${ignoreOptionRadioGroup}
- <div id=${id} class="ignoreOption">
- <input
- id="${id}-input"
- type="radio"
- name="ignoreOption"
- ?checked=${ignoreOption === this.ignoreOption}
- ?disabled=${!this.showHighlight}
- @click=${() => {
- this.selectIgnoreOption(ignoreOption);
- }}
- />
- <label id="${id}-label" for="${id}-input">${description}</label>
- </div>
- `;
- }
- }
-
const overviewImage = html`
<gr-overview-image
.frameRect=${this.overviewFrame}
@@ -681,8 +638,7 @@
</div>
<paper-card class="controls">
- ${versionSwitcher} ${highlightSwitcher} ${ignoreOptionRadioGroup}
- ${overviewImage} ${zoomControl}
+ ${versionSwitcher} ${highlightSwitcher} ${overviewImage} ${zoomControl}
${!this.scaledSelected ? followMouse : ''} ${backgroundPicker}
</paper-card>
`;
@@ -719,9 +675,7 @@
}
if (
this.canHighlightDiffs &&
- (changedProperties.has('baseUrl') ||
- changedProperties.has('revisionUrl') ||
- changedProperties.has('ignoreOption'))
+ (changedProperties.has('baseUrl') || changedProperties.has('revisionUrl'))
) {
this.computeDiffImage();
}
@@ -729,17 +683,17 @@
private computeDiffImage() {
if (!(this.baseUrl && this.revisionUrl)) return;
-
- window.resemble.compare(
- this.baseUrl,
- this.revisionUrl,
- {
- ignore: this.ignoreOption,
- },
- (_err, data) => {
- this.diffHighlightSrc = data.getImageDataUrl();
- }
- );
+ window
+ .resemble(this.baseUrl)
+ .compareTo(this.revisionUrl)
+ // By default Resemble.js applies some color / alpha tolerance as well as
+ // min / max brightness beyond which to ignore changes. Until we have
+ // controls to let the user affect these options, always highlight all
+ // changed pixels.
+ .ignoreNothing()
+ .onComplete(result => {
+ this.diffHighlightSrc = result.getImageDataUrl();
+ });
}
fireAction(detail: ImageDiffAction) {
@@ -813,14 +767,6 @@
});
}
- selectIgnoreOption(ignoreOption: resemble.ComparisonIgnoreOption) {
- this.ignoreOption = ignoreOption;
- this.fireAction({
- type: 'ignore-option-changed',
- ignoreOption: this.ignoreOption,
- });
- }
-
zoomControlChanged(event: ValueChangedEvent<string>) {
const scaleString = event.detail.value;
if (!scaleString) return;