Bug 702823 - Don't drop layers tree for last active tab on taskswitcher event and inactive state. r=mbrubeck

This commit is contained in:
Oleg Romashin 2011-11-17 15:52:04 -08:00
parent 9bb6eb0786
commit 9f2f0b8068
5 changed files with 20 additions and 6 deletions

View File

@ -702,7 +702,9 @@ let ContentActive = {
case "Content:Deactivate":
docShell.isActive = false;
let cwu = content.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
cwu.setDisplayPortForElement(0,0,0,0,content.document.documentElement);
if (json.keepviewport)
break;
cwu.setDisplayPortForElement(0, 0, 0, 0, content.document.documentElement);
break;
case "Content:Activate":

View File

@ -1117,7 +1117,18 @@
<property name="active" onget="return this._active;">
<setter><![CDATA[
this._active = val;
this.messageManager.sendAsyncMessage((val ? "Content:Activate" : "Content:Deactivate"), {});
let keepVisible = false;
#if MOZ_PLATFORM_MAEMO == 6
if (!val) {
// In task switcher, but display is on, keep visible
if ((ActivityObserver._inBackground && !ActivityObserver._isDisplayOff) ||
// If not active, app in foreground and display is on
(!ActivityObserver._inBackground && !ActivityObserver._isDisplayOff && ActivityObserver._notActive)) {
keepVisible = true;
}
}
#endif
this.messageManager.sendAsyncMessage((val ? "Content:Activate" : "Content:Deactivate"), { keepviewport: keepVisible });
if (val)
this.getRootView()._updateCacheViewport();
]]></setter>

View File

@ -61,6 +61,7 @@ const kBrowserViewZoomLevelPrecision = 10000;
// allow panning after this timeout on pages with registered touch listeners
const kTouchTimeout = 300;
const kSetInactiveStateTimeout = 100;
const kDefaultMetadata = { autoSize: false, allowZoom: true, autoScale: true };
@ -2701,7 +2702,7 @@ var ActivityObserver = {
// On Maemo all backgrounded applications getting portrait orientation
// so if browser had landscape mode then we need timeout in order
// to finish last rotate/paint operation and have nice lookine browser in TS
setTimeout(function() { Browser.selectedTab.active = activeTabState; }, 0);
setTimeout(function() { Browser.selectedTab.active = activeTabState; }, activeTabState ? 0 : kSetInactiveStateTimeout);
}
}
};

View File

@ -41,7 +41,7 @@ chrome.jar:
* content/bindings.xml (content/bindings.xml)
content/tabs.xml (content/tabs.xml)
content/bindings/checkbox.xml (content/bindings/checkbox.xml)
content/bindings/browser.xml (content/bindings/browser.xml)
* content/bindings/browser.xml (content/bindings/browser.xml)
content/bindings/browser.js (content/bindings/browser.js)
content/notification.xml (content/notification.xml)
content/bindings/extensions.xml (content/bindings/extensions.xml)

View File

@ -71,10 +71,10 @@ nsNativeAppSupportQt::displayStateChanged(MeeGo::QmDisplayState::DisplayState st
os->NotifyObservers(nsnull, "system-display-on", nsnull);
break;
case MeeGo::QmDisplayState::Off:
os->NotifyObservers(nsnull, "system-display-dimmed", nsnull);
os->NotifyObservers(nsnull, "system-display-off", nsnull);
break;
case MeeGo::QmDisplayState::Dimmed:
os->NotifyObservers(nsnull, "system-display-off", nsnull);
os->NotifyObservers(nsnull, "system-display-dimmed", nsnull);
break;
default:
NS_WARNING("Unknown display state");