mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 1826622 - Constrain form validation popups. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D175231
This commit is contained in:
parent
c86335b0e3
commit
9101fae166
@ -96,7 +96,7 @@ export class FormValidationParent extends JSWindowActorParent {
|
||||
return;
|
||||
}
|
||||
|
||||
this._showPopup(data);
|
||||
this._showPopup(browser, data);
|
||||
break;
|
||||
case "FormValidation:HidePopup":
|
||||
this._hidePopup();
|
||||
@ -137,22 +137,18 @@ export class FormValidationParent extends JSWindowActorParent {
|
||||
* Shows the form validation popup at a specified position or updates the
|
||||
* messaging and position if the popup is already displayed.
|
||||
*
|
||||
* @aBrowser - Browser element that requests the popup.
|
||||
* @aPanelData - Object that contains popup information
|
||||
* aPanelData stucture detail:
|
||||
* screenRect - the screen rect of the target element.
|
||||
* position - popup positional string constants.
|
||||
* message - the form element validation message text.
|
||||
*/
|
||||
_showPopup(aPanelData) {
|
||||
_showPopup(aBrowser, aPanelData) {
|
||||
let previouslyShown = !!this._panel;
|
||||
this._panel = this._getAndMaybeCreatePanel();
|
||||
this._panel.firstChild.textContent = aPanelData.message;
|
||||
|
||||
let browser = this.browsingContext.top.embedderElement;
|
||||
let window = browser.ownerGlobal;
|
||||
|
||||
let tabBrowser = window.gBrowser;
|
||||
|
||||
// Display the panel if it isn't already visible.
|
||||
if (previouslyShown) {
|
||||
return;
|
||||
@ -164,9 +160,11 @@ export class FormValidationParent extends JSWindowActorParent {
|
||||
Services.obs.addObserver(this._obs, "popup-shown", true);
|
||||
|
||||
// Hide if the user scrolls the page
|
||||
tabBrowser.selectedBrowser.addEventListener("scroll", this, true);
|
||||
tabBrowser.selectedBrowser.addEventListener("FullZoomChange", this);
|
||||
tabBrowser.selectedBrowser.addEventListener("TextZoomChange", this);
|
||||
aBrowser.addEventListener("scroll", this, true);
|
||||
aBrowser.addEventListener("FullZoomChange", this);
|
||||
aBrowser.addEventListener("TextZoomChange", this);
|
||||
|
||||
aBrowser.constrainPopup(this._panel);
|
||||
|
||||
// Open the popup
|
||||
let rect = aPanelData.screenRect;
|
||||
|
Loading…
Reference in New Issue
Block a user