diff --git a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-binary.js b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-binary.js index a9242be5eb..d2731a21eb 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-binary.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-binary.js @@ -20,9 +20,9 @@ // Prevent redefinition. if (window.GrDiffBuilderBinary) { return; } - function GrDiffBuilderBinary(diff, patchRange, commentThreadEls, prefs, + function GrDiffBuilderBinary(diff, commentThreadEls, prefs, outputEl) { - GrDiffBuilder.call(this, diff, patchRange, commentThreadEls, prefs, + GrDiffBuilder.call(this, diff, commentThreadEls, prefs, outputEl); } diff --git a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-image.js b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-image.js index c52a504466..f05f4f085d 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-image.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-image.js @@ -22,9 +22,9 @@ const IMAGE_MIME_PATTERN = /^image\/(bmp|gif|jpeg|jpg|png|tiff|webp)$/; - function GrDiffBuilderImage(diff, patchRange, commentThreadEls, prefs, + function GrDiffBuilderImage(diff, commentThreadEls, prefs, outputEl, baseImage, revisionImage) { - GrDiffBuilderSideBySide.call(this, diff, patchRange, commentThreadEls, + GrDiffBuilderSideBySide.call(this, diff, commentThreadEls, prefs, outputEl, []); this._baseImage = baseImage; this._revisionImage = revisionImage; diff --git a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-side-by-side.js b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-side-by-side.js index da085c239a..81cbabbedf 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-side-by-side.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-side-by-side.js @@ -20,9 +20,9 @@ // Prevent redefinition. if (window.GrDiffBuilderSideBySide) { return; } - function GrDiffBuilderSideBySide(diff, patchRange, commentThreadEls, + function GrDiffBuilderSideBySide(diff, commentThreadEls, prefs, outputEl, layers) { - GrDiffBuilder.call(this, diff, patchRange, commentThreadEls, prefs, + GrDiffBuilder.call(this, diff, commentThreadEls, prefs, outputEl, layers); } GrDiffBuilderSideBySide.prototype = Object.create(GrDiffBuilder.prototype); diff --git a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-unified.js b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-unified.js index 0657ee4565..2dcdee428c 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-unified.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-unified.js @@ -20,9 +20,9 @@ // Prevent redefinition. if (window.GrDiffBuilderUnified) { return; } - function GrDiffBuilderUnified(diff, patchRange, commentThreadEls, prefs, + function GrDiffBuilderUnified(diff, commentThreadEls, prefs, outputEl, layers) { - GrDiffBuilder.call(this, diff, patchRange, commentThreadEls, prefs, + GrDiffBuilder.call(this, diff, commentThreadEls, prefs, outputEl, layers); } GrDiffBuilderUnified.prototype = Object.create(GrDiffBuilder.prototype); diff --git a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.html b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.html index e77eb57e98..420a14fd88 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.html +++ b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.html @@ -169,8 +169,7 @@ limitations under the License. // Stop the processor and syntax layer (if they're running). this.cancel(); - this._builder = this._getDiffBuilder( - this.diff, comments.meta.patchRange, prefs); + this._builder = this._getDiffBuilder(this.diff, prefs); this.$.processor.context = prefs.context; this.$.processor.keyLocations = this._getKeyLocations(comments, @@ -294,7 +293,7 @@ limitations under the License. throw Error(`Invalid preference value: ${pref}`); }, - _getDiffBuilder(diff, patchRange, prefs) { + _getDiffBuilder(diff, prefs) { if (isNaN(prefs.tab_size) || prefs.tab_size <= 0) { this._handlePreferenceError('tab size'); return; @@ -307,19 +306,19 @@ limitations under the License. let builder = null; if (this.isImageDiff) { - builder = new GrDiffBuilderImage(diff, patchRange, + builder = new GrDiffBuilderImage(diff, this._commentThreadElements, prefs, this.diffElement, this.baseImage, this.revisionImage); } else if (diff.binary) { // If the diff is binary, but not an image. - return new GrDiffBuilderBinary(diff, patchRange, + return new GrDiffBuilderBinary(diff, this._commentThreadElements, prefs, this.diffElement); } else if (this.viewMode === DiffViewMode.SIDE_BY_SIDE) { - builder = new GrDiffBuilderSideBySide(diff, patchRange, + builder = new GrDiffBuilderSideBySide(diff, this._commentThreadElements, prefs, this.diffElement, this._layers); } else if (this.viewMode === DiffViewMode.UNIFIED) { - builder = new GrDiffBuilderUnified(diff, patchRange, + builder = new GrDiffBuilderUnified(diff, this._commentThreadElements, prefs, this.diffElement, this._layers); } diff --git a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.js b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.js index 6ea48ac182..d428f683c4 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.js @@ -96,10 +96,9 @@ */ const REGEX_TAB_OR_SURROGATE_PAIR = /\t|[\uD800-\uDBFF][\uDC00-\uDFFF]/; - function GrDiffBuilder(diff, patchRange, commentThreadEls, prefs, + function GrDiffBuilder(diff, commentThreadEls, prefs, outputEl, layers) { this._diff = diff; - this._patchRange = patchRange; this._prefs = prefs; this._outputEl = outputEl; this.groups = []; diff --git a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder_test.html b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder_test.html index c277f3499d..fd74d55861 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder_test.html +++ b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder_test.html @@ -75,8 +75,7 @@ limitations under the License. show_tabs: true, tab_size: 4, }; - builder = new GrDiffBuilder( - {content: []}, {left: [], right: []}, [], prefs); + builder = new GrDiffBuilder({content: []}, [], prefs); }); teardown(() => { sandbox.restore(); }); @@ -329,9 +328,7 @@ limitations under the License. r5.setAttribute('comment-side', 'right'); r5.setAttribute('line-num', 5); - builder = new GrDiffBuilder( - {content: []}, {basePatchNum: 'PARENT', patchNum: '3'}, [l3, l5, r5], - prefs); + builder = new GrDiffBuilder({content: []}, [l3, l5, r5], prefs); function checkThreadGroupProps(threadGroupEl, expectedThreadEls) { @@ -357,8 +354,6 @@ limitations under the License. builder._commentThreadGroupForLine(line, GrDiffBuilder.Side.LEFT); checkThreadGroupProps(threadGroupEl, [l5]); - builder._patchRange.basePatchNum = '1'; - threadGroupEl = builder._commentThreadGroupForLine(line); checkThreadGroupProps(threadGroupEl, [l5, r5]); @@ -370,8 +365,6 @@ limitations under the License. builder._commentThreadGroupForLine(line, GrDiffBuilder.Side.RIGHT); checkThreadGroupProps(threadGroupEl, [r5]); - builder._patchRange.basePatchNum = 'PARENT'; - line = new GrDiffLine(GrDiffLine.Type.REMOVE); line.beforeNumber = 5; line.afterNumber = 5; @@ -389,7 +382,7 @@ limitations under the License. test('_handlePreferenceError called with invalid preference', () => { sandbox.stub(element, '_handlePreferenceError'); const prefs = {tab_size: 0}; - element._getDiffBuilder(element.diff, undefined, prefs); + element._getDiffBuilder(element.diff, prefs); assert.isTrue(element._handlePreferenceError.lastCall .calledWithExactly('tab size')); }); @@ -947,8 +940,7 @@ limitations under the License. outputEl = element.queryEffectiveChildren('#diffTable'); comments = {left: [], right: [], meta: {patchRange: undefined}}; sandbox.stub(element, '_getDiffBuilder', () => { - const builder = new GrDiffBuilder( - {content}, undefined, [], prefs, outputEl); + const builder = new GrDiffBuilder({content}, [], prefs, outputEl); sandbox.stub(builder, 'addColumns'); builder.buildSectionElement = function(group) { const section = document.createElement('stub'); diff --git a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.html b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.html index 4befd2f320..62284add51 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.html +++ b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.html @@ -302,8 +302,7 @@ limitations under the License. const mock = document.createElement('mock-diff-response'); element.$.diffBuilder._builder = element.$.diffBuilder._getDiffBuilder( - mock.diffResponse, {left: [], right: []}, - {tab_size: 2, line_length: 80}); + mock.diffResponse, {tab_size: 2, line_length: 80}); // No thread groups. assert.isNotOk(element._getThreadGroupForLine(contentEl));