Bug 928405 - Reset :hover state when the application is sent to the background. r=fabrice

This commit is contained in:
Vivien Nicolas 2013-10-19 12:30:33 +02:00
parent 84881097e7
commit eae8198829
2 changed files with 23 additions and 0 deletions

View File

@ -320,6 +320,8 @@ BrowserElementChild.prototype = {
let returnValue = this._waitForResult(win);
Services.obs.notifyObservers(null, 'BEC:ShownModalPrompt', null);
if (args.promptType == 'prompt' ||
args.promptType == 'confirm' ||
args.promptType == 'custom-prompt') {

View File

@ -63,6 +63,8 @@ const ContentPanning = {
addMessageListener("Viewport:Change", this._recvViewportChange.bind(this));
addMessageListener("Gesture:DoubleTap", this._recvDoubleTap.bind(this));
addEventListener("visibilitychange", this._recvVisibilityChange.bind(this));
Services.obs.addObserver(this, "BEC:ShownModalPrompt", false);
},
handleEvent: function cp_handleEvent(evt) {
@ -110,6 +112,12 @@ const ContentPanning = {
}
},
observe: function cp_observe(subject, topic, data) {
if (topic === 'BEC:ShownModalPrompt') {
this._resetHover();
}
},
position: new Point(0 , 0),
findPrimaryPointer: function cp_findPrimaryPointer(touches) {
@ -496,6 +504,12 @@ const ContentPanning = {
this._setActive(root.documentElement);
},
_resetHover: function cp_resetHover() {
const kStateHover = 0x00000004;
let element = content.document.createElement('foo');
this._domUtils.setContentState(element, kStateHover);
},
_setActive: function cp_setActive(elt) {
const kStateActive = 0x00000001;
this._domUtils.setContentState(elt, kStateActive);
@ -581,6 +595,13 @@ const ContentPanning = {
}
},
_recvVisibilityChange: function(evt) {
if (!evt.target.hidden)
return;
this._resetHover();
},
_shouldZoomToElement: function(aElement) {
let win = aElement.ownerDocument.defaultView;
if (win.getComputedStyle(aElement, null).display == "inline")