Skip to content

Commit

Permalink
chore: followup bug 1927094 - optimize lineScrollAmount so it doesn't…
Browse files Browse the repository at this point in the history
… iterate over all tabs
  • Loading branch information
onemen committed Nov 15, 2024
1 parent 4f350c9 commit 33a206b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
7 changes: 0 additions & 7 deletions addon/chrome/content/tab/scrollbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,6 @@ Tabmix.multiRow = {
'$& && !this.isMultiRow', {flags: "g"}
).toCode();

Tabmix.changeCode(this, "scrollbox.lineScrollAmount", {getter: true})._replace(
'{', `{
if (this.isMultiRow) {
return this.scrollSize / Tabmix.tabsUtils.lastTabRowNumber;
}`
).defineProperty();

const codeToReplace = Tabmix.isVersion(1310) ? 'this.#verticalMode' : 'this.getAttribute("orient") == "vertical"';
Tabmix.changeCode(this, "scrollbox.on_touchstart")._replace(
codeToReplace, 'this._verticalMode', {silent: true}
Expand Down
2 changes: 1 addition & 1 deletion addon/chrome/content/tabmix.js
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ var TMP_eventListener = {
let scrollAmount = 0;
if (TabmixTabbar.isMultiRow) {
delta = delta > 0 ? 1 : -1;
scrollAmount = delta * tabStrip.lineScrollAmount;
scrollAmount = delta * (tabStrip.scrollSize / Tabmix.tabsUtils.lastTabRowNumber);
} else if (aEvent.deltaMode == aEvent.DOM_DELTA_PIXEL) {
scrollAmount = delta;
instant = true;
Expand Down
1 change: 1 addition & 0 deletions types/addon.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ declare namespace TabmixArrowScrollboxNS {
minOffset: number;
offsetRatio: number;
parentNode: MockedGeckoTypes.TabContainer;
readonly scrollSize: number;
readonly shadowRoot: ShadowRoot;
scrollboxPaddingBottom: number;
scrollboxPaddingTop: number;
Expand Down

0 comments on commit 33a206b

Please sign in to comment.