diff options
-rw-r--r-- | ext/fg/js/popup-proxy-host.js | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/ext/fg/js/popup-proxy-host.js b/ext/fg/js/popup-proxy-host.js index 83518f44..e932ae52 100644 --- a/ext/fg/js/popup-proxy-host.js +++ b/ext/fg/js/popup-proxy-host.js @@ -73,17 +73,6 @@ class PopupProxyHost { return popup; } - jsonRectToDOMRect(popup, jsonRect) { - let x = jsonRect.x; - let y = jsonRect.y; - if (popup.parent !== null) { - const popupRect = popup.parent.container.getBoundingClientRect(); - x += popupRect.x; - y += popupRect.y; - } - return new DOMRect(x, y, jsonRect.width, jsonRect.height); - } - // Message handlers async createNestedPopup(parentId) { @@ -117,7 +106,7 @@ class PopupProxyHost { async showContent(id, elementRect, writingMode, type, details) { const popup = this.getPopup(id); - elementRect = this.jsonRectToDOMRect(popup, elementRect); + elementRect = PopupProxyHost.convertJsonRectToDOMRect(popup, elementRect); if (!PopupProxyHost.popupCanShow(popup)) { return Promise.resolve(false); } return await popup.showContent(elementRect, writingMode, type, details); } @@ -132,6 +121,17 @@ class PopupProxyHost { return popup.clearAutoPlayTimer(); } + static convertJsonRectToDOMRect(popup, jsonRect) { + let x = jsonRect.x; + let y = jsonRect.y; + if (popup.parent !== null) { + const popupRect = popup.parent.container.getBoundingClientRect(); + x += popupRect.x; + y += popupRect.y; + } + return new DOMRect(x, y, jsonRect.width, jsonRect.height); + } + static popupCanShow(popup) { return popup.parent === null || popup.parent.isVisible(); } |