mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1229237 (part 1) - Make nsIWidget::{Create,CreateChildren}() take a LayoutDeviceIntRect. r=botond.
This commit is contained in:
parent
ded4524b9d
commit
aa1114c018
@ -757,7 +757,7 @@ TabChild::Init()
|
||||
}
|
||||
mPuppetWidget->Create(
|
||||
nullptr, 0, // no parents
|
||||
gfx::IntRect(gfx::IntPoint(0, 0), gfx::IntSize(0, 0)),
|
||||
LayoutDeviceIntRect(0, 0, 0, 0),
|
||||
nullptr // HandleWidgetEvent
|
||||
);
|
||||
|
||||
@ -2838,8 +2838,9 @@ TabChild::CreatePluginWidget(nsIWidget* aParent, nsIWidget** aOut)
|
||||
initData.mUnicode = false;
|
||||
initData.clipChildren = true;
|
||||
initData.clipSiblings = true;
|
||||
nsresult rv = pluginWidget->Create(aParent, nullptr, gfx::IntRect(gfx::IntPoint(0, 0),
|
||||
nsIntSize(0, 0)), &initData);
|
||||
nsresult rv = pluginWidget->Create(aParent, nullptr,
|
||||
LayoutDeviceIntRect(0, 0, 0, 0),
|
||||
&initData);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Creating native plugin widget on the chrome side failed.");
|
||||
}
|
||||
|
@ -2960,8 +2960,8 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void)
|
||||
initData.mUnicode = false;
|
||||
initData.clipChildren = true;
|
||||
initData.clipSiblings = true;
|
||||
rv = mWidget->Create(parentWidget.get(), nullptr, nsIntRect(0,0,0,0),
|
||||
&initData);
|
||||
rv = mWidget->Create(parentWidget.get(), nullptr,
|
||||
LayoutDeviceIntRect(0, 0, 0, 0), &initData);
|
||||
if (NS_FAILED(rv)) {
|
||||
mWidget->Destroy();
|
||||
mWidget = nullptr;
|
||||
|
@ -118,8 +118,8 @@ PluginWidgetParent::RecvCreate(nsresult* aResult)
|
||||
initData.mUnicode = false;
|
||||
initData.clipChildren = true;
|
||||
initData.clipSiblings = true;
|
||||
*aResult = mWidget->Create(parentWidget.get(), nullptr, nsIntRect(0,0,0,0),
|
||||
&initData);
|
||||
*aResult = mWidget->Create(parentWidget.get(), nullptr,
|
||||
LayoutDeviceIntRect(0, 0, 0, 0), &initData);
|
||||
if (NS_FAILED(*aResult)) {
|
||||
KillWidget();
|
||||
// This should never fail, abort.
|
||||
|
@ -1176,7 +1176,8 @@ nsWebBrowser::Create()
|
||||
widgetInit.clipChildren = true;
|
||||
|
||||
widgetInit.mWindowType = eWindowType_child;
|
||||
nsIntRect bounds(mInitInfo->x, mInitInfo->y, mInitInfo->cx, mInitInfo->cy);
|
||||
LayoutDeviceIntRect bounds(mInitInfo->x, mInitInfo->y,
|
||||
mInitInfo->cx, mInitInfo->cy);
|
||||
|
||||
mInternalWidget->SetWidgetListener(this);
|
||||
mInternalWidget->Create(nullptr, mParentNativeWindow, bounds, &widgetInit);
|
||||
|
@ -55,10 +55,10 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
NS_IMETHOD Create(nsIWidget* aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const IntRect &aRect,
|
||||
nsWidgetInitData *aInitData = nullptr) override { return NS_OK; }
|
||||
const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData = nullptr) override { return NS_OK; }
|
||||
NS_IMETHOD Show(bool aState) override { return NS_OK; }
|
||||
virtual bool IsVisible() const override { return true; }
|
||||
NS_IMETHOD ConstrainPosition(bool aAllowSlop,
|
||||
|
@ -470,7 +470,7 @@ nsXULPopupManager::PopupMoved(nsIFrame* aFrame, nsIntPoint aPnt)
|
||||
|
||||
// Don't do anything if the popup is already at the specified location. This
|
||||
// prevents recursive calls when a popup is positioned.
|
||||
nsIntRect curDevSize = view->CalcWidgetBounds(eWindowType_popup);
|
||||
LayoutDeviceIntRect curDevSize = view->CalcWidgetBounds(eWindowType_popup);
|
||||
nsIWidget* widget = menuPopupFrame->GetWidget();
|
||||
if (curDevSize.x == aPnt.x && curDevSize.y == aPnt.y &&
|
||||
(!widget || widget->GetClientOffset() ==
|
||||
@ -504,7 +504,7 @@ nsXULPopupManager::PopupResized(nsIFrame* aFrame, LayoutDeviceIntSize aSize)
|
||||
if (!view)
|
||||
return;
|
||||
|
||||
nsIntRect curDevSize = view->CalcWidgetBounds(eWindowType_popup);
|
||||
LayoutDeviceIntRect curDevSize = view->CalcWidgetBounds(eWindowType_popup);
|
||||
// If the size is what we think it is, we have nothing to do.
|
||||
if (curDevSize.width == aSize.width && curDevSize.height == aSize.height)
|
||||
return;
|
||||
|
@ -214,7 +214,7 @@ bool nsView::IsEffectivelyVisible()
|
||||
return true;
|
||||
}
|
||||
|
||||
nsIntRect nsView::CalcWidgetBounds(nsWindowType aType)
|
||||
LayoutDeviceIntRect nsView::CalcWidgetBounds(nsWindowType aType)
|
||||
{
|
||||
int32_t p2a = mViewManager->AppUnitsPerDevPixel();
|
||||
|
||||
@ -238,7 +238,8 @@ nsIntRect nsView::CalcWidgetBounds(nsWindowType aType)
|
||||
}
|
||||
|
||||
// Compute widget bounds in device pixels
|
||||
nsIntRect newBounds = viewBounds.ToNearestPixels(p2a);
|
||||
LayoutDeviceIntRect newBounds =
|
||||
LayoutDeviceIntRect::FromUnknownRect(viewBounds.ToNearestPixels(p2a));
|
||||
|
||||
#if defined(XP_MACOSX) || (MOZ_WIDGET_GTK == 3)
|
||||
// cocoa and GTK round widget coordinates to the nearest global "display
|
||||
@ -248,7 +249,7 @@ nsIntRect nsView::CalcWidgetBounds(nsWindowType aType)
|
||||
uint32_t round;
|
||||
if (aType == eWindowType_popup && widget &&
|
||||
((round = widget->RoundsWidgetCoordinatesTo()) > 1)) {
|
||||
nsIntSize pixelRoundedSize = newBounds.Size();
|
||||
LayoutDeviceIntSize pixelRoundedSize = newBounds.Size();
|
||||
// round the top left and bottom right to the nearest round pixel
|
||||
newBounds.x = NSToIntRoundUp(NSAppUnitsToDoublePixels(viewBounds.x, p2a) / round) * round;
|
||||
newBounds.y = NSToIntRoundUp(NSAppUnitsToDoublePixels(viewBounds.y, p2a) / round) * round;
|
||||
@ -312,7 +313,7 @@ void nsView::DoResetWidgetBounds(bool aMoveOnly,
|
||||
if (invisiblePopup) {
|
||||
// We're going to hit the early exit below, avoid calling CalcWidgetBounds.
|
||||
} else {
|
||||
newBounds = LayoutDeviceIntRect::FromUnknownRect(CalcWidgetBounds(type));
|
||||
newBounds = CalcWidgetBounds(type);
|
||||
}
|
||||
|
||||
bool curVisibility = widget->IsVisible();
|
||||
@ -575,7 +576,7 @@ nsresult nsView::CreateWidget(nsWidgetInitData *aWidgetInitData,
|
||||
(!initDataPassedIn && GetParent() &&
|
||||
GetParent()->GetViewManager() != mViewManager);
|
||||
|
||||
nsIntRect trect = CalcWidgetBounds(aWidgetInitData->mWindowType);
|
||||
LayoutDeviceIntRect trect = CalcWidgetBounds(aWidgetInitData->mWindowType);
|
||||
|
||||
nsIWidget* parentWidget =
|
||||
GetParent() ? GetParent()->GetNearestWidget(nullptr) : nullptr;
|
||||
@ -610,7 +611,7 @@ nsresult nsView::CreateWidgetForParent(nsIWidget* aParentWidget,
|
||||
DefaultWidgetInitData defaultInitData;
|
||||
aWidgetInitData = aWidgetInitData ? aWidgetInitData : &defaultInitData;
|
||||
|
||||
nsIntRect trect = CalcWidgetBounds(aWidgetInitData->mWindowType);
|
||||
LayoutDeviceIntRect trect = CalcWidgetBounds(aWidgetInitData->mWindowType);
|
||||
|
||||
mWindow = aParentWidget->CreateChild(trect, aWidgetInitData);
|
||||
if (!mWindow) {
|
||||
@ -632,7 +633,7 @@ nsresult nsView::CreateWidgetForPopup(nsWidgetInitData *aWidgetInitData,
|
||||
MOZ_ASSERT(aWidgetInitData->mWindowType == eWindowType_popup,
|
||||
"Use one of the other CreateWidget methods");
|
||||
|
||||
nsIntRect trect = CalcWidgetBounds(aWidgetInitData->mWindowType);
|
||||
LayoutDeviceIntRect trect = CalcWidgetBounds(aWidgetInitData->mWindowType);
|
||||
|
||||
// XXX/cjones: having these two separate creation cases seems ... um
|
||||
// ... unnecessary, but it's the way the old code did it. Please
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsWidgetInitData.h" // for nsWindowType
|
||||
#include "nsIWidgetListener.h"
|
||||
#include "Units.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
|
||||
class nsViewManager;
|
||||
@ -57,6 +58,8 @@ class nsView final : public nsIWidgetListener
|
||||
public:
|
||||
friend class nsViewManager;
|
||||
|
||||
typedef mozilla::LayoutDeviceIntRect LayoutDeviceIntRect;
|
||||
|
||||
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
|
||||
|
||||
/**
|
||||
@ -326,7 +329,7 @@ public:
|
||||
*/
|
||||
bool IsRoot() const;
|
||||
|
||||
nsIntRect CalcWidgetBounds(nsWindowType aType);
|
||||
LayoutDeviceIntRect CalcWidgetBounds(nsWindowType aType);
|
||||
|
||||
// This is an app unit offset to add when converting view coordinates to
|
||||
// widget coordinates. It is the offset in view coordinates from widget
|
||||
|
@ -47,9 +47,9 @@ PluginWidgetProxy::~PluginWidgetProxy()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PluginWidgetProxy::Create(nsIWidget* aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const nsIntRect& aRect,
|
||||
PluginWidgetProxy::Create(nsIWidget* aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData)
|
||||
{
|
||||
ENSURE_CHANNEL;
|
||||
@ -64,7 +64,7 @@ PluginWidgetProxy::Create(nsIWidget* aParent,
|
||||
|
||||
BaseCreate(aParent, aRect, aInitData);
|
||||
|
||||
mBounds = aRect;
|
||||
mBounds = aRect.ToUnknownRect();
|
||||
mEnabled = true;
|
||||
mVisible = true;
|
||||
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
|
||||
// nsIWidget
|
||||
NS_IMETHOD Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
||||
const nsIntRect& aRect,
|
||||
const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData = nullptr) override;
|
||||
NS_IMETHOD Destroy() override;
|
||||
NS_IMETHOD SetFocus(bool aRaise = false) override;
|
||||
|
@ -98,16 +98,16 @@ PuppetWidget::~PuppetWidget()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PuppetWidget::Create(nsIWidget *aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const nsIntRect &aRect,
|
||||
nsWidgetInitData *aInitData)
|
||||
PuppetWidget::Create(nsIWidget* aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData)
|
||||
{
|
||||
MOZ_ASSERT(!aNativeParent, "got a non-Puppet native parent");
|
||||
|
||||
BaseCreate(nullptr, aRect, aInitData);
|
||||
|
||||
mBounds = aRect;
|
||||
mBounds = aRect.ToUnknownRect();
|
||||
mEnabled = true;
|
||||
mVisible = true;
|
||||
|
||||
@ -146,9 +146,9 @@ PuppetWidget::InitIMEState()
|
||||
}
|
||||
|
||||
already_AddRefed<nsIWidget>
|
||||
PuppetWidget::CreateChild(const nsIntRect &aRect,
|
||||
nsWidgetInitData *aInitData,
|
||||
bool aForceUseIWidgetParent)
|
||||
PuppetWidget::CreateChild(const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData,
|
||||
bool aForceUseIWidgetParent)
|
||||
{
|
||||
bool isPopup = IsPopup(aInitData);
|
||||
nsCOMPtr<nsIWidget> widget = nsIWidget::CreatePuppetWidget(mTabChild);
|
||||
|
@ -53,17 +53,17 @@ protected:
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
NS_IMETHOD Create(nsIWidget* aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const nsIntRect& aRect,
|
||||
NS_IMETHOD Create(nsIWidget* aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData = nullptr) override;
|
||||
|
||||
void InitIMEState();
|
||||
|
||||
virtual already_AddRefed<nsIWidget>
|
||||
CreateChild(const nsIntRect &aRect,
|
||||
nsWidgetInitData *aInitData = nullptr,
|
||||
bool aForceUseIWidgetParent = false) override;
|
||||
CreateChild(const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData = nullptr,
|
||||
bool aForceUseIWidgetParent = false) override;
|
||||
|
||||
NS_IMETHOD Destroy() override;
|
||||
|
||||
|
@ -525,10 +525,10 @@ nsWindow::IsTopLevel()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::Create(nsIWidget *aParent,
|
||||
nsWindow::Create(nsIWidget* aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const nsIntRect &aRect,
|
||||
nsWidgetInitData *aInitData)
|
||||
const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData)
|
||||
{
|
||||
ALOG("nsWindow[%p]::Create %p [%d %d %d %d]", (void*)this, (void*)aParent, aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
nsWindow *parent = (nsWindow*) aParent;
|
||||
@ -540,7 +540,7 @@ nsWindow::Create(nsIWidget *aParent,
|
||||
}
|
||||
}
|
||||
|
||||
mBounds = aRect;
|
||||
mBounds = aRect.ToUnknownRect();
|
||||
|
||||
// for toplevel windows, bounds are fixed to full screen size
|
||||
if (!parent) {
|
||||
@ -550,7 +550,8 @@ nsWindow::Create(nsIWidget *aParent,
|
||||
mBounds.height = gAndroidBounds.height;
|
||||
}
|
||||
|
||||
BaseCreate(nullptr, mBounds, aInitData);
|
||||
BaseCreate(nullptr, LayoutDeviceIntRect::FromUnknownRect(mBounds),
|
||||
aInitData);
|
||||
|
||||
NS_ASSERTION(IsTopLevel() || parent, "non top level windowdoesn't have a parent!");
|
||||
|
||||
|
@ -70,10 +70,10 @@ public:
|
||||
// nsIWidget
|
||||
//
|
||||
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
NS_IMETHOD Create(nsIWidget* aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const nsIntRect &aRect,
|
||||
nsWidgetInitData *aInitData) override;
|
||||
const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData) override;
|
||||
NS_IMETHOD Destroy(void) override;
|
||||
NS_IMETHOD ConfigureChildren(const nsTArray<nsIWidget::Configuration>&) override;
|
||||
NS_IMETHOD SetParent(nsIWidget* aNewParent) override;
|
||||
|
@ -354,10 +354,10 @@ public:
|
||||
nsChildView();
|
||||
|
||||
// nsIWidget interface
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
NS_IMETHOD Create(nsIWidget* aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const nsIntRect &aRect,
|
||||
nsWidgetInitData *aInitData = nullptr) override;
|
||||
const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData = nullptr) override;
|
||||
|
||||
NS_IMETHOD Destroy() override;
|
||||
|
||||
|
@ -465,10 +465,10 @@ nsChildView::ReleaseTitlebarCGContext()
|
||||
}
|
||||
}
|
||||
|
||||
nsresult nsChildView::Create(nsIWidget *aParent,
|
||||
nsresult nsChildView::Create(nsIWidget* aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const nsIntRect &aRect,
|
||||
nsWidgetInitData *aInitData)
|
||||
const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
@ -493,7 +493,7 @@ nsresult nsChildView::Create(nsIWidget *aParent,
|
||||
gChildViewMethodsSwizzled = true;
|
||||
}
|
||||
|
||||
mBounds = aRect;
|
||||
mBounds = aRect.ToUnknownRect();
|
||||
|
||||
// Ensure that the toolkit is created.
|
||||
nsToolkit::GetToolkit();
|
||||
|
@ -246,7 +246,6 @@ typedef struct _nsCocoaWindowList {
|
||||
class nsCocoaWindow : public nsBaseWidget, public nsPIWidgetCocoa
|
||||
{
|
||||
private:
|
||||
|
||||
typedef nsBaseWidget Inherited;
|
||||
|
||||
public:
|
||||
@ -255,11 +254,11 @@ public:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSPIWIDGETCOCOA
|
||||
|
||||
|
||||
NS_IMETHOD Create(nsIWidget* aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const nsIntRect &aRect,
|
||||
nsWidgetInitData *aInitData = nullptr) override;
|
||||
const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData = nullptr) override;
|
||||
|
||||
NS_IMETHOD Destroy() override;
|
||||
|
||||
@ -393,7 +392,7 @@ protected:
|
||||
nsresult CreateNativeWindow(const NSRect &aRect,
|
||||
nsBorderStyle aBorderStyle,
|
||||
bool aRectIsFrameRect);
|
||||
nsresult CreatePopupContentView(const nsIntRect &aRect);
|
||||
nsresult CreatePopupContentView(const LayoutDeviceIntRect &aRect);
|
||||
void DestroyNativeWindow();
|
||||
void AdjustWindowShadow();
|
||||
void SetWindowBackgroundBlur();
|
||||
|
@ -182,13 +182,16 @@ nsCocoaWindow::~nsCocoaWindow()
|
||||
|
||||
// Find the screen that overlaps aRect the most,
|
||||
// if none are found default to the mainScreen.
|
||||
static NSScreen *FindTargetScreenForRect(const nsIntRect& aRect)
|
||||
static NSScreen*
|
||||
FindTargetScreenForRect(const LayoutDeviceIntRect& aRect)
|
||||
{
|
||||
NSScreen *targetScreen = [NSScreen mainScreen];
|
||||
NSEnumerator *screenEnum = [[NSScreen screens] objectEnumerator];
|
||||
int largestIntersectArea = 0;
|
||||
while (NSScreen *screen = [screenEnum nextObject]) {
|
||||
nsIntRect screenRect(nsCocoaUtils::CocoaRectToGeckoRect([screen visibleFrame]));
|
||||
LayoutDeviceIntRect screenRect =
|
||||
LayoutDeviceIntRect::FromUnknownRect(
|
||||
nsCocoaUtils::CocoaRectToGeckoRect([screen visibleFrame]));
|
||||
screenRect = screenRect.Intersect(aRect);
|
||||
int area = screenRect.width * screenRect.height;
|
||||
if (area > largestIntersectArea) {
|
||||
@ -202,7 +205,8 @@ static NSScreen *FindTargetScreenForRect(const nsIntRect& aRect)
|
||||
// fits the rect to the screen that contains the largest area of it,
|
||||
// or to aScreen if a screen is passed in
|
||||
// NB: this operates with aRect in global display pixels
|
||||
static void FitRectToVisibleAreaForScreen(nsIntRect &aRect, NSScreen *aScreen)
|
||||
static void
|
||||
FitRectToVisibleAreaForScreen(LayoutDeviceIntRect& aRect, NSScreen* aScreen)
|
||||
{
|
||||
if (!aScreen) {
|
||||
aScreen = FindTargetScreenForRect(aRect);
|
||||
@ -246,10 +250,10 @@ static bool UseNativePopupWindows()
|
||||
}
|
||||
|
||||
// aRect here is specified in global display pixels
|
||||
nsresult nsCocoaWindow::Create(nsIWidget *aParent,
|
||||
nsresult nsCocoaWindow::Create(nsIWidget* aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const nsIntRect &aRect,
|
||||
nsWidgetInitData *aInitData)
|
||||
const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
@ -257,7 +261,7 @@ nsresult nsCocoaWindow::Create(nsIWidget *aParent,
|
||||
// we have to provide an autorelease pool (see bug 559075).
|
||||
nsAutoreleasePool localPool;
|
||||
|
||||
nsIntRect newBounds = aRect;
|
||||
LayoutDeviceIntRect newBounds = aRect;
|
||||
FitRectToVisibleAreaForScreen(newBounds, nullptr);
|
||||
|
||||
// Set defaults which can be overriden from aInitData in BaseCreate
|
||||
@ -281,7 +285,7 @@ nsresult nsCocoaWindow::Create(nsIWidget *aParent,
|
||||
return NS_OK;
|
||||
|
||||
nsresult rv =
|
||||
CreateNativeWindow(nsCocoaUtils::GeckoRectToCocoaRect(newBounds),
|
||||
CreateNativeWindow(nsCocoaUtils::GeckoRectToCocoaRect(newBounds.ToUnknownRect()),
|
||||
mBorderStyle, false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -481,7 +485,8 @@ nsresult nsCocoaWindow::CreateNativeWindow(const NSRect &aRect,
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCocoaWindow::CreatePopupContentView(const nsIntRect &aRect)
|
||||
NS_IMETHODIMP
|
||||
nsCocoaWindow::CreatePopupContentView(const LayoutDeviceIntRect &aRect)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
@ -1520,16 +1525,17 @@ nsresult nsCocoaWindow::DoResize(double aX, double aY,
|
||||
int32_t height = NSToIntRound(aHeight * scale);
|
||||
ConstrainSize(&width, &height);
|
||||
|
||||
nsIntRect newBounds(NSToIntRound(aX), NSToIntRound(aY),
|
||||
NSToIntRound(width / scale),
|
||||
NSToIntRound(height / scale));
|
||||
LayoutDeviceIntRect newBounds(NSToIntRound(aX), NSToIntRound(aY),
|
||||
NSToIntRound(width / scale),
|
||||
NSToIntRound(height / scale));
|
||||
|
||||
// constrain to the screen that contains the largest area of the new rect
|
||||
FitRectToVisibleAreaForScreen(newBounds, aConstrainToCurrentScreen ?
|
||||
[mWindow screen] : nullptr);
|
||||
|
||||
// convert requested bounds into Cocoa coordinate system
|
||||
NSRect newFrame = nsCocoaUtils::GeckoRectToCocoaRect(newBounds);
|
||||
NSRect newFrame =
|
||||
nsCocoaUtils::GeckoRectToCocoaRect(newBounds.ToUnknownRect());
|
||||
|
||||
NSRect frame = [mWindow frame];
|
||||
BOOL isMoving = newFrame.origin.x != frame.origin.x ||
|
||||
@ -1665,7 +1671,8 @@ GetBackingScaleFactor(NSWindow* aWindow)
|
||||
|
||||
// Then identify the screen it belongs to, and return its scale factor.
|
||||
NSScreen *screen =
|
||||
FindTargetScreenForRect(nsCocoaUtils::CocoaRectToGeckoRect(frame));
|
||||
FindTargetScreenForRect(
|
||||
LayoutDeviceIntRect::FromUnknownRect(nsCocoaUtils::CocoaRectToGeckoRect(frame)));
|
||||
return nsCocoaUtils::GetBackingScaleFactor(screen);
|
||||
}
|
||||
|
||||
|
@ -481,7 +481,7 @@ nsScreenGonk::EnableMirroring()
|
||||
nsWidgetInitData initData;
|
||||
initData.mScreenId = mId;
|
||||
RefPtr<nsWindow> window = new nsWindow();
|
||||
window->Create(nullptr, nullptr, mNaturalBounds.ToUnknownRect(), &initData);
|
||||
window->Create(nullptr, nullptr, mNaturalBounds, &initData);
|
||||
MOZ_ASSERT(static_cast<nsWindow*>(window)->GetScreen() == this);
|
||||
|
||||
// Update mMirroringWidget on compositor thread
|
||||
|
@ -330,10 +330,10 @@ nsWindow::SynthesizeNativeTouchPoint(uint32_t aPointerId,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::Create(nsIWidget *aParent,
|
||||
void *aNativeParent,
|
||||
const nsIntRect &aRect,
|
||||
nsWidgetInitData *aInitData)
|
||||
nsWindow::Create(nsIWidget* aParent,
|
||||
void* aNativeParent,
|
||||
const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData)
|
||||
{
|
||||
BaseCreate(aParent, aRect, aInitData);
|
||||
|
||||
@ -347,7 +347,7 @@ nsWindow::Create(nsIWidget *aParent,
|
||||
|
||||
mScreen = static_cast<nsScreenGonk*>(screen.get());
|
||||
|
||||
mBounds = aRect;
|
||||
mBounds = aRect.ToUnknownRect();
|
||||
|
||||
mParent = (nsWindow *)aParent;
|
||||
mVisible = false;
|
||||
|
@ -46,10 +46,10 @@ public:
|
||||
static nsEventStatus DispatchKeyInput(mozilla::WidgetKeyboardEvent& aEvent);
|
||||
static void DispatchTouchInput(mozilla::MultiTouchInput& aInput);
|
||||
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
void *aNativeParent,
|
||||
const nsIntRect &aRect,
|
||||
nsWidgetInitData *aInitData);
|
||||
NS_IMETHOD Create(nsIWidget* aParent,
|
||||
void* aNativeParent,
|
||||
const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData);
|
||||
NS_IMETHOD Destroy(void);
|
||||
|
||||
NS_IMETHOD Show(bool aState);
|
||||
|
@ -3498,10 +3498,10 @@ CreateGdkWindow(GdkWindow *parent, GtkWidget *widget)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsWindow::Create(nsIWidget *aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const nsIntRect &aRect,
|
||||
nsWidgetInitData *aInitData)
|
||||
nsWindow::Create(nsIWidget* aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData)
|
||||
{
|
||||
// only set the base parent if we're going to be a dialog or a
|
||||
// toplevel
|
||||
@ -3531,7 +3531,7 @@ nsWindow::Create(nsIWidget *aParent,
|
||||
CommonCreate(aParent, listenForResizes);
|
||||
|
||||
// save our bounds
|
||||
mBounds = aRect;
|
||||
mBounds = aRect.ToUnknownRect();
|
||||
ConstrainSize(&mBounds.width, &mBounds.height);
|
||||
|
||||
// figure out our parent window
|
||||
|
@ -95,10 +95,10 @@ public:
|
||||
bool AreBoundsSane(void);
|
||||
|
||||
// nsIWidget
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const nsIntRect &aRect,
|
||||
nsWidgetInitData *aInitData) override;
|
||||
NS_IMETHOD Create(nsIWidget* aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData) override;
|
||||
NS_IMETHOD Destroy(void) override;
|
||||
virtual nsIWidget *GetParent() override;
|
||||
virtual float GetDPI() override;
|
||||
|
@ -308,9 +308,9 @@ nsBaseWidget::~nsBaseWidget()
|
||||
// Basic create.
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
void nsBaseWidget::BaseCreate(nsIWidget *aParent,
|
||||
const nsIntRect &aRect,
|
||||
nsWidgetInitData *aInitData)
|
||||
void nsBaseWidget::BaseCreate(nsIWidget* aParent,
|
||||
const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData)
|
||||
{
|
||||
static bool gDisableNativeThemeCached = false;
|
||||
if (!gDisableNativeThemeCached) {
|
||||
@ -355,9 +355,9 @@ void nsBaseWidget::SetWidgetListener(nsIWidgetListener* aWidgetListener)
|
||||
}
|
||||
|
||||
already_AddRefed<nsIWidget>
|
||||
nsBaseWidget::CreateChild(const nsIntRect &aRect,
|
||||
nsWidgetInitData *aInitData,
|
||||
bool aForceUseIWidgetParent)
|
||||
nsBaseWidget::CreateChild(const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData,
|
||||
bool aForceUseIWidgetParent)
|
||||
{
|
||||
nsIWidget* parent = this;
|
||||
nsNativeWidget nativeParent = nullptr;
|
||||
|
@ -231,9 +231,9 @@ public:
|
||||
double& aOverriddenDeltaX,
|
||||
double& aOverriddenDeltaY) override;
|
||||
virtual already_AddRefed<nsIWidget>
|
||||
CreateChild(const nsIntRect &aRect,
|
||||
nsWidgetInitData *aInitData = nullptr,
|
||||
bool aForceUseIWidgetParent = false) override;
|
||||
CreateChild(const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData = nullptr,
|
||||
bool aForceUseIWidgetParent = false) override;
|
||||
NS_IMETHOD AttachViewToTopLevel(bool aUseAttachedEvents) override;
|
||||
virtual nsIWidgetListener* GetAttachedWidgetListener() override;
|
||||
virtual void SetAttachedWidgetListener(nsIWidgetListener* aListener) override;
|
||||
@ -350,8 +350,8 @@ protected:
|
||||
nsIFile **aResult);
|
||||
virtual void OnDestroy();
|
||||
void BaseCreate(nsIWidget *aParent,
|
||||
const nsIntRect &aRect,
|
||||
nsWidgetInitData *aInitData);
|
||||
const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData);
|
||||
|
||||
virtual void ConfigureAPZCTreeManager();
|
||||
virtual void ConfigureAPZControllerThread();
|
||||
|
@ -395,10 +395,10 @@ class nsIWidget : public nsISupports {
|
||||
* @param aInitData data that is used for widget initialization
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const nsIntRect &aRect,
|
||||
nsWidgetInitData *aInitData = nullptr) = 0;
|
||||
NS_IMETHOD Create(nsIWidget* aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData = nullptr) = 0;
|
||||
|
||||
/**
|
||||
* Allocate, initialize, and return a widget that is a child of
|
||||
@ -417,9 +417,9 @@ class nsIWidget : public nsISupports {
|
||||
* understood code, and shouldn't be used in new code.
|
||||
*/
|
||||
virtual already_AddRefed<nsIWidget>
|
||||
CreateChild(const nsIntRect &aRect,
|
||||
nsWidgetInitData *aInitData = nullptr,
|
||||
bool aForceUseIWidgetParent = false) = 0;
|
||||
CreateChild(const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData = nullptr,
|
||||
bool aForceUseIWidgetParent = false) = 0;
|
||||
|
||||
/**
|
||||
* Attach to a top level widget.
|
||||
|
@ -133,10 +133,10 @@ nsWindow::~nsWindow()
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsWindow::Create(nsIWidget *aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const nsIntRect &aRect,
|
||||
nsWidgetInitData *aInitData)
|
||||
nsWindow::Create(nsIWidget* aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData)
|
||||
{
|
||||
// only set the base parent if we're not going to be a dialog or a
|
||||
// toplevel
|
||||
@ -151,7 +151,7 @@ nsWindow::Create(nsIWidget *aParent,
|
||||
mParent = (nsWindow *)aParent;
|
||||
|
||||
// save our bounds
|
||||
mBounds = aRect;
|
||||
mBounds = aRect.ToUnknownRect();
|
||||
|
||||
// find native parent
|
||||
MozQWidget *parent = nullptr;
|
||||
|
@ -84,10 +84,10 @@ public:
|
||||
//
|
||||
// nsIWidget
|
||||
//
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const nsIntRect &aRect,
|
||||
nsWidgetInitData *aInitData);
|
||||
NS_IMETHOD Create(nsIWidget* aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData);
|
||||
NS_IMETHOD Destroy(void);
|
||||
|
||||
NS_IMETHOD Show(bool aState);
|
||||
|
@ -30,10 +30,10 @@ public:
|
||||
// nsIWidget
|
||||
//
|
||||
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
NS_IMETHOD Create(nsIWidget* aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const nsIntRect &aRect,
|
||||
nsWidgetInitData *aInitData = nullptr) override;
|
||||
const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData = nullptr) override;
|
||||
NS_IMETHOD Destroy() override;
|
||||
NS_IMETHOD Show(bool aState) override;
|
||||
NS_IMETHOD Enable(bool aState) override {
|
||||
|
@ -466,10 +466,10 @@ nsWindow::IsTopLevel()
|
||||
//
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::Create(nsIWidget *aParent,
|
||||
nsWindow::Create(nsIWidget* aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const nsIntRect &aRect,
|
||||
nsWidgetInitData *aInitData)
|
||||
const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData)
|
||||
{
|
||||
ALOG("nsWindow[%p]::Create %p/%p [%d %d %d %d]", (void*)this, (void*)aParent, (void*)aNativeParent, aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
nsWindow* parent = (nsWindow*) aParent;
|
||||
@ -484,17 +484,15 @@ nsWindow::Create(nsIWidget *aParent,
|
||||
if (parent == nullptr) {
|
||||
if (nsAppShell::gWindow == nil) {
|
||||
mBounds = UIKitScreenManager::GetBounds();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
CGRect cgRect = [nsAppShell::gWindow bounds];
|
||||
mBounds.x = cgRect.origin.x;
|
||||
mBounds.y = cgRect.origin.y;
|
||||
mBounds.width = cgRect.size.width;
|
||||
mBounds.height = cgRect.size.height;
|
||||
}
|
||||
}
|
||||
else {
|
||||
mBounds = aRect;
|
||||
} else {
|
||||
mBounds = aRect.ToUnknownRect();
|
||||
}
|
||||
|
||||
ALOG("nsWindow[%p]::Create bounds: %d %d %d %d", (void*)this,
|
||||
@ -504,7 +502,9 @@ nsWindow::Create(nsIWidget *aParent,
|
||||
mWindowType = eWindowType_toplevel;
|
||||
mBorderStyle = eBorderStyle_default;
|
||||
|
||||
Inherited::BaseCreate(aParent, mBounds, aInitData);
|
||||
Inherited::BaseCreate(aParent,
|
||||
LayoutDeviceIntRect::FromUnknownRect(mBounds),
|
||||
aInitData);
|
||||
|
||||
NS_ASSERTION(IsTopLevel() || parent, "non top level window doesn't have a parent!");
|
||||
|
||||
|
@ -490,10 +490,10 @@ ShouldCacheTitleBarInfo(nsWindowType aWindowType, nsBorderStyle aBorderStyle)
|
||||
|
||||
// Create the proper widget
|
||||
nsresult
|
||||
nsWindow::Create(nsIWidget *aParent,
|
||||
nsWindow::Create(nsIWidget* aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const nsIntRect &aRect,
|
||||
nsWidgetInitData *aInitData)
|
||||
const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData)
|
||||
{
|
||||
nsWidgetInitData defaultInitData;
|
||||
if (!aInitData)
|
||||
@ -507,7 +507,7 @@ nsWindow::Create(nsIWidget *aParent,
|
||||
nullptr : aParent;
|
||||
|
||||
mIsTopWidgetWindow = (nullptr == baseParent);
|
||||
mBounds = aRect;
|
||||
mBounds = aRect.ToUnknownRect();
|
||||
|
||||
// Ensure that the toolkit is created.
|
||||
nsToolkit::GetToolkit();
|
||||
|
@ -92,10 +92,10 @@ public:
|
||||
using nsWindowBase::DispatchPluginEvent;
|
||||
|
||||
// nsIWidget interface
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
NS_IMETHOD Create(nsIWidget* aParent,
|
||||
nsNativeWidget aNativeParent,
|
||||
const nsIntRect &aRect,
|
||||
nsWidgetInitData *aInitData = nullptr);
|
||||
const LayoutDeviceIntRect& aRect,
|
||||
nsWidgetInitData* aInitData = nullptr);
|
||||
NS_IMETHOD Destroy();
|
||||
NS_IMETHOD SetParent(nsIWidget *aNewParent);
|
||||
virtual nsIWidget* GetParent(void);
|
||||
|
@ -474,8 +474,7 @@ nsAppShellService::CreateWindowlessBrowser(bool aIsChrome, nsIWebNavigation **aR
|
||||
NS_ERROR("Couldn't create instance of PuppetWidget");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
widget->Create(nullptr, 0, gfx::IntRect(gfx::IntPoint(0, 0), gfx::IntSize(0, 0)),
|
||||
nullptr);
|
||||
widget->Create(nullptr, 0, LayoutDeviceIntRect(0, 0, 0, 0), nullptr);
|
||||
nsCOMPtr<nsIBaseWindow> window = do_QueryInterface(navigation);
|
||||
window->InitWindow(0, widget, 0, 0, 0, 0);
|
||||
window->Create();
|
||||
|
@ -173,7 +173,7 @@ nsresult nsWebShellWindow::Initialize(nsIXULWindow* aParent,
|
||||
mWindow->SetWidgetListener(this);
|
||||
mWindow->Create((nsIWidget *)parentWidget, // Parent nsIWidget
|
||||
nullptr, // Native parent widget
|
||||
r.ToUnknownRect(), // Widget dimensions
|
||||
r, // Widget dimensions
|
||||
&widgetInitData); // Widget initialization data
|
||||
mWindow->GetClientBounds(r);
|
||||
// Match the default background color of content. Important on windows
|
||||
|
Loading…
Reference in New Issue
Block a user