aboutsummaryrefslogtreecommitdiff
path: root/ext/js/app
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2024-02-18 08:11:47 -0500
committerGitHub <noreply@github.com>2024-02-18 13:11:47 +0000
commitcfc65c31313731dfa0d36c2eceaca35e9d50992f (patch)
treeec96ec7ab1c3dae559fe5d7930c186347fb64a25 /ext/js/app
parent6cf38229b54efbbc3ae7bc174c3999f9dfa7b1d2 (diff)
Refactor DocumentUtil (#706)
* Refactor DocumentUtil * Isolate suppression
Diffstat (limited to 'ext/js/app')
-rw-r--r--ext/js/app/frontend.js6
-rw-r--r--ext/js/app/popup.js10
2 files changed, 8 insertions, 8 deletions
diff --git a/ext/js/app/frontend.js b/ext/js/app/frontend.js
index 9c4778cc..04f8673f 100644
--- a/ext/js/app/frontend.js
+++ b/ext/js/app/frontend.js
@@ -20,7 +20,7 @@ import {createApiMap, invokeApiMapHandler} from '../core/api-map.js';
import {EventListenerCollection} from '../core/event-listener-collection.js';
import {log} from '../core/log.js';
import {promiseAnimationFrame} from '../core/promise-animation-frame.js';
-import {DocumentUtil} from '../dom/document-util.js';
+import {addFullscreenChangeEventListener, getFullscreenElement} from '../dom/document-util.js';
import {TextSourceElement} from '../dom/text-source-element.js';
import {TextSourceGenerator} from '../dom/text-source-generator.js';
import {TextSourceRange} from '../dom/text-source-range.js';
@@ -163,7 +163,7 @@ export class Frontend {
this._textScanner.prepare();
window.addEventListener('resize', this._onResize.bind(this), false);
- DocumentUtil.addFullscreenChangeEventListener(this._updatePopup.bind(this));
+ addFullscreenChangeEventListener(this._updatePopup.bind(this));
const {visualViewport} = window;
if (typeof visualViewport !== 'undefined' && visualViewport !== null) {
@@ -523,7 +523,7 @@ export class Frontend {
} else if (
isIframe &&
showIframePopupsInRootFrame &&
- DocumentUtil.getFullscreenElement() === null &&
+ getFullscreenElement() === null &&
this._allowRootFramePopupProxy
) {
popupPromise = this._popupCache.get('iframe');
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 = [];