Bug 1293596 (part 2) - Rework nsIWidget bounds getters. r=mstange.

This patch makes GetBounds(), GetScreenBounds() and GetClientBounds() more
obviously infallible, like existing functions such as GetNaturalBounds() and
GetClientSize(). This results in clearer behaviour in nsCocoaWindow.mm if
Objective C exceptions occur. Along the way, the patch removes some useless
failure checks for these functions.

The patch also removes the NS_IMETHOD from GetRestoredBounds and makes that
function MOZ_MUST_USE.
This commit is contained in:
Nicholas Nethercote 2016-08-19 09:03:04 +10:00
Родитель 8e6f32c5b4
Коммит 67af4817e9
40 изменённых файлов: 242 добавлений и 314 удалений

Просмотреть файл

@ -525,8 +525,7 @@ Accessible::ChildAtPoint(int32_t aX, int32_t aY,
nsIWidget* rootWidget = rootFrame->GetView()->GetNearestWidget(nullptr);
NS_ENSURE_TRUE(rootWidget, nullptr);
LayoutDeviceIntRect rootRect;
rootWidget->GetScreenBounds(rootRect);
LayoutDeviceIntRect rootRect = rootWidget->GetScreenBounds();
WidgetMouseEvent dummyEvent(true, eMouseMove, rootWidget,
WidgetMouseEvent::eSynthesized);

Просмотреть файл

@ -5939,8 +5939,7 @@ nsDocShell::GetPositionAndSize(int32_t* aX, int32_t* aY, int32_t* aWidth,
{
if (mParentWidget) {
// ensure size is up-to-date if window has changed resolution
LayoutDeviceIntRect r;
mParentWidget->GetClientBounds(r);
LayoutDeviceIntRect r = mParentWidget->GetClientBounds();
SetPositionAndSize(mBounds.x, mBounds.y, r.width, r.height, 0);
}

Просмотреть файл

@ -2041,9 +2041,7 @@ nsDOMWindowUtils::SendQueryContentEvent(uint32_t aType,
nsIFrame* popupFrame =
nsLayoutUtils::GetPopupFrameForEventCoordinates(presContext->GetRootPresContext(), &dummyEvent);
LayoutDeviceIntRect widgetBounds;
nsresult rv = widget->GetClientBounds(widgetBounds);
NS_ENSURE_SUCCESS(rv, rv);
LayoutDeviceIntRect widgetBounds = widget->GetClientBounds();
widgetBounds.MoveTo(0, 0);
// There is no popup frame at the point and the point isn't in our widget,

Просмотреть файл

@ -13827,11 +13827,7 @@ nsGlobalWindow::NotifyDefaultButtonLoaded(Element& aDefaultButton,
aError.Throw(NS_ERROR_FAILURE);
return;
}
LayoutDeviceIntRect widgetRect;
aError = widget->GetScreenBounds(widgetRect);
if (aError.Failed()) {
return;
}
LayoutDeviceIntRect widgetRect = widget->GetScreenBounds();
// Convert the buttonRect coordinates from screen to the widget.
buttonRect -= widgetRect.TopLeft();

Просмотреть файл

@ -4157,8 +4157,7 @@ GetWindowClientRectCenter(nsIWidget* aWidget)
{
NS_ENSURE_TRUE(aWidget, LayoutDeviceIntPoint(0, 0));
LayoutDeviceIntRect rect;
aWidget->GetClientBounds(rect);
LayoutDeviceIntRect rect = aWidget->GetClientBounds();
LayoutDeviceIntPoint point(rect.x + rect.width / 2,
rect.y + rect.height / 2);
int32_t round = aWidget->RoundsWidgetCoordinatesTo();

Просмотреть файл

@ -1079,8 +1079,7 @@ NPBool nsPluginInstanceOwner::ConvertPointPuppet(PuppetWidget *widget,
nsPoint windowPosition = AsNsPoint(rootWidget->GetWindowPosition()) / scaleFactor;
// Window size is tab size + chrome size.
LayoutDeviceIntRect tabContentBounds;
NS_ENSURE_SUCCESS(puppetWidget->GetBounds(tabContentBounds), false);
LayoutDeviceIntRect tabContentBounds = puppetWidget->GetBounds();
tabContentBounds.ScaleInverseRoundOut(scaleFactor);
int32_t windowH = tabContentBounds.height + int(chromeSize.y);
@ -1186,8 +1185,7 @@ NPBool nsPluginInstanceOwner::ConvertPointNoPuppet(nsIWidget *widget,
screen->GetRect(&screenX, &screenY, &screenWidth, &screenHeight);
screenHeight /= scaleFactor;
LayoutDeviceIntRect windowScreenBounds;
NS_ENSURE_SUCCESS(widget->GetScreenBounds(windowScreenBounds), false);
LayoutDeviceIntRect windowScreenBounds = widget->GetScreenBounds();
windowScreenBounds.ScaleInverseRoundOut(scaleFactor);
int32_t windowX = windowScreenBounds.x;
int32_t windowY = windowScreenBounds.y;

Просмотреть файл

@ -1406,8 +1406,7 @@ nsWebBrowser::GetPositionAndSize(int32_t* aX, int32_t* aY,
*aCY = mInitInfo->cy;
}
} else if (mInternalWidget) {
LayoutDeviceIntRect bounds;
NS_ENSURE_SUCCESS(mInternalWidget->GetBounds(bounds), NS_ERROR_FAILURE);
LayoutDeviceIntRect bounds = mInternalWidget->GetBounds();
if (aX) {
*aX = bounds.x;

Просмотреть файл

@ -520,8 +520,7 @@ ClientLayerManager::MakeSnapshotIfRequired()
// The compositor doesn't draw to a different sized surface
// when there's a rotation. Instead we rotate the result
// when drawing into dt
LayoutDeviceIntRect outerBounds;
mWidget->GetBounds(outerBounds);
LayoutDeviceIntRect outerBounds = mWidget->GetBounds();
IntRect bounds = ToOutsideIntRect(mShadowTarget->GetClipExtents());
if (mTargetRotation) {

Просмотреть файл

@ -36,12 +36,11 @@ public:
NS_DECL_ISUPPORTS_INHERITED
NS_IMETHOD GetClientBounds(LayoutDeviceIntRect& aRect) override {
aRect = LayoutDeviceIntRect(0, 0, gCompWidth, gCompHeight);
return NS_OK;
virtual LayoutDeviceIntRect GetClientBounds() override {
return LayoutDeviceIntRect(0, 0, gCompWidth, gCompHeight);
}
NS_IMETHOD GetBounds(LayoutDeviceIntRect& aRect) override {
return GetClientBounds(aRect);
virtual LayoutDeviceIntRect GetBounds() override {
return GetClientBounds();
}
void* GetNativeData(uint32_t aDataType) override {

Просмотреть файл

@ -2991,8 +2991,7 @@ static LayoutDeviceIntPoint GetWidgetOffset(nsIWidget* aWidget, nsIWidget*& aRoo
if (!parent) {
break;
}
LayoutDeviceIntRect bounds;
aWidget->GetBounds(bounds);
LayoutDeviceIntRect bounds = aWidget->GetBounds();
offset += bounds.TopLeft();
aWidget = parent;
}
@ -8319,8 +8318,7 @@ UpdateCompositionBoundsForRCDRSF(ParentLayerRect& aCompBounds,
#endif
if (widget) {
LayoutDeviceIntRect widgetBounds;
widget->GetBounds(widgetBounds);
LayoutDeviceIntRect widgetBounds = widget->GetBounds();
widgetBounds.MoveTo(0, 0);
aCompBounds = ParentLayerRect(
ViewAs<ParentLayerPixel>(
@ -8442,8 +8440,7 @@ nsLayoutUtils::CalculateRootCompositionSize(nsIFrame* aFrame,
}
} else {
nsIWidget* widget = aFrame->GetNearestWidget();
LayoutDeviceIntRect widgetBounds;
widget->GetBounds(widgetBounds);
LayoutDeviceIntRect widgetBounds = widget->GetBounds();
rootCompositionSize = ScreenSize(
ViewAs<ScreenPixel>(widgetBounds.Size(),
PixelCastJustification::LayoutDeviceIsScreenForBounds));

Просмотреть файл

@ -2968,8 +2968,7 @@ SortConfigurations(nsTArray<nsIWidget::Configuration>* aConfigurations)
for (uint32_t j = 0; j < pluginsToMove.Length(); ++j) {
if (i == j)
continue;
LayoutDeviceIntRect bounds;
pluginsToMove[j].mChild->GetBounds(bounds);
LayoutDeviceIntRect bounds = pluginsToMove[j].mChild->GetBounds();
AutoTArray<LayoutDeviceIntRect,1> clipRects;
pluginsToMove[j].mChild->GetWindowClipRegion(&clipRects);
if (HasOverlap(bounds.TopLeft(), clipRects,

Просмотреть файл

@ -10254,8 +10254,8 @@ CompareTrees(nsPresContext* aFirstPresContext, nsIFrame* aFirstFrame,
LogVerifyMessage(k1, k2, "child widgets are not matched\n");
}
else if (nullptr != w1) {
w1->GetBounds(r1);
w2->GetBounds(r2);
r1 = w1->GetBounds();
r2 = w2->GetBounds();
if (!r1.IsEqualEdges(r2)) {
LogVerifyMessage(k1, k2, "(widget rects)",
r1.ToUnknownRect(), r2.ToUnknownRect());

Просмотреть файл

@ -5387,10 +5387,8 @@ nsIFrame::GetTransformMatrix(const nsIFrame* aStopAtAncestor,
if (widget && rootPresContext) {
nsIWidget* toplevel = rootPresContext->GetNearestWidget();
if (toplevel) {
LayoutDeviceIntRect screenBounds;
widget->GetClientBounds(screenBounds);
LayoutDeviceIntRect toplevelScreenBounds;
toplevel->GetClientBounds(toplevelScreenBounds);
LayoutDeviceIntRect screenBounds = widget->GetClientBounds();
LayoutDeviceIntRect toplevelScreenBounds = toplevel->GetClientBounds();
LayoutDeviceIntPoint translation =
screenBounds.TopLeft() - toplevelScreenBounds.TopLeft();

Просмотреть файл

@ -283,8 +283,7 @@ PopupBoxObject::GetOuterScreenRect()
if (view) {
nsIWidget* widget = view->GetWidget();
if (widget) {
LayoutDeviceIntRect screenRect;
widget->GetScreenBounds(screenRect);
LayoutDeviceIntRect screenRect = widget->GetScreenBounds();
int32_t pp = menuPopupFrame->PresContext()->AppUnitsPerDevPixel();
rect->SetLayoutRect(LayoutDeviceIntRect::ToAppUnits(screenRect, pp));

Просмотреть файл

@ -251,7 +251,7 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
if (menuPopupFrame) {
nsCOMPtr<nsIWidget> widget = menuPopupFrame->GetWidget();
if (widget)
widget->GetScreenBounds(oldRect);
oldRect = widget->GetScreenBounds();
// convert the new rectangle into outer window coordinates
LayoutDeviceIntPoint clientOffset = widget->GetClientOffset();

Просмотреть файл

@ -125,8 +125,7 @@ nsTitleBarFrame::HandleEvent(nsPresContext* aPresContext,
if (parent) {
nsMenuPopupFrame* menuPopupFrame = static_cast<nsMenuPopupFrame*>(parent);
nsCOMPtr<nsIWidget> widget = menuPopupFrame->GetWidget();
LayoutDeviceIntRect bounds;
widget->GetScreenBounds(bounds);
LayoutDeviceIntRect bounds = widget->GetScreenBounds();
CSSPoint cssPos = (bounds.TopLeft() + nsMoveBy)
/ aPresContext->CSSToDevPixelScale();

Просмотреть файл

@ -304,8 +304,7 @@ void nsView::DoResetWidgetBounds(bool aMoveOnly,
nsWindowType type = widget->WindowType();
LayoutDeviceIntRect curBounds;
widget->GetClientBounds(curBounds);
LayoutDeviceIntRect curBounds = widget->GetClientBounds();
bool invisiblePopup = type == eWindowType_popup &&
((curBounds.IsEmpty() && mDimBounds.IsEmpty()) ||
mVis == nsViewVisibility_kHide);
@ -780,10 +779,9 @@ void nsView::List(FILE* out, int32_t aIndent) const
fprintf(out, "%p ", (void*)this);
if (nullptr != mWindow) {
nscoord p2a = mViewManager->AppUnitsPerDevPixel();
LayoutDeviceIntRect rect;
mWindow->GetClientBounds(rect);
LayoutDeviceIntRect rect = mWindow->GetClientBounds();
nsRect windowBounds = LayoutDeviceIntRect::ToAppUnits(rect, p2a);
mWindow->GetBounds(rect);
rect = mWindow->GetBounds();
nsRect nonclientBounds = LayoutDeviceIntRect::ToAppUnits(rect, p2a);
nsrefcnt widgetRefCnt = mWindow.get()->AddRef() - 1;
mWindow.get()->Release();

Просмотреть файл

@ -603,8 +603,7 @@ nsViewManager::InvalidateWidgetArea(nsView *aWidgetView,
// plugin widgets are basically invisible
#ifndef XP_MACOSX
// GetBounds should compensate for chrome on a toplevel widget
LayoutDeviceIntRect bounds;
childWidget->GetBounds(bounds);
LayoutDeviceIntRect bounds = childWidget->GetBounds();
nsTArray<LayoutDeviceIntRect> clipRects;
childWidget->GetWindowClipRegion(&clipRects);

Просмотреть файл

@ -251,8 +251,7 @@ PuppetWidget::ConfigureChildren(const nsTArray<Configuration>& aConfigurations)
NS_ASSERTION(w->GetParent() == this,
"Configured widget is not a child");
w->SetWindowClipRegion(configuration.mClipRegion, true);
LayoutDeviceIntRect bounds;
w->GetBounds(bounds);
LayoutDeviceIntRect bounds = w->GetBounds();
if (bounds.Size() != configuration.mBounds.Size()) {
w->Resize(configuration.mBounds.x, configuration.mBounds.y,
configuration.mBounds.width, configuration.mBounds.height,
@ -1241,11 +1240,10 @@ PuppetWidget::GetWindowPosition()
return nsIntPoint(winX, winY) + GetOwningTabChild()->GetClientOffset().ToUnknownPoint();
}
NS_IMETHODIMP
PuppetWidget::GetScreenBounds(LayoutDeviceIntRect& aRect) {
aRect.MoveTo(WidgetToScreenOffset());
aRect.SizeTo(mBounds.Size());
return NS_OK;
LayoutDeviceIntRect
PuppetWidget::GetScreenBounds()
{
return LayoutDeviceIntRect(WidgetToScreenOffset(), mBounds.Size());
}
uint32_t PuppetWidget::GetMaxTouchPoints() const

Просмотреть файл

@ -209,7 +209,7 @@ public:
// Get the screen position of the application window.
nsIntPoint GetWindowPosition();
NS_IMETHOD GetScreenBounds(LayoutDeviceIntRect& aRect) override;
virtual LayoutDeviceIntRect GetScreenBounds() override;
NS_IMETHOD StartPluginIME(const mozilla::WidgetKeyboardEvent& aKeyboardEvent,
int32_t aPanelX, int32_t aPanelY,

Просмотреть файл

@ -1864,17 +1864,10 @@ nsWindow::BringToFront()
RedrawAll();
}
NS_IMETHODIMP
nsWindow::GetScreenBounds(LayoutDeviceIntRect& aRect)
LayoutDeviceIntRect
nsWindow::GetScreenBounds()
{
LayoutDeviceIntPoint p = WidgetToScreenOffset();
aRect.x = p.x;
aRect.y = p.y;
aRect.width = mBounds.width;
aRect.height = mBounds.height;
return NS_OK;
return LayoutDeviceIntRect(WidgetToScreenOffset(), mBounds.Size());
}
LayoutDeviceIntPoint

Просмотреть файл

@ -161,7 +161,7 @@ public:
virtual bool IsEnabled() const override;
NS_IMETHOD Invalidate(const LayoutDeviceIntRect& aRect) override;
NS_IMETHOD SetFocus(bool aRaise = false) override;
NS_IMETHOD GetScreenBounds(LayoutDeviceIntRect& aRect) override;
virtual LayoutDeviceIntRect GetScreenBounds() override;
virtual LayoutDeviceIntPoint WidgetToScreenOffset() override;
NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
nsEventStatus& aStatus) override;

Просмотреть файл

@ -321,9 +321,9 @@ public:
NS_IMETHOD Enable(bool aState) override;
virtual bool IsEnabled() const override;
NS_IMETHOD SetFocus(bool aRaise) override;
NS_IMETHOD GetBounds(LayoutDeviceIntRect& aRect) override;
NS_IMETHOD GetClientBounds(LayoutDeviceIntRect& aRect) override;
NS_IMETHOD GetScreenBounds(LayoutDeviceIntRect& aRect) override;
virtual LayoutDeviceIntRect GetBounds() override;
virtual LayoutDeviceIntRect GetClientBounds() override;
virtual LayoutDeviceIntRect GetScreenBounds() override;
// Returns the "backing scale factor" of the view's window, which is the
// ratio of pixels in the window's backing store to Cocoa points. Prior to

Просмотреть файл

@ -873,28 +873,30 @@ NS_IMETHODIMP nsChildView::SetCursor(imgIContainer* aCursor,
#pragma mark -
// Get this component dimension
NS_IMETHODIMP nsChildView::GetBounds(LayoutDeviceIntRect& aRect)
LayoutDeviceIntRect
nsChildView::GetBounds()
{
aRect = !mView ? mBounds : CocoaPointsToDevPixels([mView frame]);
return NS_OK;
return !mView ? mBounds : CocoaPointsToDevPixels([mView frame]);
}
NS_IMETHODIMP nsChildView::GetClientBounds(mozilla::LayoutDeviceIntRect& aRect)
LayoutDeviceIntRect
nsChildView::GetClientBounds()
{
GetBounds(aRect);
LayoutDeviceIntRect rect = GetBounds();
if (!mParentWidget) {
// For top level widgets we want the position on screen, not the position
// of this view inside the window.
aRect.MoveTo(WidgetToScreenOffset());
rect.MoveTo(WidgetToScreenOffset());
}
return NS_OK;
return rect;
}
NS_IMETHODIMP nsChildView::GetScreenBounds(LayoutDeviceIntRect& aRect)
LayoutDeviceIntRect
nsChildView::GetScreenBounds()
{
GetBounds(aRect);
aRect.MoveTo(WidgetToScreenOffset());
return NS_OK;
LayoutDeviceIntRect rect = GetBounds();
rect.MoveTo(WidgetToScreenOffset());
return rect;
}
double
@ -3695,8 +3697,7 @@ NSEvent* gLastDragMouseDownEvent = nil;
return;
#ifdef DEBUG_UPDATE
LayoutDeviceIntRect geckoBounds;
mGeckoChild->GetBounds(geckoBounds);
LayoutDeviceIntRect geckoBounds = mGeckoChild->GetBounds();
fprintf (stderr, "---- Update[%p][%p] [%f %f %f %f] cgc: %p\n gecko bounds: [%d %d %d %d]\n",
self, mGeckoChild,
@ -3804,8 +3805,7 @@ NSEvent* gLastDragMouseDownEvent = nil;
mWaitingForPaint = NO;
LayoutDeviceIntRect geckoBounds;
mGeckoChild->GetBounds(geckoBounds);
LayoutDeviceIntRect geckoBounds = mGeckoChild->GetBounds();
LayoutDeviceIntRegion region(geckoBounds);
mGeckoChild->PaintWindow(region);

Просмотреть файл

@ -280,8 +280,8 @@ public:
NS_IMETHOD Resize(double aWidth, double aHeight, bool aRepaint) override;
NS_IMETHOD Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint) override;
NS_IMETHOD GetClientBounds(LayoutDeviceIntRect& aRect) override;
NS_IMETHOD GetScreenBounds(LayoutDeviceIntRect& aRect) override;
virtual LayoutDeviceIntRect GetClientBounds() override;
virtual LayoutDeviceIntRect GetScreenBounds() override;
void ReportMoveEvent();
void ReportSizeEvent();
NS_IMETHOD SetCursor(nsCursor aCursor) override;

Просмотреть файл

@ -1606,14 +1606,14 @@ NS_IMETHODIMP nsCocoaWindow::Resize(double aWidth, double aHeight, bool aRepaint
aWidth, aHeight, aRepaint, true);
}
NS_IMETHODIMP nsCocoaWindow::GetClientBounds(mozilla::LayoutDeviceIntRect& aRect)
LayoutDeviceIntRect
nsCocoaWindow::GetClientBounds()
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
CGFloat scaleFactor = BackingScaleFactor();
if (!mWindow) {
aRect = nsCocoaUtils::CocoaRectToGeckoRectDevPix(NSZeroRect, scaleFactor);
return NS_OK;
return nsCocoaUtils::CocoaRectToGeckoRectDevPix(NSZeroRect, scaleFactor);
}
NSRect r;
@ -1624,11 +1624,9 @@ NS_IMETHODIMP nsCocoaWindow::GetClientBounds(mozilla::LayoutDeviceIntRect& aRect
r = [mWindow contentRectForFrameRect:[mWindow frame]];
}
aRect = nsCocoaUtils::CocoaRectToGeckoRectDevPix(r, scaleFactor);
return nsCocoaUtils::CocoaRectToGeckoRectDevPix(r, scaleFactor);
return NS_OK;
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntRect(0, 0, 0, 0));
}
void
@ -1642,19 +1640,19 @@ nsCocoaWindow::UpdateBounds()
nsCocoaUtils::CocoaRectToGeckoRectDevPix(frame, BackingScaleFactor());
}
NS_IMETHODIMP nsCocoaWindow::GetScreenBounds(LayoutDeviceIntRect &aRect)
LayoutDeviceIntRect
nsCocoaWindow::GetScreenBounds()
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
#ifdef DEBUG
LayoutDeviceIntRect r = nsCocoaUtils::CocoaRectToGeckoRectDevPix([mWindow frame], BackingScaleFactor());
NS_ASSERTION(mWindow && mBounds == r, "mBounds out of sync!");
#endif
aRect = mBounds;
return NS_OK;
return mBounds;
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntRect(0, 0, 0, 0));
}
double
@ -1969,8 +1967,7 @@ nsCocoaWindow::ReportSizeEvent()
UpdateBounds();
if (mWidgetListener) {
LayoutDeviceIntRect innerBounds;
GetClientBounds(innerBounds);
LayoutDeviceIntRect innerBounds = GetClientBounds();
mWidgetListener->WindowResized(this, innerBounds.width, innerBounds.height);
}
@ -2037,8 +2034,7 @@ LayoutDeviceIntPoint nsCocoaWindow::GetClientOffset()
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
LayoutDeviceIntRect clientRect;
GetClientBounds(clientRect);
LayoutDeviceIntRect clientRect = GetClientBounds();
return clientRect.TopLeft() - mBounds.TopLeft();

Просмотреть файл

@ -1499,25 +1499,26 @@ nsWindow::SetFocus(bool aRaise)
return NS_OK;
}
NS_IMETHODIMP
nsWindow::GetScreenBounds(LayoutDeviceIntRect& aRect)
LayoutDeviceIntRect
nsWindow::GetScreenBounds()
{
LayoutDeviceIntRect rect;
if (mIsTopLevel && mContainer) {
// use the point including window decorations
gint x, y;
gdk_window_get_root_origin(gtk_widget_get_window(GTK_WIDGET(mContainer)), &x, &y);
aRect.MoveTo(GdkPointToDevicePixels({ x, y }));
rect.MoveTo(GdkPointToDevicePixels({ x, y }));
} else {
aRect.MoveTo(WidgetToScreenOffset());
rect.MoveTo(WidgetToScreenOffset());
}
// mBounds.Size() is the window bounds, not the window-manager frame
// bounds (bug 581863). gdk_window_get_frame_extents would give the
// frame bounds, but mBounds.Size() is returned here for consistency
// with Resize.
aRect.SizeTo(mBounds.Size());
rect.SizeTo(mBounds.Size());
LOG(("GetScreenBounds %d,%d | %dx%d\n",
aRect.x, aRect.y, aRect.width, aRect.height));
return NS_OK;
rect.x, rect.y, rect.width, rect.height));
return rect;
}
LayoutDeviceIntSize
@ -1526,16 +1527,15 @@ nsWindow::GetClientSize()
return LayoutDeviceIntSize(mBounds.width, mBounds.height);
}
NS_IMETHODIMP
nsWindow::GetClientBounds(LayoutDeviceIntRect& aRect)
LayoutDeviceIntRect
nsWindow::GetClientBounds()
{
// GetBounds returns a rect whose top left represents the top left of the
// outer bounds, but whose width/height represent the size of the inner
// bounds (which is messed up).
GetBounds(aRect);
aRect.MoveBy(GetClientOffset());
return NS_OK;
LayoutDeviceIntRect rect = GetBounds();
rect.MoveBy(GetClientOffset());
return rect;
}
void
@ -2227,8 +2227,7 @@ nsWindow::OnExposeEvent(cairo_t *cr)
if (kid && gdk_window_is_visible(gdkWin)) {
AutoTArray<LayoutDeviceIntRect,1> clipRects;
kid->GetWindowClipRegion(&clipRects);
LayoutDeviceIntRect bounds;
kid->GetBounds(bounds);
LayoutDeviceIntRect bounds = kid->GetBounds();
for (uint32_t i = 0; i < clipRects.Length(); ++i) {
LayoutDeviceIntRect r = clipRects[i] + bounds.TopLeft();
region.Sub(region, r);
@ -2429,8 +2428,7 @@ nsWindow::OnConfigureEvent(GtkWidget *aWidget, GdkEventConfigure *aEvent)
mPendingConfigures--;
LayoutDeviceIntRect screenBounds;
GetScreenBounds(screenBounds);
LayoutDeviceIntRect screenBounds = GetScreenBounds();
if (mWindowType == eWindowType_toplevel || mWindowType == eWindowType_dialog) {
// This check avoids unwanted rollup on spurious configure events from

Просмотреть файл

@ -134,8 +134,8 @@ public:
NS_IMETHOD SetSizeMode(nsSizeMode aMode) override;
NS_IMETHOD Enable(bool aState) override;
NS_IMETHOD SetFocus(bool aRaise = false) override;
NS_IMETHOD GetScreenBounds(LayoutDeviceIntRect& aRect) override;
NS_IMETHOD GetClientBounds(LayoutDeviceIntRect& aRect) override;
virtual LayoutDeviceIntRect GetScreenBounds() override;
virtual LayoutDeviceIntRect GetClientBounds() override;
virtual LayoutDeviceIntSize GetClientSize() override;
virtual LayoutDeviceIntPoint GetClientOffset() override;
NS_IMETHOD SetCursor(nsCursor aCursor) override;

Просмотреть файл

@ -899,7 +899,7 @@ NS_IMETHODIMP nsBaseWidget::MakeFullScreen(bool aFullScreen, nsIScreen* aScreen)
if (!mOriginalBounds) {
mOriginalBounds = new LayoutDeviceIntRect();
}
GetScreenBounds(*mOriginalBounds);
*mOriginalBounds = GetScreenBounds();
// Move to top-left corner of screen and size to the screen dimensions
nsCOMPtr<nsIScreen> screen = aScreen;
@ -974,8 +974,7 @@ nsBaseWidget::UseAPZ()
void nsBaseWidget::CreateCompositor()
{
LayoutDeviceIntRect rect;
GetBounds(rect);
LayoutDeviceIntRect rect = GetBounds();
CreateCompositor(rect.width, rect.height);
}
@ -1493,8 +1492,7 @@ NS_IMETHODIMP nsBaseWidget::ResizeClient(double aWidth,
NS_ASSERTION((aWidth >=0) , "Negative width passed to ResizeClient");
NS_ASSERTION((aHeight >=0), "Negative height passed to ResizeClient");
LayoutDeviceIntRect clientBounds;
GetClientBounds(clientBounds);
LayoutDeviceIntRect clientBounds = GetClientBounds();
// GetClientBounds and mBounds are device pixels; scale back to desktop pixels
// if that's what this widget uses for the Move/Resize APIs
@ -1519,10 +1517,8 @@ NS_IMETHODIMP nsBaseWidget::ResizeClient(double aX,
NS_ASSERTION((aWidth >=0) , "Negative width passed to ResizeClient");
NS_ASSERTION((aHeight >=0), "Negative height passed to ResizeClient");
LayoutDeviceIntRect clientBounds;
GetClientBounds(clientBounds);
LayoutDeviceIntPoint clientOffset(GetClientOffset());
LayoutDeviceIntRect clientBounds = GetClientBounds();
LayoutDeviceIntPoint clientOffset = GetClientOffset();
if (BoundsUseDesktopPixels()) {
DesktopToLayoutDeviceScale scale = GetDesktopToDeviceScale();
@ -1551,19 +1547,20 @@ NS_IMETHODIMP nsBaseWidget::ResizeClient(double aX,
* If the implementation of nsWindow supports borders this method MUST be overridden
*
**/
NS_IMETHODIMP nsBaseWidget::GetClientBounds(LayoutDeviceIntRect &aRect)
LayoutDeviceIntRect
nsBaseWidget::GetClientBounds()
{
return GetBounds(aRect);
return GetBounds();
}
/**
* If the implementation of nsWindow supports borders this method MUST be overridden
*
**/
NS_IMETHODIMP nsBaseWidget::GetBounds(LayoutDeviceIntRect &aRect)
LayoutDeviceIntRect
nsBaseWidget::GetBounds()
{
aRect = mBounds;
return NS_OK;
return mBounds;
}
/**
@ -1571,17 +1568,20 @@ NS_IMETHODIMP nsBaseWidget::GetBounds(LayoutDeviceIntRect &aRect)
* this method must be overridden
*
**/
NS_IMETHODIMP nsBaseWidget::GetScreenBounds(LayoutDeviceIntRect& aRect)
LayoutDeviceIntRect
nsBaseWidget::GetScreenBounds()
{
return GetBounds(aRect);
return GetBounds();
}
NS_IMETHODIMP nsBaseWidget::GetRestoredBounds(LayoutDeviceIntRect& aRect)
nsresult
nsBaseWidget::GetRestoredBounds(LayoutDeviceIntRect& aRect)
{
if (SizeMode() != nsSizeMode_Normal) {
return NS_ERROR_FAILURE;
}
return GetScreenBounds(aRect);
aRect = GetScreenBounds();
return NS_OK;
}
LayoutDeviceIntPoint
@ -1979,8 +1979,7 @@ nsIWidget::GetWidgetScreen()
return nullptr;
}
LayoutDeviceIntRect bounds;
GetScreenBounds(bounds);
LayoutDeviceIntRect bounds = GetScreenBounds();
DesktopIntRect deskBounds = RoundedToInt(bounds / GetDesktopToDeviceScale());
nsCOMPtr<nsIScreen> screen;
screenManager->ScreenForRect(deskBounds.x, deskBounds.y,

Просмотреть файл

@ -214,10 +214,10 @@ public:
NS_IMETHOD MoveClient(double aX, double aY) override;
NS_IMETHOD ResizeClient(double aWidth, double aHeight, bool aRepaint) override;
NS_IMETHOD ResizeClient(double aX, double aY, double aWidth, double aHeight, bool aRepaint) override;
NS_IMETHOD GetBounds(LayoutDeviceIntRect& aRect) override;
NS_IMETHOD GetClientBounds(LayoutDeviceIntRect& aRect) override;
NS_IMETHOD GetScreenBounds(LayoutDeviceIntRect& aRect) override;
NS_IMETHOD GetRestoredBounds(LayoutDeviceIntRect& aRect) override;
virtual LayoutDeviceIntRect GetBounds() override;
virtual LayoutDeviceIntRect GetClientBounds() override;
virtual LayoutDeviceIntRect GetScreenBounds() override;
virtual MOZ_MUST_USE nsresult GetRestoredBounds(LayoutDeviceIntRect& aRect) override;
NS_IMETHOD GetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
NS_IMETHOD SetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
virtual LayoutDeviceIntPoint GetClientOffset() override;

Просмотреть файл

@ -862,19 +862,17 @@ class nsIWidget : public nsISupports
* popup widgets the returned rect is in screen coordinates and not
* relative to its parent widget.
*
* @param aRect On return it holds the x, y, width and height of
* this widget.
* @return the x, y, width and height of this widget.
*/
NS_IMETHOD GetBounds(LayoutDeviceIntRect& aRect) = 0;
virtual LayoutDeviceIntRect GetBounds() = 0;
/**
* Get this widget's outside dimensions in device coordinates. This
* includes any title bar on the window.
*
* @param aRect On return it holds the x, y, width and height of
* this widget.
* @return the x, y, width and height of this widget.
*/
NS_IMETHOD GetScreenBounds(LayoutDeviceIntRect& aRect) = 0;
virtual LayoutDeviceIntRect GetScreenBounds() = 0;
/**
* Similar to GetScreenBounds except that this function will always
@ -888,7 +886,8 @@ class nsIWidget : public nsISupports
* @param aRect On return it holds the x, y, width and height of
* this widget.
*/
NS_IMETHOD GetRestoredBounds(LayoutDeviceIntRect& aRect) = 0;
virtual MOZ_MUST_USE nsresult
GetRestoredBounds(LayoutDeviceIntRect& aRect) = 0;
/**
* Get this widget's client area bounds, if the window has a 3D border
@ -896,10 +895,9 @@ class nsIWidget : public nsISupports
* position of the client area relative to the client area of the parent
* widget (for root widgets and popup widgets it is in screen coordinates).
*
* @param aRect On return it holds the x. y, width and height of
* the client area of this widget.
* @return the x, y, width and height of the client area of this widget.
*/
NS_IMETHOD GetClientBounds(LayoutDeviceIntRect& aRect) = 0;
virtual LayoutDeviceIntRect GetClientBounds() = 0;
/**
* Get the non-client area dimensions of the window.
@ -933,9 +931,7 @@ class nsIWidget : public nsISupports
virtual LayoutDeviceIntSize GetClientSize() {
// Depending on the backend, overloading this method may be useful if
// requesting the client offset is expensive.
LayoutDeviceIntRect rect;
GetClientBounds(rect);
return rect.Size();
return GetClientBounds().Size();
}
/**
@ -1894,13 +1890,7 @@ public:
virtual bool WidgetPaintsBackground() { return false; }
virtual bool NeedsPaint() {
if (!IsVisible()) {
return false;
}
LayoutDeviceIntRect bounds;
nsresult rv = GetBounds(bounds);
NS_ENSURE_SUCCESS(rv, false);
return !bounds.IsEmpty();
return IsVisible() && !GetBounds().IsEmpty();
}
/**
@ -1916,9 +1906,7 @@ public:
* probably shouldn't call this method.
*/
virtual LayoutDeviceIntRect GetNaturalBounds() {
LayoutDeviceIntRect bounds;
GetBounds(bounds);
return bounds;
return GetBounds();
}
/**

Просмотреть файл

@ -593,8 +593,8 @@ nsNativeTheme::IsSubmenu(nsIFrame* aFrame, bool* aLeftOfParent)
if (parent->GetContent() == parentContent) {
if (aLeftOfParent) {
LayoutDeviceIntRect selfBounds, parentBounds;
aFrame->GetNearestWidget()->GetScreenBounds(selfBounds);
parent->GetNearestWidget()->GetScreenBounds(parentBounds);
selfBounds = aFrame->GetNearestWidget()->GetScreenBounds();
parentBounds = parent->GetNearestWidget()->GetScreenBounds();
*aLeftOfParent = selfBounds.x < parentBounds.x;
}
return true;

Просмотреть файл

@ -60,7 +60,7 @@ public:
void EnteredFullScreen(bool aFullScreen);
NS_IMETHOD Resize(double aWidth, double aHeight, bool aRepaint) override;
NS_IMETHOD Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint) override;
NS_IMETHOD GetScreenBounds(LayoutDeviceIntRect& aRect) override;
virtual LayoutDeviceIntRect GetScreenBounds() override;
void ReportMoveEvent();
void ReportSizeEvent();
void ReportSizeModeEvent(nsSizeMode aMode);

Просмотреть файл

@ -278,8 +278,7 @@ private:
mWaitingForPaint = NO;
LayoutDeviceIntRect geckoBounds;
mGeckoChild->GetBounds(geckoBounds);
LayoutDeviceIntRect geckoBounds = mGeckoChild->GetBounds();
LayoutDeviceIntRegion region(geckoBounds);
mGeckoChild->PaintWindow(region);
@ -305,8 +304,7 @@ private:
- (void)drawRect:(CGRect)aRect inContext:(CGContextRef)aContext
{
#ifdef DEBUG_UPDATE
LayoutDeviceIntRect geckoBounds;
mGeckoChild->GetBounds(geckoBounds);
LayoutDeviceIntRect geckoBounds = mGeckoChild->GetBounds();
fprintf (stderr, "---- Update[%p][%p] [%f %f %f %f] cgc: %p\n gecko bounds: [%d %d %d %d]\n",
self, mGeckoChild,
@ -774,23 +772,15 @@ void nsWindow::ReportSizeModeEvent(nsSizeMode aMode)
void nsWindow::ReportSizeEvent()
{
if (mWidgetListener) {
LayoutDeviceIntRect innerBounds;
GetClientBounds(innerBounds);
LayoutDeviceIntRect innerBounds = GetClientBounds();
mWidgetListener->WindowResized(this, innerBounds.width, innerBounds.height);
}
}
NS_IMETHODIMP
nsWindow::GetScreenBounds(LayoutDeviceIntRect& aRect)
LayoutDeviceIntRect
nsWindow::GetScreenBounds()
{
LayoutDeviceIntPoint p = WidgetToScreenOffset();
aRect.x = p.x;
aRect.y = p.y;
aRect.width = mBounds.width;
aRect.height = mBounds.height;
return NS_OK;
return LayoutDeviceIntRect(WidgetToScreenOffset(), mBounds.Size());
}
LayoutDeviceIntPoint nsWindow::WidgetToScreenOffset()

Просмотреть файл

@ -2432,8 +2432,7 @@ IMMHandler::SetIMERelatedWindowsPosOnPlugin(nsWindow* aWindow,
nsWindow* toplevelWindow = aWindow->GetTopLevelWindow(false);
LayoutDeviceIntRect pluginRectInScreen =
editorRectEvent.mReply.mRect + toplevelWindow->WidgetToScreenOffset();
LayoutDeviceIntRect winRectInScreen;
aWindow->GetClientBounds(winRectInScreen);
LayoutDeviceIntRect winRectInScreen = aWindow->GetClientBounds();
// composition window cannot be positioned on the edge of client area.
winRectInScreen.width--;
winRectInScreen.height--;

Просмотреть файл

@ -3932,14 +3932,7 @@ TSFTextStore::GetScreenExtInternal(RECT& aScreenExt)
return false;
}
LayoutDeviceIntRect boundRect;
if (NS_FAILED(refWindow->GetClientBounds(boundRect))) {
MOZ_LOG(sTextStoreLog, LogLevel::Error,
("0x%p TSFTextStore::GetScreenExtInternal() FAILED due to "
"failed to get the client bounds", this));
return false;
}
LayoutDeviceIntRect boundRect = refWindow->GetClientBounds();
boundRect.MoveTo(0, 0);
// Clip frame rect to window rect

Просмотреть файл

@ -2057,113 +2057,120 @@ NS_IMETHODIMP nsWindow::SetFocus(bool aRaise)
// Return the window's full dimensions in screen coordinates.
// If the window has a parent, converts the origin to an offset
// of the parent's screen origin.
NS_IMETHODIMP nsWindow::GetBounds(LayoutDeviceIntRect& aRect)
LayoutDeviceIntRect
nsWindow::GetBounds()
{
if (mWnd) {
RECT r;
VERIFY(::GetWindowRect(mWnd, &r));
// assign size
aRect.width = r.right - r.left;
aRect.height = r.bottom - r.top;
// popup window bounds' are in screen coordinates, not relative to parent
// window
if (mWindowType == eWindowType_popup) {
aRect.x = r.left;
aRect.y = r.top;
return NS_OK;
}
// chrome on parent:
// ___ 5,5 (chrome start)
// | ____ 10,10 (client start)
// | | ____ 20,20 (child start)
// | | |
// 20,20 - 5,5 = 15,15 (??)
// minus GetClientOffset:
// 15,15 - 5,5 = 10,10
//
// no chrome on parent:
// ______ 10,10 (win start)
// | ____ 20,20 (child start)
// | |
// 20,20 - 10,10 = 10,10
//
// walking the chain:
// ___ 5,5 (chrome start)
// | ___ 10,10 (client start)
// | | ___ 20,20 (child start)
// | | | __ 30,30 (child start)
// | | | |
// 30,30 - 20,20 = 10,10 (offset from second child to first)
// 20,20 - 5,5 = 15,15 + 10,10 = 25,25 (??)
// minus GetClientOffset:
// 25,25 - 5,5 = 20,20 (offset from second child to parent client)
// convert coordinates if parent exists
HWND parent = ::GetParent(mWnd);
if (parent) {
RECT pr;
VERIFY(::GetWindowRect(parent, &pr));
r.left -= pr.left;
r.top -= pr.top;
// adjust for chrome
nsWindow* pWidget = static_cast<nsWindow*>(GetParent());
if (pWidget && pWidget->IsTopLevelWidget()) {
LayoutDeviceIntPoint clientOffset = pWidget->GetClientOffset();
r.left -= clientOffset.x;
r.top -= clientOffset.y;
}
}
aRect.x = r.left;
aRect.y = r.top;
} else {
aRect = mBounds;
if (!mWnd) {
return mBounds;
}
return NS_OK;
RECT r;
VERIFY(::GetWindowRect(mWnd, &r));
LayoutDeviceIntRect rect;
// assign size
rect.width = r.right - r.left;
rect.height = r.bottom - r.top;
// popup window bounds' are in screen coordinates, not relative to parent
// window
if (mWindowType == eWindowType_popup) {
rect.x = r.left;
rect.y = r.top;
return rect;
}
// chrome on parent:
// ___ 5,5 (chrome start)
// | ____ 10,10 (client start)
// | | ____ 20,20 (child start)
// | | |
// 20,20 - 5,5 = 15,15 (??)
// minus GetClientOffset:
// 15,15 - 5,5 = 10,10
//
// no chrome on parent:
// ______ 10,10 (win start)
// | ____ 20,20 (child start)
// | |
// 20,20 - 10,10 = 10,10
//
// walking the chain:
// ___ 5,5 (chrome start)
// | ___ 10,10 (client start)
// | | ___ 20,20 (child start)
// | | | __ 30,30 (child start)
// | | | |
// 30,30 - 20,20 = 10,10 (offset from second child to first)
// 20,20 - 5,5 = 15,15 + 10,10 = 25,25 (??)
// minus GetClientOffset:
// 25,25 - 5,5 = 20,20 (offset from second child to parent client)
// convert coordinates if parent exists
HWND parent = ::GetParent(mWnd);
if (parent) {
RECT pr;
VERIFY(::GetWindowRect(parent, &pr));
r.left -= pr.left;
r.top -= pr.top;
// adjust for chrome
nsWindow* pWidget = static_cast<nsWindow*>(GetParent());
if (pWidget && pWidget->IsTopLevelWidget()) {
LayoutDeviceIntPoint clientOffset = pWidget->GetClientOffset();
r.left -= clientOffset.x;
r.top -= clientOffset.y;
}
}
rect.x = r.left;
rect.y = r.top;
return rect;
}
// Get this component dimension
NS_IMETHODIMP nsWindow::GetClientBounds(LayoutDeviceIntRect& aRect)
LayoutDeviceIntRect
nsWindow::GetClientBounds()
{
if (mWnd) {
RECT r;
VERIFY(::GetClientRect(mWnd, &r));
LayoutDeviceIntRect bounds;
GetBounds(bounds);
aRect.MoveTo(bounds.TopLeft() + GetClientOffset());
aRect.width = r.right - r.left;
aRect.height = r.bottom - r.top;
} else {
aRect.SetRect(0,0,0,0);
if (!mWnd) {
return LayoutDeviceIntRect(0, 0, 0, 0);
}
return NS_OK;
RECT r;
VERIFY(::GetClientRect(mWnd, &r));
LayoutDeviceIntRect bounds = GetBounds();
LayoutDeviceIntRect rect;
rect.MoveTo(bounds.TopLeft() + GetClientOffset());
rect.width = r.right - r.left;
rect.height = r.bottom - r.top;
return rect;
}
// Like GetBounds, but don't offset by the parent
NS_IMETHODIMP nsWindow::GetScreenBounds(LayoutDeviceIntRect& aRect)
LayoutDeviceIntRect
nsWindow::GetScreenBounds()
{
if (mWnd) {
RECT r;
VERIFY(::GetWindowRect(mWnd, &r));
aRect.width = r.right - r.left;
aRect.height = r.bottom - r.top;
aRect.x = r.left;
aRect.y = r.top;
} else {
aRect = mBounds;
if (!mWnd) {
return mBounds;
}
return NS_OK;
RECT r;
VERIFY(::GetWindowRect(mWnd, &r));
LayoutDeviceIntRect rect;
rect.x = r.left;
rect.y = r.top;
rect.width = r.right - r.left;
rect.height = r.bottom - r.top;
return rect;
}
NS_IMETHODIMP nsWindow::GetRestoredBounds(LayoutDeviceIntRect &aRect)
nsresult
nsWindow::GetRestoredBounds(LayoutDeviceIntRect &aRect)
{
if (SizeMode() == nsSizeMode_Normal) {
return GetScreenBounds(aRect);
aRect = GetScreenBounds();
return NS_OK;
}
if (!mWnd) {
return NS_ERROR_FAILURE;
@ -2860,14 +2867,12 @@ void nsWindow::UpdateOpaqueRegion(const LayoutDeviceIntRegion& aOpaqueRegion)
for (nsIWidget* child = GetFirstChild(); child; child = child->GetNextSibling()) {
if (child->IsPlugin()) {
// Collect the bounds of all plugins for GetLargestRectangle.
LayoutDeviceIntRect childBounds;
child->GetBounds(childBounds);
LayoutDeviceIntRect childBounds = child->GetBounds();
pluginBounds.UnionRect(pluginBounds, childBounds);
}
}
LayoutDeviceIntRect clientBounds;
GetClientBounds(clientBounds);
LayoutDeviceIntRect clientBounds = GetClientBounds();
// Find the largest rectangle and use that to calculate the inset. Our top
// priority is to include the bounds of all plugins.
@ -3764,9 +3769,7 @@ nsWindow::OnDefaultButtonLoaded(const LayoutDeviceIntRect& aButtonRect)
return NS_OK;
}
LayoutDeviceIntRect widgetRect;
nsresult rv = GetScreenBounds(widgetRect);
NS_ENSURE_SUCCESS(rv, rv);
LayoutDeviceIntRect widgetRect = GetScreenBounds();
LayoutDeviceIntRect buttonRect(aButtonRect + widgetRect.TopLeft());
LayoutDeviceIntPoint centerOfButton(buttonRect.x + buttonRect.width / 2,
@ -4255,8 +4258,7 @@ nsWindow::DispatchMouseEvent(EventMessage aEventMessage, WPARAM wParam,
// call the event callback
if (mWidgetListener) {
if (aEventMessage == eMouseMove) {
LayoutDeviceIntRect rect;
GetBounds(rect);
LayoutDeviceIntRect rect = GetBounds();
rect.x = 0;
rect.y = 0;
@ -6652,8 +6654,7 @@ nsWindow::ConfigureChildren(const nsTArray<Configuration>& aConfigurations)
"Configured widget is not a child");
nsresult rv = w->SetWindowClipRegion(configuration.mClipRegion, true);
NS_ENSURE_SUCCESS(rv, rv);
LayoutDeviceIntRect bounds;
w->GetBounds(bounds);
LayoutDeviceIntRect bounds = w->GetBounds();
if (bounds.Size() != configuration.mBounds.Size()) {
w->Resize(configuration.mBounds.x, configuration.mBounds.y,
configuration.mBounds.width, configuration.mBounds.height,

Просмотреть файл

@ -133,10 +133,10 @@ public:
NS_IMETHOD Enable(bool aState) override;
virtual bool IsEnabled() const override;
NS_IMETHOD SetFocus(bool aRaise) override;
NS_IMETHOD GetBounds(LayoutDeviceIntRect& aRect) override;
NS_IMETHOD GetScreenBounds(LayoutDeviceIntRect& aRect) override;
NS_IMETHOD GetRestoredBounds(LayoutDeviceIntRect& aRect) override;
NS_IMETHOD GetClientBounds(LayoutDeviceIntRect& aRect) override;
virtual LayoutDeviceIntRect GetBounds() override;
virtual LayoutDeviceIntRect GetScreenBounds() override;
virtual MOZ_MUST_USE nsresult GetRestoredBounds(LayoutDeviceIntRect& aRect) override;
virtual LayoutDeviceIntRect GetClientBounds() override;
virtual LayoutDeviceIntPoint GetClientOffset() override;
void SetBackgroundColor(const nscolor& aColor) override;
NS_IMETHOD SetCursor(imgIContainer* aCursor,

Просмотреть файл

@ -176,8 +176,7 @@ nsresult nsWebShellWindow::Initialize(nsIXULWindow* aParent,
deskRect, // Widget dimensions
&widgetInitData); // Widget initialization data
LayoutDeviceIntRect r;
mWindow->GetClientBounds(r);
LayoutDeviceIntRect r = mWindow->GetClientBounds();
// Match the default background color of content. Important on windows
// since we no longer use content child widgets.
mWindow->SetBackgroundColor(NS_RGB(255,255,255));

Просмотреть файл

@ -673,12 +673,11 @@ NS_IMETHODIMP nsXULWindow::SetPositionAndSize(int32_t aX, int32_t aY,
NS_IMETHODIMP nsXULWindow::GetPositionAndSize(int32_t* x, int32_t* y, int32_t* cx,
int32_t* cy)
{
LayoutDeviceIntRect rect;
if (!mWindow)
return NS_ERROR_FAILURE;
mWindow->GetScreenBounds(rect);
LayoutDeviceIntRect rect = mWindow->GetScreenBounds();
if (x)
*x = rect.x;