From cfc65c31313731dfa0d36c2eceaca35e9d50992f Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 18 Feb 2024 08:11:47 -0500 Subject: Refactor DocumentUtil (#706) * Refactor DocumentUtil * Isolate suppression --- ext/js/app/popup.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'ext/js/app/popup.js') diff --git a/ext/js/app/popup.js b/ext/js/app/popup.js index 103a5468..c9011932 100644 --- a/ext/js/app/popup.js +++ b/ext/js/app/popup.js @@ -22,7 +22,7 @@ import {EventDispatcher} from '../core/event-dispatcher.js'; import {EventListenerCollection} from '../core/event-listener-collection.js'; import {ExtensionError} from '../core/extension-error.js'; import {deepEqual} from '../core/utilities.js'; -import {DocumentUtil} from '../dom/document-util.js'; +import {addFullscreenChangeEventListener, computeZoomScale, convertRectZoomCoordinates, getFullscreenElement} from '../dom/document-util.js'; import {loadStyle} from '../dom/style-util.js'; import {ThemeController} from './theme-controller.js'; @@ -594,7 +594,7 @@ export class Popup extends EventDispatcher { return; } - DocumentUtil.addFullscreenChangeEventListener(this._onFullscreenChanged.bind(this), this._fullscreenEventListeners); + addFullscreenChangeEventListener(this._onFullscreenChanged.bind(this), this._fullscreenEventListeners); } /** @@ -748,7 +748,7 @@ export class Popup extends EventDispatcher { if (defaultParent !== null && defaultParent.tagName.toLowerCase() === 'frameset') { defaultParent = document.documentElement; } - const fullscreenElement = DocumentUtil.getFullscreenElement(); + const fullscreenElement = getFullscreenElement(); if ( fullscreenElement === null || fullscreenElement.shadowRoot || @@ -1091,7 +1091,7 @@ export class Popup extends EventDispatcher { * @returns {DOMRect} The rectangle of the frame. */ _getFrameBoundingClientRect() { - return DocumentUtil.convertRectZoomCoordinates(this._frame.getBoundingClientRect(), this._container); + return convertRectZoomCoordinates(this._frame.getBoundingClientRect(), this._container); } /** @@ -1100,7 +1100,7 @@ export class Popup extends EventDispatcher { * @returns {import('popup').Rect[]} Either an updated list of rectangles, or `sourceRects` if no change is required. */ _convertSourceRectsCoordinateSpace(sourceRects) { - let scale = DocumentUtil.computeZoomScale(this._container); + let scale = computeZoomScale(this._container); if (scale === 1) { return sourceRects; } scale = 1 / scale; const sourceRects2 = []; -- cgit v1.2.3