summaryrefslogtreecommitdiff
path: root/ext/fg/js/popup-proxy-host.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-12-15 17:03:46 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-12-16 19:54:41 -0500
commit2c8c6866eff1656c3ba5a04638534e4c1582739b (patch)
treea36085c1f61669f8463ec34d1ae63f6001a3d932 /ext/fg/js/popup-proxy-host.js
parent3f8cc83c25ebbb81a6e4cfb44b077fbc2423da7a (diff)
jsonRectToDOMRect => convertJsonRectToDOMRect
Also make static
Diffstat (limited to 'ext/fg/js/popup-proxy-host.js')
-rw-r--r--ext/fg/js/popup-proxy-host.js24
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();
}