Add setParent to popup
This commit is contained in:
parent
30e13354b3
commit
7c68490d2e
@ -114,8 +114,7 @@ class PopupProxyHost {
|
|||||||
++this._nextId;
|
++this._nextId;
|
||||||
const popup = new Popup(id, depth, this._frameIdPromise);
|
const popup = new Popup(id, depth, this._frameIdPromise);
|
||||||
if (parent !== null) {
|
if (parent !== null) {
|
||||||
popup.parent = parent;
|
popup.setParent(parent);
|
||||||
parent.child = popup;
|
|
||||||
}
|
}
|
||||||
this._popups.set(id, popup);
|
this._popups.set(id, popup);
|
||||||
return {popup, id};
|
return {popup, id};
|
||||||
|
@ -113,6 +113,20 @@ class Popup {
|
|||||||
|
|
||||||
// Popup-only public functions
|
// Popup-only public functions
|
||||||
|
|
||||||
|
setParent(parent) {
|
||||||
|
if (parent === null) {
|
||||||
|
throw new Error('Cannot set popup parent to null');
|
||||||
|
}
|
||||||
|
if (this.parent !== null) {
|
||||||
|
throw new Error('Popup already has a parent');
|
||||||
|
}
|
||||||
|
if (parent.child !== null) {
|
||||||
|
throw new Error('Cannot parent popup to another popup which already has a child');
|
||||||
|
}
|
||||||
|
this.parent = parent;
|
||||||
|
parent.child = this;
|
||||||
|
}
|
||||||
|
|
||||||
isVisible() {
|
isVisible() {
|
||||||
return this.isInjected && (this.visibleOverride !== null ? this.visibleOverride : this.visible);
|
return this.isInjected && (this.visibleOverride !== null ? this.visibleOverride : this.visible);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user