Add setParent to popup
This commit is contained in:
parent
30e13354b3
commit
7c68490d2e
@ -114,8 +114,7 @@ class PopupProxyHost {
|
||||
++this._nextId;
|
||||
const popup = new Popup(id, depth, this._frameIdPromise);
|
||||
if (parent !== null) {
|
||||
popup.parent = parent;
|
||||
parent.child = popup;
|
||||
popup.setParent(parent);
|
||||
}
|
||||
this._popups.set(id, popup);
|
||||
return {popup, id};
|
||||
|
@ -113,6 +113,20 @@ class Popup {
|
||||
|
||||
// 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() {
|
||||
return this.isInjected && (this.visibleOverride !== null ? this.visibleOverride : this.visible);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user