Revert "Add token highlighting to gr-diff"
This reverts commit 6f3f4faa2a294a745da6e06480405c7f10f8aeac.
Reason for revert: This broke highlighting in unified diffs.
Change-Id: If2d02a7c39fdaa0cffd0aab3dab2917b75842879
diff --git a/polygerrit-ui/app/api/diff.ts b/polygerrit-ui/app/api/diff.ts
index a177a24..6797994 100644
--- a/polygerrit-ui/app/api/diff.ts
+++ b/polygerrit-ui/app/api/diff.ts
@@ -284,7 +284,6 @@
annotate(
textElement: HTMLElement,
lineNumberElement: HTMLElement,
- line: GrDiffLine,
- side: Side
+ line: GrDiffLine
): void;
}
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-element.ts b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-element.ts
index 96ef51a..e9eb8cd 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-element.ts
+++ b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-element.ts
@@ -46,9 +46,8 @@
import {GrDiffLine, LineNumber} from '../gr-diff/gr-diff-line';
import {GrDiffGroup} from '../gr-diff/gr-diff-group';
import {PolymerSpliceChange} from '@polymer/polymer/interfaces';
-import {getLineNumber, getSideByLineEl} from '../gr-diff/gr-diff-utils';
+import {getLineNumber} from '../gr-diff/gr-diff-utils';
import {fireAlert, fireEvent} from '../../../utils/event-util';
-import {TokenHighlightLayer} from './token-highlight-layer';
const TRAILING_WHITESPACE_PATTERN = /\s+$/;
@@ -246,7 +245,6 @@
this.$.rangeLayer,
this.$.coverageLayerLeft,
this.$.coverageLayerRight,
- new TokenHighlightLayer(),
];
if (this.layers) {
@@ -255,6 +253,26 @@
this._layers = layers;
}
+ getLineElByChild(node?: Node): HTMLElement | null {
+ while (node) {
+ if (node instanceof Element) {
+ if (node.classList.contains('lineNum')) {
+ return node as HTMLElement;
+ }
+ if (node.classList.contains('section')) {
+ return null;
+ }
+ }
+ node = node.previousSibling ?? node.parentElement ?? undefined;
+ }
+ return null;
+ }
+
+ getLineNumberByChild(node: Node) {
+ const lineEl = this.getLineElByChild(node);
+ return getLineNumber(lineEl);
+ }
+
getContentTdByLine(lineNumber: LineNumber, side?: Side, root?: Element) {
if (!this._builder) return null;
return this._builder.getContentTdByLine(lineNumber, side, root);
@@ -271,7 +289,7 @@
if (!lineEl) return null;
const line = getLineNumber(lineEl);
if (!line) return null;
- const side = getSideByLineEl(lineEl);
+ const side = this.getSideByLineEl(lineEl);
// Performance optimization because we already have an element in the
// correct row
const row = this._getDiffRowByChild(lineEl);
@@ -285,6 +303,10 @@
);
}
+ getSideByLineEl(lineEl: Element) {
+ return lineEl.classList.contains(Side.RIGHT) ? Side.RIGHT : Side.LEFT;
+ }
+
emitGroup(group: GrDiffGroup, sectionEl: HTMLElement) {
if (!this._builder) return;
this._builder.emitGroup(group, sectionEl);
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.ts b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.ts
index 2ab35c0..24a7d78 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.ts
+++ b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.ts
@@ -611,14 +611,14 @@
contentText.setAttribute('data-side', side);
}
- if (lineNumberEl && side) {
+ if (lineNumberEl) {
for (const layer of this.layers) {
if (typeof layer.annotate === 'function') {
- layer.annotate(contentText, lineNumberEl, line, side);
+ layer.annotate(contentText, lineNumberEl, line);
}
}
} else {
- console.error('lineNumberEl or side not set, skipping layer.annotate');
+ console.error('The lineNumberEl is null, skipping layer annotations.');
}
td.appendChild(contentText);
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-builder/token-highlight-layer.ts b/polygerrit-ui/app/elements/diff/gr-diff-builder/token-highlight-layer.ts
deleted file mode 100644
index d0b3d3c..0000000
--- a/polygerrit-ui/app/elements/diff/gr-diff-builder/token-highlight-layer.ts
+++ /dev/null
@@ -1,259 +0,0 @@
-/**
- * @license
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import {DiffLayer, DiffLayerListener} from '../../../types/types';
-import {GrDiffLine, Side} from '../../../api/diff';
-import {GrAnnotation} from '../gr-diff-highlight/gr-annotation';
-import {debounce, DelayedTask} from '../../../utils/async-util';
-import {
- getLineNumberByChild,
- lineNumberToNumber,
-} from '../gr-diff/gr-diff-utils';
-import {appContext} from '../../../services/app-context';
-import {KnownExperimentId} from '../../../services/flags/flags';
-
-const tokenMatcher = new RegExp(/[a-zA-Z0-9_-]+/g);
-
-/** CSS class for all tokens. */
-const CSS_TOKEN = 'token';
-
-/** CSS class for the currently hovered token. */
-const CSS_HIGHLIGHT = 'token-highlight';
-
-const UPDATE_TOKEN_TASK_DELAY_MS = 50;
-
-const LINE_LENGTH_LIMIT = 500;
-
-const TOKEN_LENGTH_LIMIT = 100;
-
-const TOKEN_COUNT_LIMIT = 10000;
-
-const TOKEN_OCCURRENCES_LIMIT = 1000;
-
-/**
- * Token highlighting is only useful for code on-screen, so don't bother
- * highlighting tokens that are further away than this threshold from where the
- * user is hovering.
- */
-const LINE_DISTANCE_THRESHOLD = 100;
-
-/**
- * When a user hovers over a token in the diff, then this layer makes sure that
- * all occurrences of this token are annotated with the 'token-highlight' css
- * class. And removes that class when the user moves the mouse away from the
- * token.
- *
- * The layer does not react to mouse events directly by adding a css class to
- * the appropriate elements, but instead it just sets the currently highlighted
- * token and notifies the diff renderer that certain lines must be re-rendered.
- * And when that re-rendering happens the appropriate css class is added.
- */
-export class TokenHighlightLayer implements DiffLayer {
- /** The only listener is typically the renderer of gr-diff. */
- private listeners: DiffLayerListener[] = [];
-
- /** The currently highlighted token. */
- private currentHighlight?: string;
-
- /**
- * The line of the currently highlighted token. We store this in order to
- * re-render only relevant lines of the diff. Only lines visible on the screen
- * need a highlight. For example in a file with 10,000 lines it is sufficient
- * to just re-render the ~100 lines that are visible to the user.
- *
- * It is a known issue that we are only storing the line number on the side of
- * where the user is hovering and we use that also to determine which line
- * numbers to re-render on the other side, but it is non-trivial to look up or
- * store a reliable mapping of line numbers, so we just accept this
- * shortcoming with the reasoning that the user is mostly interested in the
- * tokens on the side where they are hovering anyway.
- *
- * Another known issue is that we are not able to see past collapsed lines
- * with the current implementation.
- */
- private currentHighlightLineNumber = 0;
-
- /**
- * Keeps track of where tokens occur in a file during rendering, so that it is
- * easy to look up when processing mouse events.
- */
- private tokenToLinesLeft = new Map<string, Set<number>>();
-
- private tokenToLinesRight = new Map<string, Set<number>>();
-
- private updateTokenTask?: DelayedTask;
-
- private readonly enabled = appContext.flagsService.isEnabled(
- KnownExperimentId.TOKEN_HIGHLIGHTING
- );
-
- annotate(
- el: HTMLElement,
- _: HTMLElement,
- line: GrDiffLine,
- side: Side
- ): void {
- if (!this.enabled) return;
- const text = el.textContent;
- if (!text) return;
- // Binary files encoded as text for example can have super long lines
- // with super long tokens. Let's guard against against this scenario.
- if (text.length > LINE_LENGTH_LIMIT) return;
- let match;
- let atLeastOneTokenMatched = false;
- while ((match = tokenMatcher.exec(text))) {
- const token = match[0];
- const index = match.index;
- const length = token.length;
- // Binary files encoded as text for example can have super long lines
- // with super long tokens. Let's guard against this scenario.
- if (length > TOKEN_LENGTH_LIMIT) continue;
- atLeastOneTokenMatched = true;
- const css = token === this.currentHighlight ? CSS_HIGHLIGHT : CSS_TOKEN;
- // We add the tk-* class so that we can look up the token later easily
- // even if the token element was split up into multiple smaller nodes.
- GrAnnotation.annotateElement(el, index, length, `tk-${token} ${css}`);
- // We could try to detect whether we are re-rendering instead of initially
- // rendering the line. Then we would not have to call storeLineForToken()
- // again. But since the Set swallows the duplicates we don't care.
- this.storeLineForToken(token, line, side);
- }
- if (atLeastOneTokenMatched) {
- // These listeners do not have to be cleaned, because listeners are
- // garbage collected along with the element itself once it is not attached
- // to the DOM anymore and no references exist anymore.
- el.addEventListener('mouseover', this.handleMouseOver);
- el.addEventListener('mouseout', this.handleMouseOut);
- }
- }
-
- private storeLineForToken(token: string, line: GrDiffLine, side: Side) {
- const tokenToLines =
- side === Side.LEFT ? this.tokenToLinesLeft : this.tokenToLinesRight;
- // Just to make sure that we don't break down on large files.
- if (tokenToLines.size > TOKEN_COUNT_LIMIT) return;
- let numbers = tokenToLines.get(token);
- if (!numbers) {
- numbers = new Set<number>();
- tokenToLines.set(token, numbers);
- }
- // Just to make sure that we don't break down on large files.
- if (numbers.size > TOKEN_OCCURRENCES_LIMIT) return;
- const lineNumber =
- side === Side.LEFT ? line.beforeNumber : line.afterNumber;
- numbers.add(Number(lineNumber));
- }
-
- private readonly handleMouseOut = (e: MouseEvent) => {
- if (!this.currentHighlight) return;
- if (this.interferesWithSelection(e)) return;
- const el = this.findTokenAncestor(e?.target);
- if (!el) return;
- this.updateTokenHighlight(undefined, undefined);
- };
-
- private readonly handleMouseOver = (e: MouseEvent) => {
- if (this.interferesWithSelection(e)) return;
- const {line, token} = this.findTokenAncestor(e?.target);
- if (!token) return;
- const oldHighlight = this.currentHighlight;
- const newHighlight = token;
- if (!newHighlight || newHighlight === oldHighlight) return;
- if (this.countOccurrences(newHighlight) <= 1) return;
- this.updateTokenHighlight(line, newHighlight);
- };
-
- private interferesWithSelection(e: MouseEvent) {
- if (e.buttons > 0) return true;
- if (window.getSelection()?.type === 'Range') return true;
- return false;
- }
-
- private updateTokenHighlight(
- newLineNumber: number | undefined,
- newHighlight: string | undefined
- ) {
- this.updateTokenTask = debounce(
- this.updateTokenTask,
- () => {
- const oldHighlight = this.currentHighlight;
- const oldLineNumber = this.currentHighlightLineNumber;
- this.currentHighlight = newHighlight;
- this.currentHighlightLineNumber = newLineNumber ?? 0;
- this.notifyForToken(oldHighlight, oldLineNumber);
- this.notifyForToken(newHighlight, newLineNumber ?? 0);
- },
- UPDATE_TOKEN_TASK_DELAY_MS
- );
- }
-
- findTokenAncestor(
- el?: EventTarget | Element | null
- ): {
- token?: string;
- line: number;
- } {
- if (!(el instanceof Element)) return {line: 0, token: undefined};
- if (
- el.classList.contains(CSS_TOKEN) ||
- el.classList.contains(CSS_HIGHLIGHT)
- ) {
- const tkClass = [...el.classList].find(c => c.startsWith('tk-'));
- const line = lineNumberToNumber(getLineNumberByChild(el));
- if (!line || !tkClass) return {line: 0, token: undefined};
- return {line, token: tkClass.substring(3)};
- }
- if (el.tagName === 'TD') return {line: 0, token: undefined};
- return this.findTokenAncestor(el.parentElement);
- }
-
- countOccurrences(token: string | undefined) {
- if (!token) return 0;
- const linesLeft = this.tokenToLinesLeft.get(token);
- const linesRight = this.tokenToLinesRight.get(token);
- return (linesLeft?.size ?? 0) + (linesRight?.size ?? 0);
- }
-
- notifyForToken(token: string | undefined, lineNumber: number) {
- if (!token) return;
- const linesLeft = this.tokenToLinesLeft.get(token);
- linesLeft?.forEach(line => {
- if (Math.abs(line - lineNumber) < LINE_DISTANCE_THRESHOLD) {
- this.notifyListeners(line, Side.LEFT);
- }
- });
- const linesRight = this.tokenToLinesRight.get(token);
- linesRight?.forEach(line => {
- if (Math.abs(line - lineNumber) < LINE_DISTANCE_THRESHOLD) {
- this.notifyListeners(line, Side.RIGHT);
- }
- });
- }
-
- addListener(listener: DiffLayerListener) {
- this.listeners.push(listener);
- }
-
- removeListener(listener: DiffLayerListener) {
- this.listeners = this.listeners.filter(f => f !== listener);
- }
-
- notifyListeners(line: number, side: Side) {
- for (const listener of this.listeners) {
- listener(line, line, side);
- }
- }
-}
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-diff-highlight.ts b/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-diff-highlight.ts
index ca003f3..76e02f0 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-diff-highlight.ts
+++ b/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-diff-highlight.ts
@@ -28,13 +28,7 @@
import {GrSelectionActionBox} from '../gr-selection-action-box/gr-selection-action-box';
import {GrDiffBuilderElement} from '../gr-diff-builder/gr-diff-builder-element';
import {FILE} from '../gr-diff/gr-diff-line';
-import {
- getLineElByChild,
- getLineNumberByChild,
- getRange,
- getSide,
- getSideByLineEl,
-} from '../gr-diff/gr-diff-utils';
+import {getRange, getSide} from '../gr-diff/gr-diff-utils';
import {debounce, DelayedTask} from '../../../utils/async-util';
interface SidedRange {
@@ -362,11 +356,11 @@
): NormalizedPosition | null {
let column;
if (!node || !this.contains(node)) return null;
- const lineEl = getLineElByChild(node);
+ const lineEl = this.diffBuilder.getLineElByChild(node);
if (!lineEl) return null;
- const side = getSideByLineEl(lineEl);
+ const side = this.diffBuilder.getSideByLineEl(lineEl);
if (!side) return null;
- const line = getLineNumberByChild(lineEl);
+ const line = this.diffBuilder.getLineNumberByChild(lineEl);
if (!line || line === FILE || line === 'LOST') return null;
const contentTd = this.diffBuilder.getContentTdByLineEl(lineEl);
if (!contentTd) return null;
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-diff-highlight_test.js b/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-diff-highlight_test.js
index 18fbe9a..07e83a8 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-diff-highlight_test.js
+++ b/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-diff-highlight_test.js
@@ -438,7 +438,7 @@
const contentText = stubContent(140, 'left');
const contentTd = contentText.parentElement;
- emulateSelection(contentTd.parentElement, 0,
+ emulateSelection(contentTd.previousElementSibling, 0,
contentText.firstChild, 2);
assert.isFalse(!!element.selectedRange);
});
@@ -584,6 +584,21 @@
});
assert.equal(side, 'right');
});
+
+ test('_fixTripleClickSelection empty line', () => {
+ const startContent = stubContent(146, 'right');
+ const endContent = stubContent(165, 'left');
+ emulateSelection(startContent.firstChild, 0,
+ endContent.parentElement.previousElementSibling, 0);
+ const {range, side} = element.selectedRange;
+ assert.deepEqual(range, {
+ start_line: 146,
+ start_character: 0,
+ end_line: 146,
+ end_character: 84,
+ });
+ assert.equal(side, 'right');
+ });
});
});
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection.ts b/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection.ts
index b64f61d..3df2e18 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection.ts
+++ b/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection.ts
@@ -28,12 +28,7 @@
import {DiffInfo} from '../../../types/diff';
import {Side} from '../../../constants/constants';
import {GrDiffBuilderElement} from '../gr-diff-builder/gr-diff-builder-element';
-import {
- getLineElByChild,
- getSide,
- getSideByLineEl,
- isThreadEl,
-} from '../gr-diff/gr-diff-utils';
+import {getSide, isThreadEl} from '../gr-diff/gr-diff-utils';
/**
* Possible CSS classes indicating the state of selection. Dynamically added/
@@ -115,7 +110,7 @@
// Handle the down event on comment thread in Polymer 2
const handled = this._handleDownOnRangeComment(target);
if (handled) return;
- const lineEl = getLineElByChild(target);
+ const lineEl = this.diffBuilder.getLineElByChild(target);
const blameSelected = this._elementDescendedFromClass(target, 'blame');
if (!lineEl && !blameSelected) {
return;
@@ -130,7 +125,7 @@
target,
'gr-comment'
);
- const side = getSideByLineEl(lineEl);
+ const side = this.diffBuilder.getSideByLineEl(lineEl);
targetClasses.push(
side === 'left' ? SelectionClass.LEFT : SelectionClass.RIGHT
@@ -184,9 +179,9 @@
if (this.classList.contains(SelectionClass.COMMENT)) {
commentSelected = true;
}
- const lineEl = getLineElByChild(target);
+ const lineEl = this.diffBuilder.getLineElByChild(target);
if (!lineEl) return;
- const side = getSideByLineEl(lineEl);
+ const side = this.diffBuilder.getSideByLineEl(lineEl);
const text = this._getSelectedText(side, commentSelected);
if (text && e.clipboardData) {
e.clipboardData.setData('Text', text);
@@ -229,9 +224,9 @@
return this._getCommentLines(sel, side);
}
const range = normalize(sel.getRangeAt(0));
- const startLineEl = getLineElByChild(range.startContainer);
+ const startLineEl = this.diffBuilder.getLineElByChild(range.startContainer);
if (!startLineEl) return;
- const endLineEl = getLineElByChild(range.endContainer);
+ const endLineEl = this.diffBuilder.getLineElByChild(range.endContainer);
// Happens when triple click in side-by-side mode with other side empty.
const endsAtOtherEmptySide =
!endLineEl &&
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection_test.js b/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection_test.js
index 8d7264c..5c9fe3f 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection_test.js
+++ b/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection_test.js
@@ -143,8 +143,8 @@
test('applies selected-left on left side click', () => {
element.classList.add('selected-right');
- const lineNumberEl = element.querySelector('.lineNum.left');
- MockInteractions.down(lineNumberEl);
+ element._cachedDiffBuilder.getSideByLineEl.returns('left');
+ MockInteractions.down(element);
assert.isTrue(
element.classList.contains('selected-left'), 'adds selected-left');
assert.isFalse(
@@ -154,8 +154,8 @@
test('applies selected-right on right side click', () => {
element.classList.add('selected-left');
- const lineNumberEl = element.querySelector('.lineNum.right');
- MockInteractions.down(lineNumberEl);
+ element._cachedDiffBuilder.getSideByLineEl.returns('right');
+ MockInteractions.down(element);
assert.isTrue(
element.classList.contains('selected-right'), 'adds selected-right');
assert.isFalse(
diff --git a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff-utils.ts b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff-utils.ts
index 96fbd8d..0ca929a 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff-utils.ts
+++ b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff-utils.ts
@@ -43,36 +43,6 @@
return range.end_line - range.start_line > 10;
}
-export function getLineNumberByChild(node?: Node) {
- return getLineNumber(getLineElByChild(node));
-}
-
-export function lineNumberToNumber(lineNumber?: LineNumber | null): number {
- if (!lineNumber) return 0;
- if (lineNumber === 'LOST') return 0;
- if (lineNumber === 'FILE') return 0;
- return lineNumber;
-}
-
-export function getLineElByChild(node?: Node): HTMLElement | null {
- while (node) {
- if (node instanceof Element) {
- if (node.classList.contains('lineNum')) {
- return node as HTMLElement;
- }
- if (node.classList.contains('section')) {
- return null;
- }
- }
- node = node.previousSibling ?? node.parentElement ?? undefined;
- }
- return null;
-}
-
-export function getSideByLineEl(lineEl: Element) {
- return lineEl.classList.contains(Side.RIGHT) ? Side.RIGHT : Side.LEFT;
-}
-
export function getLineNumber(lineEl?: Element | null): LineNumber | null {
if (!lineEl) return null;
const lineNumberStr = lineEl.getAttribute('data-value');
diff --git a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.ts b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.ts
index 39fb554..beaec75 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.ts
+++ b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.ts
@@ -29,7 +29,6 @@
import {LineNumber} from './gr-diff-line';
import {
getLine,
- getLineElByChild,
getLineNumber,
getRange,
getSide,
@@ -544,7 +543,7 @@
el.classList.contains('content') ||
el.classList.contains('contentText')
) {
- const target = getLineElByChild(el);
+ const target = this.$.diffBuilder.getLineElByChild(el);
if (target) {
this._selectLine(target);
}
diff --git a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_html.ts b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_html.ts
index cccee0e..697c7b3 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_html.ts
+++ b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_html.ts
@@ -566,10 +566,6 @@
border: 1px solid var(--diff-context-control-border-color);
text-align: center;
}
-
- .token-highlight {
- background-color: var(--token-highlighting-color, #fffd54);
- }
</style>
<style include="gr-syntax-theme">
/* Workaround for empty style block - see https://github.com/Polymer/tools/issues/408 */
diff --git a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.js b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.js
index 48e009b..488dd75 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.js
+++ b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.js
@@ -472,12 +472,10 @@
test('_handleTap content', done => {
const content = document.createElement('div');
const lineEl = document.createElement('div');
- lineEl.className = 'lineNum';
- const row = document.createElement('div');
- row.appendChild(lineEl);
- row.appendChild(content);
const selectStub = sinon.stub(element, '_selectLine');
+ sinon.stub(element.$.diffBuilder, 'getLineElByChild')
+ .callsFake(() => lineEl);
content.className = 'content';
content.addEventListener('click', e => {
diff --git a/polygerrit-ui/app/services/flags/flags.ts b/polygerrit-ui/app/services/flags/flags.ts
index 6f94b8d..ff950b8 100644
--- a/polygerrit-ui/app/services/flags/flags.ts
+++ b/polygerrit-ui/app/services/flags/flags.ts
@@ -31,5 +31,4 @@
NEW_CHANGE_SUMMARY_UI = 'UiFeature__new_change_summary_ui',
NEW_IMAGE_DIFF_UI = 'UiFeature__new_image_diff_ui',
COMMENT_CONTEXT = 'UiFeature__comment_context',
- TOKEN_HIGHLIGHTING = 'UiFeature__token_highlighting',
}
diff --git a/polygerrit-ui/app/styles/themes/app-theme.ts b/polygerrit-ui/app/styles/themes/app-theme.ts
index 42c54ce..8fe3b24 100644
--- a/polygerrit-ui/app/styles/themes/app-theme.ts
+++ b/polygerrit-ui/app/styles/themes/app-theme.ts
@@ -331,7 +331,6 @@
--coverage-covered: #e0f2f1;
--coverage-not-covered: #ffd1a4;
--ranged-comment-hint-text-color: var(--orange-900);
- --token-highlighting-color: #fffd54;
/* syntax colors */
--syntax-attr-color: #219;
diff --git a/polygerrit-ui/app/styles/themes/dark-theme.ts b/polygerrit-ui/app/styles/themes/dark-theme.ts
index ce5f27e..0029cea 100644
--- a/polygerrit-ui/app/styles/themes/dark-theme.ts
+++ b/polygerrit-ui/app/styles/themes/dark-theme.ts
@@ -193,7 +193,6 @@
--coverage-covered: #112826;
--coverage-not-covered: #6b3600;
--ranged-comment-hint-text-color: var(--blue-50);
- --token-highlighting-color: var(--yellow-tonal);
/* syntax colors */
--syntax-attr-color: #80cbbf;