Bug 1525101 - adjust nsIFormFillController to make custom elements popup working, r=peterv

Differential Revision: https://phabricator.services.mozilla.com/D20505

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alexander Surkov 2019-02-25 20:02:35 +00:00
Родитель dd71a0c9fb
Коммит 68b57502cc
3 изменённых файлов: 18 добавлений и 2 удалений

Просмотреть файл

@ -1443,8 +1443,8 @@ SpecialPowersAPI.prototype = {
},
attachFormFillControllerTo(window) {
this.getFormFillController()
.attachToBrowser(this._getDocShell(window),
this._getAutoCompletePopup(window));
.attachPopupElementToBrowser(this._getDocShell(window),
this._getAutoCompletePopup(window));
},
detachFormFillControllerFrom(window) {
this.getFormFillController().detachFromBrowser(this._getDocShell(window));

Просмотреть файл

@ -226,6 +226,20 @@ nsFormFillController::AttachToBrowser(nsIDocShell* aDocShell,
return NS_OK;
}
NS_IMETHODIMP
nsFormFillController::AttachPopupElementToBrowser(nsIDocShell* aDocShell,
dom::Element* aPopupEl) {
MOZ_LOG(sLogger, LogLevel::Debug,
("AttachPopupElementToBrowser for docShell %p with popup %p",
aDocShell, aPopupEl));
NS_ENSURE_TRUE(aDocShell && aPopupEl, NS_ERROR_ILLEGAL_VALUE);
nsCOMPtr<nsIAutoCompletePopup> popup = aPopupEl->AsAutoCompletePopup();
NS_ENSURE_STATE(popup);
return AttachToBrowser(aDocShell, popup);
}
NS_IMETHODIMP
nsFormFillController::DetachFromBrowser(nsIDocShell* aDocShell) {
int32_t index = GetIndexOfDocShell(aDocShell);

Просмотреть файл

@ -6,6 +6,7 @@
interface nsIDocShell;
interface nsIAutoCompletePopup;
webidl Element;
webidl HTMLInputElement;
@ -33,6 +34,7 @@ interface nsIFormFillController : nsISupports
* @param popup - The popup to show when autocomplete results are available
*/
void attachToBrowser(in nsIDocShell docShell, in nsIAutoCompletePopup popup);
void attachPopupElementToBrowser(in nsIDocShell docShell, in Element popup);
/*
* Stop controlling form fill behavior for the given browser