jsonRectToDOMRect => convertJsonRectToDOMRect
Also make static
This commit is contained in:
parent
3f8cc83c25
commit
2c8c6866ef
@ -73,17 +73,6 @@ class PopupProxyHost {
|
|||||||
return popup;
|
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
|
// Message handlers
|
||||||
|
|
||||||
async createNestedPopup(parentId) {
|
async createNestedPopup(parentId) {
|
||||||
@ -117,7 +106,7 @@ class PopupProxyHost {
|
|||||||
|
|
||||||
async showContent(id, elementRect, writingMode, type, details) {
|
async showContent(id, elementRect, writingMode, type, details) {
|
||||||
const popup = this.getPopup(id);
|
const popup = this.getPopup(id);
|
||||||
elementRect = this.jsonRectToDOMRect(popup, elementRect);
|
elementRect = PopupProxyHost.convertJsonRectToDOMRect(popup, elementRect);
|
||||||
if (!PopupProxyHost.popupCanShow(popup)) { return Promise.resolve(false); }
|
if (!PopupProxyHost.popupCanShow(popup)) { return Promise.resolve(false); }
|
||||||
return await popup.showContent(elementRect, writingMode, type, details);
|
return await popup.showContent(elementRect, writingMode, type, details);
|
||||||
}
|
}
|
||||||
@ -132,6 +121,17 @@ class PopupProxyHost {
|
|||||||
return popup.clearAutoPlayTimer();
|
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) {
|
static popupCanShow(popup) {
|
||||||
return popup.parent === null || popup.parent.isVisible();
|
return popup.parent === null || popup.parent.isVisible();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user