Bug 1186662 - Part 2: Suppress the Displayport during active resize on mac. r=mstange

This commit is contained in:
Benoit Girard 2015-08-26 12:59:17 -04:00
parent e89dc1e7bc
commit 137fcd8d84
3 changed files with 60 additions and 1 deletions

View File

@ -34,7 +34,7 @@
</xul:tabbox>
<children/>
</content>
<implementation implements="nsIDOMEventListener, nsIMessageListener">
<implementation implements="nsIDOMEventListener, nsIMessageListener, nsIObserver">
<property name="tabContextMenu" readonly="true"
onget="return this.tabContainer.contextMenu;"/>
@ -102,6 +102,9 @@
<field name="mProgressListeners">
[]
</field>
<field name="mActiveResizeDisplayportSuppression">
null
</field>
<field name="mTabsProgressListeners">
[]
</field>
@ -4070,12 +4073,40 @@
]]></body>
</method>
<method name="observe">
<parameter name="aSubject"/>
<parameter name="aTopic"/>
<parameter name="aData"/>
<body><![CDATA[
if (aTopic == "live-resize-start") {
let browser = this.mCurrentTab.linkedBrowser;
let fl = browser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader;
if (fl && fl.tabParent && !this.mActiveResizeDisplayportSuppression) {
fl.tabParent.suppressDisplayport(true);
this.mActiveResizeDisplayportSuppression = browser;
}
} else if (aTopic == "live-resize-end") {
let browser = this.mActiveResizeDisplayportSuppression;
if (browser) {
let fl = browser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader;
if (fl && fl.tabParent) {
fl.tabParent.suppressDisplayport(false);
this.mActiveResizeDisplayportSuppression = null;
}
}
}
]]></body>
</method>
<constructor>
<![CDATA[
let browserStack = document.getAnonymousElementByAttribute(this, "anonid", "browserStack");
this.mCurrentBrowser = document.getAnonymousElementByAttribute(this, "anonid", "initialBrowser");
this.mCurrentBrowser.permanentKey = {};
Services.obs.addObserver(this, "live-resize-start", false);
Services.obs.addObserver(this, "live-resize-end", false);
this.mCurrentTab = this.tabContainer.firstChild;
const nsIEventListenerService =
Components.interfaces.nsIEventListenerService;
@ -4161,6 +4192,9 @@
<destructor>
<![CDATA[
Services.obs.removeObserver(this, "live-resize-start", false);
Services.obs.removeObserver(this, "live-resize-end", false);
for (var i = 0; i < this.mTabListeners.length; ++i) {
let browser = this.getBrowserAtIndex(i);
if (browser.registeredOpenURI) {

View File

@ -280,6 +280,9 @@ typedef NSInteger NSEventGestureAxis;
- (BOOL)isCoveringTitlebar;
- (void)viewWillStartLiveResize;
- (void)viewDidEndLiveResize;
- (NSColor*)vibrancyFillColorForThemeGeometryType:(nsITheme::ThemeGeometryType)aThemeGeometryType;
- (NSColor*)vibrancyFontSmoothingBackgroundColorForThemeGeometryType:(nsITheme::ThemeGeometryType)aThemeGeometryType;

View File

@ -3436,6 +3436,28 @@ NSEvent* gLastDragMouseDownEvent = nil;
[(BaseWindow*)[self window] drawsContentsIntoWindowFrame];
}
- (void)viewWillStartLiveResize
{
nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
if (!observerService) {
return;
}
observerService->NotifyObservers(nullptr, "live-resize-start", nullptr);
}
- (void)viewDidEndLiveResize
{
nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
if (!observerService) {
return;
}
observerService->NotifyObservers(nullptr, "live-resize-end", nullptr);
}
- (NSColor*)vibrancyFillColorForThemeGeometryType:(nsITheme::ThemeGeometryType)aThemeGeometryType
{
if (!mGeckoChild) {