mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 12:50:09 +00:00
Bug 1351072 - [e10s] Clear active document when closing popup of <select>. r=smaug
MozReview-Commit-ID: IaRG67FwIPL --HG-- extra : amend_source : 3a2a548499fa73b9e9f8533777ebcf5fcbb626ae
This commit is contained in:
parent
57720f1ea5
commit
71ff52def2
@ -1108,6 +1108,7 @@ inDOMUtils::SetContentState(nsIDOMElement* aElement,
|
||||
NS_IMETHODIMP
|
||||
inDOMUtils::RemoveContentState(nsIDOMElement* aElement,
|
||||
EventStates::InternalType aState,
|
||||
bool aClearActiveDocument,
|
||||
bool* aRetVal)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aElement);
|
||||
@ -1117,6 +1118,15 @@ inDOMUtils::RemoveContentState(nsIDOMElement* aElement,
|
||||
NS_ENSURE_TRUE(esm, NS_ERROR_INVALID_ARG);
|
||||
|
||||
*aRetVal = esm->SetContentState(nullptr, EventStates(aState));
|
||||
|
||||
if (aClearActiveDocument && EventStates(aState) == NS_EVENT_STATE_ACTIVE) {
|
||||
EventStateManager* activeESM = static_cast<EventStateManager*>(
|
||||
EventStateManager::GetActiveEventStateManager());
|
||||
if (activeESM == esm) {
|
||||
EventStateManager::ClearGlobalActiveContent(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ interface inIDOMUtils : nsISupports
|
||||
in boolean aShowingAnonymousContent);
|
||||
nsIDOMNodeList getChildrenForNode(in nsIDOMNode aNode,
|
||||
in boolean aShowingAnonymousContent);
|
||||
|
||||
|
||||
// XBL utilities
|
||||
nsIArray getBindingURLs(in nsIDOMElement aElement);
|
||||
|
||||
@ -164,11 +164,15 @@ interface inIDOMUtils : nsISupports
|
||||
* that for the remove case we simply pass in nullptr for the element.
|
||||
* Use them accordingly.
|
||||
*
|
||||
* When removing the active state, you may optionally also clear the active
|
||||
* document as well by setting aClearActiveDocument
|
||||
*
|
||||
* @return Returns true if the state was set successfully. See more details
|
||||
* in EventStateManager.h SetContentState.
|
||||
*/
|
||||
bool setContentState(in nsIDOMElement aElement, in unsigned long long aState);
|
||||
bool removeContentState(in nsIDOMElement aElement, in unsigned long long aState);
|
||||
bool removeContentState(in nsIDOMElement aElement, in unsigned long long aState,
|
||||
[optional] in bool aClearActiveDocument);
|
||||
|
||||
nsIDOMFontFaceList getUsedFontFaces(in nsIDOMRange aRange);
|
||||
|
||||
|
@ -259,7 +259,12 @@ this.SelectContentHelper.prototype = {
|
||||
|
||||
case "Forms:DismissedDropDown":
|
||||
let selectedOption = this.element.item(this.element.selectedIndex);
|
||||
if (this.initialSelection != selectedOption) {
|
||||
if (this.initialSelection === selectedOption) {
|
||||
// Clear active document
|
||||
DOMUtils.removeContentState(this.element,
|
||||
kStateActive,
|
||||
/* aClearActiveDocument */ true);
|
||||
} else {
|
||||
let win = this.element.ownerGlobal;
|
||||
// For ordering of events, we're using non-e10s as our guide here,
|
||||
// since the spec isn't exactly clear. In non-e10s, we fire:
|
||||
@ -270,8 +275,12 @@ this.SelectContentHelper.prototype = {
|
||||
if (!this.closedWithEnter) {
|
||||
this.dispatchMouseEvent(win, selectedOption, "mousedown");
|
||||
this.dispatchMouseEvent(win, selectedOption, "mouseup");
|
||||
DOMUtils.removeContentState(this.element, kStateActive);
|
||||
}
|
||||
// Clear active document no matter user selects
|
||||
// via keyboard or mouse
|
||||
DOMUtils.removeContentState(this.element,
|
||||
kStateActive,
|
||||
/* aClearActiveDocument */ true);
|
||||
|
||||
let inputEvent = new win.UIEvent("input", {
|
||||
bubbles: true,
|
||||
|
Loading…
x
Reference in New Issue
Block a user