mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Bug 1450418. Get rid of nsIDOMScreen. r=qdot
MozReview-Commit-ID: A5Rq0BSQt4V
This commit is contained in:
parent
1ce7e994ba
commit
9bb77bdfc7
@ -2332,15 +2332,6 @@ nsGlobalWindowInner::GetScreen(ErrorResult& aError)
|
||||
return mScreen;
|
||||
}
|
||||
|
||||
nsIDOMScreen*
|
||||
nsGlobalWindowInner::GetScreen()
|
||||
{
|
||||
ErrorResult dummy;
|
||||
nsIDOMScreen* screen = GetScreen(dummy);
|
||||
dummy.SuppressException();
|
||||
return screen;
|
||||
}
|
||||
|
||||
nsHistory*
|
||||
nsGlobalWindowInner::GetHistory(ErrorResult& aError)
|
||||
{
|
||||
|
@ -779,7 +779,6 @@ public:
|
||||
mozilla::dom::CallerType aCallerType,
|
||||
mozilla::ErrorResult& aError);
|
||||
nsScreen* GetScreen(mozilla::ErrorResult& aError);
|
||||
nsIDOMScreen* GetScreen() override;
|
||||
void MoveTo(int32_t aXPos, int32_t aYPos,
|
||||
mozilla::dom::CallerType aCallerType,
|
||||
mozilla::ErrorResult& aError);
|
||||
|
@ -2596,10 +2596,10 @@ nsGlobalWindowOuter::GetNavigator()
|
||||
FORWARD_TO_INNER(Navigator, (), nullptr);
|
||||
}
|
||||
|
||||
nsIDOMScreen*
|
||||
nsScreen*
|
||||
nsGlobalWindowOuter::GetScreen()
|
||||
{
|
||||
FORWARD_TO_INNER(GetScreen, (), nullptr);
|
||||
FORWARD_TO_INNER(GetScreen, (IgnoreErrors()), nullptr);
|
||||
}
|
||||
|
||||
void
|
||||
@ -3708,10 +3708,9 @@ nsGlobalWindowOuter::CheckSecurityLeftAndTop(int32_t* aLeft, int32_t* aTop,
|
||||
|
||||
nsCOMPtr<nsIBaseWindow> treeOwner = GetTreeOwnerWindow();
|
||||
|
||||
nsCOMPtr<nsIDOMScreen> screen = GetScreen();
|
||||
RefPtr<nsScreen> screen = GetScreen();
|
||||
|
||||
if (treeOwner && screen) {
|
||||
int32_t screenLeft, screenTop, screenWidth, screenHeight;
|
||||
int32_t winLeft, winTop, winWidth, winHeight;
|
||||
|
||||
// Get the window size
|
||||
@ -3726,9 +3725,9 @@ nsGlobalWindowOuter::CheckSecurityLeftAndTop(int32_t* aLeft, int32_t* aTop,
|
||||
|
||||
// Get the screen dimensions
|
||||
// XXX This should use nsIScreenManager once it's fully fleshed out.
|
||||
screen->GetAvailLeft(&screenLeft);
|
||||
screen->GetAvailWidth(&screenWidth);
|
||||
screen->GetAvailHeight(&screenHeight);
|
||||
int32_t screenLeft = screen->GetAvailLeft(IgnoreErrors());
|
||||
int32_t screenWidth = screen->GetAvailWidth(IgnoreErrors());
|
||||
int32_t screenHeight = screen->GetAvailHeight(IgnoreErrors());
|
||||
#if defined(XP_MACOSX)
|
||||
/* The mac's coordinate system is different from the assumed Windows'
|
||||
system. It offsets by the height of the menubar so that a window
|
||||
@ -3737,9 +3736,9 @@ nsGlobalWindowOuter::CheckSecurityLeftAndTop(int32_t* aLeft, int32_t* aTop,
|
||||
the Avail... coordinates is overloaded. Here we allow a window
|
||||
to be placed at (0,0) because it does make sense to do so.
|
||||
*/
|
||||
screen->GetTop(&screenTop);
|
||||
int32_t screenTop = screen->GetTop(IgnoreErrors());
|
||||
#else
|
||||
screen->GetAvailTop(&screenTop);
|
||||
int32_t screenTop = screen->GetAvailTop(IgnoreErrors());
|
||||
#endif
|
||||
|
||||
if (aLeft) {
|
||||
|
@ -636,7 +636,7 @@ public:
|
||||
already_AddRefed<mozilla::dom::MediaQueryList> MatchMediaOuter(
|
||||
const nsAString& aQuery,
|
||||
mozilla::dom::CallerType aCallerType);
|
||||
nsIDOMScreen* GetScreen() override;
|
||||
nsScreen* GetScreen();
|
||||
void MoveToOuter(int32_t aXPos, int32_t aYPos,
|
||||
mozilla::dom::CallerType aCallerType,
|
||||
mozilla::ErrorResult& aError);
|
||||
|
@ -590,7 +590,6 @@ public:
|
||||
return mMarkedCCGeneration;
|
||||
}
|
||||
|
||||
virtual nsIDOMScreen* GetScreen() = 0;
|
||||
mozilla::dom::Navigator* Navigator();
|
||||
virtual mozilla::dom::Location* GetLocation() = 0;
|
||||
|
||||
@ -1094,7 +1093,6 @@ public:
|
||||
|
||||
// XXX(nika): These feel like they should be inner window only, but they're
|
||||
// called on the outer window.
|
||||
virtual nsIDOMScreen* GetScreen() = 0;
|
||||
virtual mozilla::dom::Navigator* GetNavigator() = 0;
|
||||
virtual mozilla::dom::Location* GetLocation() = 0;
|
||||
|
||||
|
@ -50,7 +50,6 @@ nsScreen::~nsScreen()
|
||||
|
||||
// QueryInterface implementation for nsScreen
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsScreen)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMScreen)
|
||||
NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsScreen, DOMEventTargetHelper)
|
||||
@ -80,22 +79,6 @@ nsScreen::GetPixelDepth(ErrorResult& aRv)
|
||||
return depth;
|
||||
}
|
||||
|
||||
#define FORWARD_LONG_GETTER(_name) \
|
||||
NS_IMETHODIMP \
|
||||
nsScreen::Get ## _name(int32_t* aOut) \
|
||||
{ \
|
||||
ErrorResult rv; \
|
||||
*aOut = Get ## _name(rv); \
|
||||
return rv.StealNSResult(); \
|
||||
}
|
||||
|
||||
FORWARD_LONG_GETTER(AvailWidth)
|
||||
FORWARD_LONG_GETTER(AvailHeight)
|
||||
|
||||
FORWARD_LONG_GETTER(Top)
|
||||
FORWARD_LONG_GETTER(AvailTop)
|
||||
FORWARD_LONG_GETTER(AvailLeft)
|
||||
|
||||
nsPIDOMWindowOuter*
|
||||
nsScreen::GetOuter() const
|
||||
{
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "mozilla/dom/ScreenOrientation.h"
|
||||
#include "mozilla/DOMEventTargetHelper.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "nsIDOMScreen.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsRect.h"
|
||||
|
||||
@ -18,14 +17,12 @@ class nsDeviceContext;
|
||||
|
||||
// Script "screen" object
|
||||
class nsScreen : public mozilla::DOMEventTargetHelper
|
||||
, public nsIDOMScreen
|
||||
{
|
||||
typedef mozilla::ErrorResult ErrorResult;
|
||||
public:
|
||||
static already_AddRefed<nsScreen> Create(nsPIDOMWindowInner* aWindow);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIDOMSCREEN
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsScreen, mozilla::DOMEventTargetHelper)
|
||||
NS_REALLY_FORWARD_NSIDOMEVENTTARGET(mozilla::DOMEventTargetHelper)
|
||||
|
||||
|
@ -34,7 +34,6 @@ class DOMException;
|
||||
// Base
|
||||
interface nsIDOMWindow;
|
||||
interface nsIDOMWindowCollection;
|
||||
interface nsIDOMScreen;
|
||||
|
||||
// Events
|
||||
interface nsIDOMEvent;
|
||||
|
@ -17,7 +17,6 @@ XPIDL_SOURCES += [
|
||||
'nsIContentURIGrouper.idl',
|
||||
'nsIDOMChromeWindow.idl',
|
||||
'nsIDOMGlobalPropertyInitializer.idl',
|
||||
'nsIDOMScreen.idl',
|
||||
'nsIDOMWindow.idl',
|
||||
'nsIDOMWindowCollection.idl',
|
||||
'nsIDOMWindowUtils.idl',
|
||||
|
@ -1,16 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsIDOMEventTarget.idl"
|
||||
|
||||
[builtinclass, uuid(82c7924b-4b46-4e5a-a8d2-6edb5fc0a60d)]
|
||||
interface nsIDOMScreen : nsIDOMEventTarget
|
||||
{
|
||||
readonly attribute long top;
|
||||
readonly attribute long availWidth;
|
||||
readonly attribute long availHeight;
|
||||
readonly attribute long availLeft;
|
||||
readonly attribute long availTop;
|
||||
};
|
@ -19,7 +19,6 @@
|
||||
#include "nsPopupSetFrame.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMScreen.h"
|
||||
#include "nsIDOMXULMenuListElement.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsFrameManager.h"
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "nsIDOMOfflineResourceList.h"
|
||||
#include "nsIDOMParser.h"
|
||||
#include "nsIDOMRange.h"
|
||||
#include "nsIDOMScreen.h"
|
||||
#include "nsIDOMSerializer.h"
|
||||
#include "nsIDOMXMLDocument.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
@ -69,7 +68,6 @@
|
||||
#ifdef MOZ_WEBRTC
|
||||
#include "mozilla/dom/RTCDataChannelBinding.h"
|
||||
#endif
|
||||
#include "mozilla/dom/ScreenBinding.h"
|
||||
#include "mozilla/dom/SelectionBinding.h"
|
||||
#include "mozilla/dom/StorageEventBinding.h"
|
||||
#include "mozilla/dom/StyleSheetBinding.h"
|
||||
@ -158,7 +156,6 @@ const ComponentsInterfaceShimEntry kComponentsInterfaceShimMap[] =
|
||||
#ifdef MOZ_WEBRTC
|
||||
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMDataChannel, RTCDataChannel),
|
||||
#endif
|
||||
DEFINE_SHIM(Screen),
|
||||
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMSerializer, XMLSerializer),
|
||||
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsITreeBoxObject, TreeBoxObject),
|
||||
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIWebBrowserPersistable, FrameLoader),
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "mozilla/Sprintf.h"
|
||||
|
||||
//Interfaces needed to be included
|
||||
#include "nsGlobalWindowOuter.h"
|
||||
#include "nsIAppShell.h"
|
||||
#include "nsIAppShellService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
@ -29,7 +30,7 @@
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMScreen.h"
|
||||
#include "nsScreen.h"
|
||||
#include "nsIEmbeddingSiteWindow.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
@ -1028,23 +1029,25 @@ NS_IMETHODIMP nsXULWindow::EnsureAuthPrompter()
|
||||
|
||||
NS_IMETHODIMP nsXULWindow::GetAvailScreenSize(int32_t* aAvailWidth, int32_t* aAvailHeight)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<mozIDOMWindowProxy> domWindow;
|
||||
GetWindowDOMWindow(getter_AddRefs(domWindow));
|
||||
NS_ENSURE_STATE(domWindow);
|
||||
|
||||
auto* window = nsPIDOMWindowOuter::From(domWindow);
|
||||
NS_ENSURE_STATE(window);
|
||||
auto* window = nsGlobalWindowOuter::Cast(domWindow);
|
||||
|
||||
nsCOMPtr<nsIDOMScreen> screen = window->GetScreen();
|
||||
RefPtr<nsScreen> screen = window->GetScreen();
|
||||
NS_ENSURE_STATE(screen);
|
||||
|
||||
rv = screen->GetAvailWidth(aAvailWidth);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
ErrorResult rv;
|
||||
*aAvailWidth = screen->GetAvailWidth(rv);
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
rv = screen->GetAvailHeight(aAvailHeight);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
*aAvailHeight = screen->GetAvailHeight(rv);
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user