Loading dom/base/nsScreen.cpp +23 −23 Original line number Diff line number Diff line Loading @@ -55,6 +55,23 @@ using namespace mozilla::dom; /* static */ bool nsScreen::sAllowScreenEnabledProperty = false; /* static */ bool nsScreen::sAllowScreenBrightnessProperty = false; namespace { bool IsChromeType(nsIDocShell *aDocShell) { nsCOMPtr<nsIDocShellTreeItem> ds = do_QueryInterface(aDocShell); if (!ds) { return false; } PRInt32 itemType; ds->GetItemType(&itemType); return itemType == nsIDocShellTreeItem::typeChrome; } } // anonymous namespace /* static */ void nsScreen::Initialize() { Loading Loading @@ -93,7 +110,7 @@ nsScreen::Create(nsPIDOMWindow* aWindow) screen->mOwner = aWindow; screen->mScriptContext.swap(scriptContext); screen->mDocShell = aWindow->GetDocShell(); screen->mIsChrome = IsChromeType(aWindow->GetDocShell()); hal::RegisterScreenOrientationObserver(screen); hal::GetCurrentScreenOrientation(&(screen->mOrientation)); Loading Loading @@ -254,7 +271,7 @@ nsScreen::GetAvailTop(PRInt32* aAvailTop) nsDeviceContext* nsScreen::GetDeviceContext() { return nsLayoutUtils::GetDeviceContextForScreenInfo(mDocShell); return nsLayoutUtils::GetDeviceContextForScreenInfo(mOwner); } nsresult Loading Loading @@ -295,27 +312,10 @@ nsScreen::GetAvailRect(nsRect& aRect) return NS_OK; } namespace { bool IsChromeType(nsIDocShell *aDocShell) { nsCOMPtr<nsIDocShellTreeItem> ds = do_QueryInterface(aDocShell); if (!ds) { return false; } PRInt32 itemType; ds->GetItemType(&itemType); return itemType == nsIDocShellTreeItem::typeChrome; } } // anonymous namespace nsresult nsScreen::GetMozEnabled(bool *aEnabled) { if (!sAllowScreenEnabledProperty || !IsChromeType(mDocShell)) { if (!sAllowScreenEnabledProperty || mIsChrome) { *aEnabled = true; return NS_OK; } Loading @@ -327,7 +327,7 @@ nsScreen::GetMozEnabled(bool *aEnabled) nsresult nsScreen::SetMozEnabled(bool aEnabled) { if (!sAllowScreenEnabledProperty || !IsChromeType(mDocShell)) { if (!sAllowScreenEnabledProperty || mIsChrome) { return NS_OK; } Loading @@ -340,7 +340,7 @@ nsScreen::SetMozEnabled(bool aEnabled) nsresult nsScreen::GetMozBrightness(double *aBrightness) { if (!sAllowScreenBrightnessProperty || !IsChromeType(mDocShell)) { if (!sAllowScreenBrightnessProperty || mIsChrome) { *aBrightness = 1; return NS_OK; } Loading @@ -352,7 +352,7 @@ nsScreen::GetMozBrightness(double *aBrightness) nsresult nsScreen::SetMozBrightness(double aBrightness) { if (!sAllowScreenBrightnessProperty || !IsChromeType(mDocShell)) { if (!sAllowScreenBrightnessProperty || mIsChrome) { return NS_OK; } Loading dom/base/nsScreen.h +1 −1 Original line number Diff line number Diff line Loading @@ -74,7 +74,7 @@ protected: nsresult GetRect(nsRect& aRect); nsresult GetAvailRect(nsRect& aRect); nsIDocShell* mDocShell; // Weak Reference bool mIsChrome; mozilla::dom::ScreenOrientation mOrientation; Loading layout/base/nsLayoutUtils.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -4005,9 +4005,9 @@ nsLayoutUtils::GetRectDifferenceStrips(const nsRect& aR1, const nsRect& aR2, } nsDeviceContext* nsLayoutUtils::GetDeviceContextForScreenInfo(nsIDocShell* aDocShell) nsLayoutUtils::GetDeviceContextForScreenInfo(nsPIDOMWindow* aWindow) { nsCOMPtr<nsIDocShell> docShell = aDocShell; nsCOMPtr<nsIDocShell> docShell = aWindow->GetDocShell(); while (docShell) { // Now make sure our size is up to date. That will mean that the device // context does the right thing on multi-monitor systems when we return it to Loading layout/base/nsLayoutUtils.h +2 −2 Original line number Diff line number Diff line Loading @@ -1330,11 +1330,11 @@ public: /** * Get a device context that can be used to get up-to-date device * dimensions for the given docshell. For some reason, this is more * dimensions for the given window. For some reason, this is more * complicated than it ought to be in multi-monitor situations. */ static nsDeviceContext* GetDeviceContextForScreenInfo(nsIDocShell* aDocShell); GetDeviceContextForScreenInfo(nsPIDOMWindow* aWindow); /** * Some frames with 'position: fixed' (nsStylePosition::mDisplay == Loading Loading
dom/base/nsScreen.cpp +23 −23 Original line number Diff line number Diff line Loading @@ -55,6 +55,23 @@ using namespace mozilla::dom; /* static */ bool nsScreen::sAllowScreenEnabledProperty = false; /* static */ bool nsScreen::sAllowScreenBrightnessProperty = false; namespace { bool IsChromeType(nsIDocShell *aDocShell) { nsCOMPtr<nsIDocShellTreeItem> ds = do_QueryInterface(aDocShell); if (!ds) { return false; } PRInt32 itemType; ds->GetItemType(&itemType); return itemType == nsIDocShellTreeItem::typeChrome; } } // anonymous namespace /* static */ void nsScreen::Initialize() { Loading Loading @@ -93,7 +110,7 @@ nsScreen::Create(nsPIDOMWindow* aWindow) screen->mOwner = aWindow; screen->mScriptContext.swap(scriptContext); screen->mDocShell = aWindow->GetDocShell(); screen->mIsChrome = IsChromeType(aWindow->GetDocShell()); hal::RegisterScreenOrientationObserver(screen); hal::GetCurrentScreenOrientation(&(screen->mOrientation)); Loading Loading @@ -254,7 +271,7 @@ nsScreen::GetAvailTop(PRInt32* aAvailTop) nsDeviceContext* nsScreen::GetDeviceContext() { return nsLayoutUtils::GetDeviceContextForScreenInfo(mDocShell); return nsLayoutUtils::GetDeviceContextForScreenInfo(mOwner); } nsresult Loading Loading @@ -295,27 +312,10 @@ nsScreen::GetAvailRect(nsRect& aRect) return NS_OK; } namespace { bool IsChromeType(nsIDocShell *aDocShell) { nsCOMPtr<nsIDocShellTreeItem> ds = do_QueryInterface(aDocShell); if (!ds) { return false; } PRInt32 itemType; ds->GetItemType(&itemType); return itemType == nsIDocShellTreeItem::typeChrome; } } // anonymous namespace nsresult nsScreen::GetMozEnabled(bool *aEnabled) { if (!sAllowScreenEnabledProperty || !IsChromeType(mDocShell)) { if (!sAllowScreenEnabledProperty || mIsChrome) { *aEnabled = true; return NS_OK; } Loading @@ -327,7 +327,7 @@ nsScreen::GetMozEnabled(bool *aEnabled) nsresult nsScreen::SetMozEnabled(bool aEnabled) { if (!sAllowScreenEnabledProperty || !IsChromeType(mDocShell)) { if (!sAllowScreenEnabledProperty || mIsChrome) { return NS_OK; } Loading @@ -340,7 +340,7 @@ nsScreen::SetMozEnabled(bool aEnabled) nsresult nsScreen::GetMozBrightness(double *aBrightness) { if (!sAllowScreenBrightnessProperty || !IsChromeType(mDocShell)) { if (!sAllowScreenBrightnessProperty || mIsChrome) { *aBrightness = 1; return NS_OK; } Loading @@ -352,7 +352,7 @@ nsScreen::GetMozBrightness(double *aBrightness) nsresult nsScreen::SetMozBrightness(double aBrightness) { if (!sAllowScreenBrightnessProperty || !IsChromeType(mDocShell)) { if (!sAllowScreenBrightnessProperty || mIsChrome) { return NS_OK; } Loading
dom/base/nsScreen.h +1 −1 Original line number Diff line number Diff line Loading @@ -74,7 +74,7 @@ protected: nsresult GetRect(nsRect& aRect); nsresult GetAvailRect(nsRect& aRect); nsIDocShell* mDocShell; // Weak Reference bool mIsChrome; mozilla::dom::ScreenOrientation mOrientation; Loading
layout/base/nsLayoutUtils.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -4005,9 +4005,9 @@ nsLayoutUtils::GetRectDifferenceStrips(const nsRect& aR1, const nsRect& aR2, } nsDeviceContext* nsLayoutUtils::GetDeviceContextForScreenInfo(nsIDocShell* aDocShell) nsLayoutUtils::GetDeviceContextForScreenInfo(nsPIDOMWindow* aWindow) { nsCOMPtr<nsIDocShell> docShell = aDocShell; nsCOMPtr<nsIDocShell> docShell = aWindow->GetDocShell(); while (docShell) { // Now make sure our size is up to date. That will mean that the device // context does the right thing on multi-monitor systems when we return it to Loading
layout/base/nsLayoutUtils.h +2 −2 Original line number Diff line number Diff line Loading @@ -1330,11 +1330,11 @@ public: /** * Get a device context that can be used to get up-to-date device * dimensions for the given docshell. For some reason, this is more * dimensions for the given window. For some reason, this is more * complicated than it ought to be in multi-monitor situations. */ static nsDeviceContext* GetDeviceContextForScreenInfo(nsIDocShell* aDocShell); GetDeviceContextForScreenInfo(nsPIDOMWindow* aWindow); /** * Some frames with 'position: fixed' (nsStylePosition::mDisplay == Loading