Bug 1423559: Use BaseRect access methods instead of member variables in widget/ r=mstange

MozReview-Commit-ID: AqnztoUbsmk

--HG--
extra : rebase_source : 76a232a08b42ed73b4922c03bc0f2e9d1769203b
This commit is contained in:
Milan Sreckovic 2018-01-10 11:14:16 -05:00
parent 2413f473dd
commit bd27b86da3
21 changed files with 219 additions and 260 deletions

View file

@ -53,7 +53,7 @@ CompositorWidget::GetBackBufferDrawTarget(gfx::DrawTarget* aScreenTarget,
target->SetTransform(gfx::Matrix()); target->SetTransform(gfx::Matrix());
if (!aClearRect.IsEmpty()) { if (!aClearRect.IsEmpty()) {
gfx::IntRect clearRect = aClearRect.ToUnknownRect() - aRect.ToUnknownRect().TopLeft(); gfx::IntRect clearRect = aClearRect.ToUnknownRect() - aRect.ToUnknownRect().TopLeft();
target->ClearRect(gfx::Rect(clearRect.x, clearRect.y, clearRect.width, clearRect.height)); target->ClearRect(gfx::Rect(clearRect.X(), clearRect.Y(), clearRect.Width(), clearRect.Height()));
} }
} else { } else {
target = aScreenTarget->CreateSimilarDrawTarget(size, format); target = aScreenTarget->CreateSimilarDrawTarget(size, format);

View file

@ -44,13 +44,13 @@ public:
explicit GetRectText(const LayoutDeviceIntRect& aRect) explicit GetRectText(const LayoutDeviceIntRect& aRect)
{ {
AssignLiteral("{ x="); AssignLiteral("{ x=");
AppendInt(aRect.x); AppendInt(aRect.X());
AppendLiteral(", y="); AppendLiteral(", y=");
AppendInt(aRect.y); AppendInt(aRect.Y());
AppendLiteral(", width="); AppendLiteral(", width=");
AppendInt(aRect.width); AppendInt(aRect.Width());
AppendLiteral(", height="); AppendLiteral(", height=");
AppendInt(aRect.height); AppendInt(aRect.Height());
AppendLiteral(" }"); AppendLiteral(" }");
} }
virtual ~GetRectText() {} virtual ~GetRectText() {}
@ -293,11 +293,11 @@ ContentCacheInChild::QueryCharRect(nsIWidget* aWidget,
aCharRect = textRect.mReply.mRect; aCharRect = textRect.mReply.mRect;
// Guarantee the rect is not empty. // Guarantee the rect is not empty.
if (NS_WARN_IF(!aCharRect.height)) { if (NS_WARN_IF(!aCharRect.Height())) {
aCharRect.height = 1; aCharRect.SetHeight(1);
} }
if (NS_WARN_IF(!aCharRect.width)) { if (NS_WARN_IF(!aCharRect.Width())) {
aCharRect.width = 1; aCharRect.SetWidth(1);
} }
return true; return true;
} }
@ -1081,10 +1081,10 @@ ContentCacheInParent::GetCaretRect(uint32_t aOffset,
} }
if (mSelection.mWritingMode.IsVertical()) { if (mSelection.mWritingMode.IsVertical()) {
aCaretRect.y = aCaretRect.YMost(); aCaretRect.MoveToY(aCaretRect.YMost());
} else { } else {
// XXX bidi-unaware. // XXX bidi-unaware.
aCaretRect.x = aCaretRect.XMost(); aCaretRect.MoveToX(aCaretRect.XMost());
} }
} }
@ -1092,9 +1092,9 @@ ContentCacheInParent::GetCaretRect(uint32_t aOffset,
// direction. However, this is usually used by IME, so, assuming the // direction. However, this is usually used by IME, so, assuming the
// character is in LRT context must not cause any problem. // character is in LRT context must not cause any problem.
if (mSelection.mWritingMode.IsVertical()) { if (mSelection.mWritingMode.IsVertical()) {
aCaretRect.height = mCaret.IsValid() ? mCaret.mRect.height : 1; aCaretRect.SetHeight(mCaret.IsValid() ? mCaret.mRect.Height() : 1);
} else { } else {
aCaretRect.width = mCaret.IsValid() ? mCaret.mRect.width : 1; aCaretRect.SetWidth(mCaret.IsValid() ? mCaret.mRect.Width() : 1);
} }
return true; return true;
} }

View file

@ -660,10 +660,7 @@ struct IMENotification final
void Set(const nsIntRect& aRect) void Set(const nsIntRect& aRect)
{ {
mX = aRect.x; aRect.GetRect(&mX, &mY, &mWidth, &mHeight);
mY = aRect.y;
mWidth = aRect.Width();
mHeight = aRect.Height();
} }
nsIntRect AsIntRect() const nsIntRect AsIntRect() const
{ {

View file

@ -134,7 +134,7 @@ PuppetWidget::InfallibleCreate(nsIWidget* aParent,
mLayerManager = parent->GetLayerManager(); mLayerManager = parent->GetLayerManager();
} }
else { else {
Resize(mBounds.x, mBounds.y, mBounds.width, mBounds.height, false); Resize(mBounds.X(), mBounds.Y(), mBounds.Width(), mBounds.Height(), false);
} }
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService(); nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) { if (obs) {
@ -224,7 +224,7 @@ PuppetWidget::Show(bool aState)
// of no use anymore (and is actually actively harmful - see // of no use anymore (and is actually actively harmful - see
// bug 1323586). // bug 1323586).
mPreviouslyAttachedWidgetListener = nullptr; mPreviouslyAttachedWidgetListener = nullptr;
Resize(mBounds.width, mBounds.height, false); Resize(mBounds.Width(), mBounds.Height(), false);
Invalidate(mBounds); Invalidate(mBounds);
} }
} }
@ -257,9 +257,9 @@ PuppetWidget::Resize(double aWidth,
if (!oldBounds.IsEqualEdges(mBounds) && mAttachedWidgetListener) { if (!oldBounds.IsEqualEdges(mBounds) && mAttachedWidgetListener) {
if (GetCurrentWidgetListener() && if (GetCurrentWidgetListener() &&
GetCurrentWidgetListener() != mAttachedWidgetListener) { GetCurrentWidgetListener() != mAttachedWidgetListener) {
GetCurrentWidgetListener()->WindowResized(this, mBounds.width, mBounds.height); GetCurrentWidgetListener()->WindowResized(this, mBounds.Width(), mBounds.Height());
} }
mAttachedWidgetListener->WindowResized(this, mBounds.width, mBounds.height); mAttachedWidgetListener->WindowResized(this, mBounds.Width(), mBounds.Height());
} }
} }
@ -274,11 +274,11 @@ PuppetWidget::ConfigureChildren(const nsTArray<Configuration>& aConfigurations)
w->SetWindowClipRegion(configuration.mClipRegion, true); w->SetWindowClipRegion(configuration.mClipRegion, true);
LayoutDeviceIntRect bounds = w->GetBounds(); LayoutDeviceIntRect bounds = w->GetBounds();
if (bounds.Size() != configuration.mBounds.Size()) { if (bounds.Size() != configuration.mBounds.Size()) {
w->Resize(configuration.mBounds.x, configuration.mBounds.y, w->Resize(configuration.mBounds.X(), configuration.mBounds.Y(),
configuration.mBounds.width, configuration.mBounds.height, configuration.mBounds.Width(), configuration.mBounds.Height(),
true); true);
} else if (bounds.TopLeft() != configuration.mBounds.TopLeft()) { } else if (bounds.TopLeft() != configuration.mBounds.TopLeft()) {
w->Move(configuration.mBounds.x, configuration.mBounds.y); w->Move(configuration.mBounds.X(), configuration.mBounds.Y());
} }
w->SetWindowClipRegion(configuration.mClipRegion, false); w->SetWindowClipRegion(configuration.mClipRegion, false);
} }
@ -1314,7 +1314,7 @@ nsIntSize
PuppetWidget::GetScreenDimensions() PuppetWidget::GetScreenDimensions()
{ {
nsIntRect r = ScreenConfig().rect(); nsIntRect r = ScreenConfig().rect();
return nsIntSize(r.width, r.height); return nsIntSize(r.Width(), r.Height());
} }
NS_IMETHODIMP NS_IMETHODIMP
@ -1322,10 +1322,7 @@ PuppetScreen::GetRect(int32_t *outLeft, int32_t *outTop,
int32_t *outWidth, int32_t *outHeight) int32_t *outWidth, int32_t *outHeight)
{ {
nsIntRect r = ScreenConfig().rect(); nsIntRect r = ScreenConfig().rect();
*outLeft = r.x; r.GetRect(outLeft, outTop, outWidth, outHeight);
*outTop = r.y;
*outWidth = r.width;
*outHeight = r.height;
return NS_OK; return NS_OK;
} }

View file

@ -108,11 +108,10 @@ public:
double aHeight, double aHeight,
bool aRepaint) override bool aRepaint) override
{ {
if (mBounds.x != aX || mBounds.y != aY) { if (!mBounds.IsEqualXY(aX, aY)) {
NotifyWindowMoved(aX, aY); NotifyWindowMoved(aX, aY);
} }
mBounds.x = aX; mBounds.MoveTo(aX, aY);
mBounds.y = aY;
return Resize(aWidth, aHeight, aRepaint); return Resize(aWidth, aHeight, aRepaint);
} }

View file

@ -70,10 +70,7 @@ Screen::GetRect(int32_t* aOutLeft,
int32_t* aOutWidth, int32_t* aOutWidth,
int32_t* aOutHeight) int32_t* aOutHeight)
{ {
*aOutLeft = mRect.x; mRect.GetRect(aOutLeft, aOutTop, aOutWidth, aOutHeight);
*aOutTop = mRect.y;
*aOutWidth = mRect.width;
*aOutHeight = mRect.height;
return NS_OK; return NS_OK;
} }
@ -83,10 +80,7 @@ Screen::GetRectDisplayPix(int32_t* aOutLeft,
int32_t* aOutWidth, int32_t* aOutWidth,
int32_t* aOutHeight) int32_t* aOutHeight)
{ {
*aOutLeft = mRectDisplayPix.x; mRectDisplayPix.GetRect(aOutLeft, aOutTop, aOutWidth, aOutHeight);
*aOutTop = mRectDisplayPix.y;
*aOutWidth = mRectDisplayPix.width;
*aOutHeight = mRectDisplayPix.height;
return NS_OK; return NS_OK;
} }
@ -96,10 +90,7 @@ Screen::GetAvailRect(int32_t* aOutLeft,
int32_t* aOutWidth, int32_t* aOutWidth,
int32_t* aOutHeight) int32_t* aOutHeight)
{ {
*aOutLeft = mAvailRect.x; mAvailRect.GetRect(aOutLeft, aOutTop, aOutWidth, aOutHeight);
*aOutTop = mAvailRect.y;
*aOutWidth = mAvailRect.width;
*aOutHeight = mAvailRect.height;
return NS_OK; return NS_OK;
} }
@ -109,10 +100,7 @@ Screen::GetAvailRectDisplayPix(int32_t* aOutLeft,
int32_t* aOutWidth, int32_t* aOutWidth,
int32_t* aOutHeight) int32_t* aOutHeight)
{ {
*aOutLeft = mAvailRectDisplayPix.x; mAvailRectDisplayPix.GetRect(aOutLeft, aOutTop, aOutWidth, aOutHeight);
*aOutTop = mAvailRectDisplayPix.y;
*aOutWidth = mAvailRectDisplayPix.width;
*aOutHeight = mAvailRectDisplayPix.height;
return NS_OK; return NS_OK;
} }

View file

@ -156,7 +156,7 @@ ScreenManager::ScreenForRect(int32_t aX, int32_t aY,
// calculate the surface area // calculate the surface area
DesktopIntRect screenRect(x, y, width, height); DesktopIntRect screenRect(x, y, width, height);
screenRect.IntersectRect(screenRect, windowRect); screenRect.IntersectRect(screenRect, windowRect);
uint32_t tempArea = screenRect.width * screenRect.height; uint32_t tempArea = screenRect.Area();
if (tempArea > area) { if (tempArea > area) {
which = screen.get(); which = screen.get();
area = tempArea; area = tempArea;

View file

@ -33,15 +33,15 @@ ComputeTransformForRotation(const nsIntRect& aBounds,
case ROTATION_0: case ROTATION_0:
break; break;
case ROTATION_90: case ROTATION_90:
transform.PreTranslate(aBounds.width, 0); transform.PreTranslate(aBounds.Width(), 0);
transform.PreRotate(floatPi / 2); transform.PreRotate(floatPi / 2);
break; break;
case ROTATION_180: case ROTATION_180:
transform.PreTranslate(aBounds.width, aBounds.height); transform.PreTranslate(aBounds.Width(), aBounds.Height());
transform.PreRotate(floatPi); transform.PreRotate(floatPi);
break; break;
case ROTATION_270: case ROTATION_270:
transform.PreTranslate(0, aBounds.height); transform.PreTranslate(0, aBounds.Height());
transform.PreRotate(floatPi * 3 / 2); transform.PreRotate(floatPi * 3 / 2);
break; break;
default: default:
@ -61,15 +61,15 @@ ComputeTransformForUnRotation(const nsIntRect& aBounds,
case ROTATION_0: case ROTATION_0:
break; break;
case ROTATION_90: case ROTATION_90:
transform.PreTranslate(0, aBounds.height); transform.PreTranslate(0, aBounds.Height());
transform.PreRotate(floatPi * 3 / 2); transform.PreRotate(floatPi * 3 / 2);
break; break;
case ROTATION_180: case ROTATION_180:
transform.PreTranslate(aBounds.width, aBounds.height); transform.PreTranslate(aBounds.Width(), aBounds.Height());
transform.PreRotate(floatPi); transform.PreRotate(floatPi);
break; break;
case ROTATION_270: case ROTATION_270:
transform.PreTranslate(aBounds.width, 0); transform.PreTranslate(aBounds.Width(), 0);
transform.PreRotate(floatPi / 2); transform.PreRotate(floatPi / 2);
break; break;
default: default:
@ -86,17 +86,17 @@ nsIntRect RotateRect(nsIntRect aRect,
case ROTATION_0: case ROTATION_0:
return aRect; return aRect;
case ROTATION_90: case ROTATION_90:
return nsIntRect(aRect.y, return nsIntRect(aRect.Y(),
aBounds.width - aRect.x - aRect.width, aBounds.Width() - aRect.XMost(),
aRect.height, aRect.width); aRect.Height(), aRect.Width());
case ROTATION_180: case ROTATION_180:
return nsIntRect(aBounds.width - aRect.x - aRect.width, return nsIntRect(aBounds.Width() - aRect.XMost(),
aBounds.height - aRect.y - aRect.height, aBounds.Height() - aRect.YMost(),
aRect.width, aRect.height); aRect.Width(), aRect.Height());
case ROTATION_270: case ROTATION_270:
return nsIntRect(aBounds.height - aRect.y - aRect.height, return nsIntRect(aBounds.Height() - aRect.YMost(),
aRect.x, aRect.X(),
aRect.height, aRect.width); aRect.Height(), aRect.Width());
default: default:
MOZ_CRASH("Unknown rotation"); MOZ_CRASH("Unknown rotation");
} }

View file

@ -192,10 +192,10 @@ public:
DevPixelsToCocoaPoints(const LayoutDeviceIntRect& aRect, DevPixelsToCocoaPoints(const LayoutDeviceIntRect& aRect,
CGFloat aBackingScale) CGFloat aBackingScale)
{ {
return NSMakeRect((CGFloat)aRect.x / aBackingScale, return NSMakeRect((CGFloat)aRect.X() / aBackingScale,
(CGFloat)aRect.y / aBackingScale, (CGFloat)aRect.Y() / aBackingScale,
(CGFloat)aRect.width / aBackingScale, (CGFloat)aRect.Width() / aBackingScale,
(CGFloat)aRect.height / aBackingScale); (CGFloat)aRect.Height() / aBackingScale);
} }
// Returns the given y coordinate, which must be in screen coordinates, // Returns the given y coordinate, which must be in screen coordinates,

View file

@ -278,13 +278,12 @@ HeadlessWidget::Move(double aX, double aY)
// Since a popup window's x/y coordinates are in relation to // Since a popup window's x/y coordinates are in relation to
// the parent, the parent might have moved so we always move a // the parent, the parent might have moved so we always move a
// popup window. // popup window.
if (x == mBounds.x && y == mBounds.y && if (mBounds.IsEqualXY(x, y) &&
mWindowType != eWindowType_popup) { mWindowType != eWindowType_popup) {
return; return;
} }
mBounds.x = x; mBounds.MoveTo(x, y);
mBounds.y = y;
NotifyRollupGeometryChange(); NotifyRollupGeometryChange();
} }
@ -325,13 +324,13 @@ HeadlessWidget::Resize(double aWidth,
mBounds.SizeTo(LayoutDeviceIntSize(width, height)); mBounds.SizeTo(LayoutDeviceIntSize(width, height));
if (mCompositorWidget) { if (mCompositorWidget) {
mCompositorWidget->NotifyClientSizeChanged(LayoutDeviceIntSize(mBounds.width, mBounds.height)); mCompositorWidget->NotifyClientSizeChanged(LayoutDeviceIntSize(mBounds.Width(), mBounds.Height()));
} }
if (mWidgetListener) { if (mWidgetListener) {
mWidgetListener->WindowResized(this, mBounds.width, mBounds.height); mWidgetListener->WindowResized(this, mBounds.Width(), mBounds.Height());
} }
if (mAttachedWidgetListener) { if (mAttachedWidgetListener) {
mAttachedWidgetListener->WindowResized(this, mBounds.width, mBounds.height); mAttachedWidgetListener->WindowResized(this, mBounds.Width(), mBounds.Height());
} }
} }
@ -342,7 +341,7 @@ HeadlessWidget::Resize(double aX,
double aHeight, double aHeight,
bool aRepaint) bool aRepaint)
{ {
if (mBounds.x != aX || mBounds.y != aY) { if (!mBounds.IsEqualXY(aX, aY)) {
NotifyWindowMoved(aX, aY); NotifyWindowMoved(aX, aY);
} }
return Resize(aWidth, aHeight, aRepaint); return Resize(aWidth, aHeight, aRepaint);
@ -380,7 +379,7 @@ HeadlessWidget::ApplySizeModeSideEffects()
switch(mSizeMode) { switch(mSizeMode) {
case nsSizeMode_Normal: { case nsSizeMode_Normal: {
Resize(mRestoreBounds.x, mRestoreBounds.y, mRestoreBounds.width, mRestoreBounds.height, false); Resize(mRestoreBounds.X(), mRestoreBounds.Y(), mRestoreBounds.Width(), mRestoreBounds.Height(), false);
break; break;
} }
case nsSizeMode_Minimized: case nsSizeMode_Minimized:

View file

@ -543,9 +543,9 @@ nsBaseDragService::DrawDrag(nsIDOMNode* aDOMNode,
*aPresContext = nullptr; *aPresContext = nullptr;
// use a default size, in case of an error. // use a default size, in case of an error.
aScreenDragRect->MoveTo(aScreenPosition.x - mImageOffset.x, aScreenDragRect->SetRect(aScreenPosition.x - mImageOffset.x,
aScreenPosition.y - mImageOffset.y); aScreenPosition.y - mImageOffset.y,
aScreenDragRect->SizeTo(1, 1); 1, 1);
// if a drag image was specified, use that, otherwise, use the source node // if a drag image was specified, use that, otherwise, use the source node
nsCOMPtr<nsIDOMNode> dragNode = mImage ? mImage.get() : aDOMNode; nsCOMPtr<nsIDOMNode> dragNode = mImage ? mImage.get() : aDOMNode;
@ -581,8 +581,7 @@ nsBaseDragService::DrawDrag(nsIDOMNode* aDOMNode,
screenPosition.x -= mImageOffset.x; screenPosition.x -= mImageOffset.x;
screenPosition.y -= mImageOffset.y; screenPosition.y -= mImageOffset.y;
LayoutDeviceIntPoint screenPoint = ConvertToUnscaledDevPixels(*aPresContext, screenPosition); LayoutDeviceIntPoint screenPoint = ConvertToUnscaledDevPixels(*aPresContext, screenPosition);
aScreenDragRect->x = screenPoint.x; aScreenDragRect->MoveTo(screenPoint.x, screenPoint.y);
aScreenDragRect->y = screenPoint.y;
// check if drag images are disabled // check if drag images are disabled
bool enableDragImages = Preferences::GetBool(DRAGIMAGES_PREF, true); bool enableDragImages = Preferences::GetBool(DRAGIMAGES_PREF, true);
@ -594,7 +593,9 @@ nsBaseDragService::DrawDrag(nsIDOMNode* aDOMNode,
CSSIntRect dragRect; CSSIntRect dragRect;
if (aRegion) { if (aRegion) {
// the region's coordinates are relative to the root frame // the region's coordinates are relative to the root frame
aRegion->GetBoundingBox(&dragRect.x, &dragRect.y, &dragRect.width, &dragRect.height); int32_t dragRectX, dragRectY, dragRectW, dragRectH;
aRegion->GetBoundingBox(&dragRectX, &dragRectY, &dragRectW, &dragRectH);
dragRect.SetRect(dragRectX, dragRectY, dragRectW, dragRectH);
nsIFrame* rootFrame = presShell->GetRootFrame(); nsIFrame* rootFrame = presShell->GetRootFrame();
CSSIntRect screenRect = rootFrame->GetScreenRect(); CSSIntRect screenRect = rootFrame->GetScreenRect();
@ -613,7 +614,7 @@ nsBaseDragService::DrawDrag(nsIDOMNode* aDOMNode,
nsIntRect dragRectDev = nsIntRect dragRectDev =
ToAppUnits(dragRect, nsPresContext::AppUnitsPerCSSPixel()). ToAppUnits(dragRect, nsPresContext::AppUnitsPerCSSPixel()).
ToOutsidePixels((*aPresContext)->AppUnitsPerDevPixel()); ToOutsidePixels((*aPresContext)->AppUnitsPerDevPixel());
aScreenDragRect->SizeTo(dragRectDev.width, dragRectDev.height); aScreenDragRect->SizeTo(dragRectDev.Width(), dragRectDev.Height());
return NS_OK; return NS_OK;
} }
@ -698,8 +699,7 @@ nsBaseDragService::DrawDrag(nsIDOMNode* aDOMNode,
// If an image was specified, reset the position from the offset that was supplied. // If an image was specified, reset the position from the offset that was supplied.
if (mImage) { if (mImage) {
aScreenDragRect->x = screenPoint.x; aScreenDragRect->MoveTo(screenPoint.x, screenPoint.y);
aScreenDragRect->y = screenPoint.y;
} }
return NS_OK; return NS_OK;
@ -734,20 +734,19 @@ nsBaseDragService::DrawDragForImage(nsPresContext* aPresContext,
rv = imgContainer->GetHeight(&imageHeight); rv = imgContainer->GetHeight(&imageHeight);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
aScreenDragRect->width = aPresContext->CSSPixelsToDevPixels(imageWidth); aScreenDragRect->SizeTo(aPresContext->CSSPixelsToDevPixels(imageWidth),
aScreenDragRect->height = aPresContext->CSSPixelsToDevPixels(imageHeight); aPresContext->CSSPixelsToDevPixels(imageHeight));
} }
else { else {
// XXX The canvas size should be converted to dev pixels. // XXX The canvas size should be converted to dev pixels.
NS_ASSERTION(aCanvas, "both image and canvas are null"); NS_ASSERTION(aCanvas, "both image and canvas are null");
nsIntSize sz = aCanvas->GetSize(); nsIntSize sz = aCanvas->GetSize();
aScreenDragRect->width = sz.width; aScreenDragRect->SizeTo(sz.width, sz.height);
aScreenDragRect->height = sz.height;
} }
nsIntSize destSize; nsIntSize destSize;
destSize.width = aScreenDragRect->width; destSize.width = aScreenDragRect->Width();
destSize.height = aScreenDragRect->height; destSize.height = aScreenDragRect->Height();
if (destSize.width == 0 || destSize.height == 0) if (destSize.width == 0 || destSize.height == 0)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;

View file

@ -748,7 +748,7 @@ nsBaseWidget::GetWindowClipRegion(nsTArray<LayoutDeviceIntRect>* aRects)
if (mClipRects) { if (mClipRects) {
aRects->AppendElements(mClipRects.get(), mClipRectCount); aRects->AppendElements(mClipRects.get(), mClipRectCount);
} else { } else {
aRects->AppendElement(LayoutDeviceIntRect(0, 0, mBounds.width, mBounds.height)); aRects->AppendElement(LayoutDeviceIntRect(0, 0, mBounds.Width(), mBounds.Height()));
} }
} }
@ -837,10 +837,11 @@ nsBaseWidget::InfallibleMakeFullScreen(bool aFullScreen, nsIScreen* aScreen)
} else if (mOriginalBounds) { } else if (mOriginalBounds) {
if (BoundsUseDesktopPixels()) { if (BoundsUseDesktopPixels()) {
DesktopRect deskRect = *mOriginalBounds / GetDesktopToDeviceScale(); DesktopRect deskRect = *mOriginalBounds / GetDesktopToDeviceScale();
Resize(deskRect.x, deskRect.y, deskRect.width, deskRect.height, true); Resize(deskRect.X(), deskRect.Y(),
deskRect.Width(), deskRect.Height(), true);
} else { } else {
Resize(mOriginalBounds->x, mOriginalBounds->y, mOriginalBounds->width, Resize(mOriginalBounds->X(), mOriginalBounds->Y(),
mOriginalBounds->height, true); mOriginalBounds->Width(), mOriginalBounds->Height(), true);
} }
} }
} }
@ -902,7 +903,7 @@ nsBaseWidget::UseAPZ()
void nsBaseWidget::CreateCompositor() void nsBaseWidget::CreateCompositor()
{ {
LayoutDeviceIntRect rect = GetBounds(); LayoutDeviceIntRect rect = GetBounds();
CreateCompositor(rect.width, rect.height); CreateCompositor(rect.Width(), rect.Height());
} }
already_AddRefed<GeckoContentController> already_AddRefed<GeckoContentController>
@ -1534,13 +1535,13 @@ nsBaseWidget::ResizeClient(double aWidth, double aHeight, bool aRepaint)
// if that's what this widget uses for the Move/Resize APIs // if that's what this widget uses for the Move/Resize APIs
if (BoundsUseDesktopPixels()) { if (BoundsUseDesktopPixels()) {
DesktopSize desktopDelta = DesktopSize desktopDelta =
(LayoutDeviceIntSize(mBounds.width, mBounds.height) - (LayoutDeviceIntSize(mBounds.Width(), mBounds.Height()) -
clientBounds.Size()) / GetDesktopToDeviceScale(); clientBounds.Size()) / GetDesktopToDeviceScale();
Resize(aWidth + desktopDelta.width, aHeight + desktopDelta.height, Resize(aWidth + desktopDelta.width, aHeight + desktopDelta.height,
aRepaint); aRepaint);
} else { } else {
Resize(mBounds.width + (aWidth - clientBounds.width), Resize(mBounds.Width() + (aWidth - clientBounds.Width()),
mBounds.height + (aHeight - clientBounds.height), aRepaint); mBounds.Height() + (aHeight - clientBounds.Height()), aRepaint);
} }
} }
@ -1561,15 +1562,15 @@ nsBaseWidget::ResizeClient(double aX,
DesktopToLayoutDeviceScale scale = GetDesktopToDeviceScale(); DesktopToLayoutDeviceScale scale = GetDesktopToDeviceScale();
DesktopPoint desktopOffset = clientOffset / scale; DesktopPoint desktopOffset = clientOffset / scale;
DesktopSize desktopDelta = DesktopSize desktopDelta =
(LayoutDeviceIntSize(mBounds.width, mBounds.height) - (LayoutDeviceIntSize(mBounds.Width(), mBounds.Height()) -
clientBounds.Size()) / scale; clientBounds.Size()) / scale;
Resize(aX - desktopOffset.x, aY - desktopOffset.y, Resize(aX - desktopOffset.x, aY - desktopOffset.y,
aWidth + desktopDelta.width, aHeight + desktopDelta.height, aWidth + desktopDelta.width, aHeight + desktopDelta.height,
aRepaint); aRepaint);
} else { } else {
Resize(aX - clientOffset.x, aY - clientOffset.y, Resize(aX - clientOffset.x, aY - clientOffset.y,
aWidth + mBounds.width - clientBounds.width, aWidth + mBounds.Width() - clientBounds.Width(),
aHeight + mBounds.height - clientBounds.height, aHeight + mBounds.Height() - clientBounds.Height(),
aRepaint); aRepaint);
} }
} }
@ -1974,8 +1975,8 @@ nsBaseWidget::GetWidgetScreen()
LayoutDeviceIntRect bounds = GetScreenBounds(); LayoutDeviceIntRect bounds = GetScreenBounds();
DesktopIntRect deskBounds = RoundedToInt(bounds / GetDesktopToDeviceScale()); DesktopIntRect deskBounds = RoundedToInt(bounds / GetDesktopToDeviceScale());
nsCOMPtr<nsIScreen> screen; nsCOMPtr<nsIScreen> screen;
screenManager->ScreenForRect(deskBounds.x, deskBounds.y, screenManager->ScreenForRect(deskBounds.X(), deskBounds.Y(),
deskBounds.width, deskBounds.height, deskBounds.Width(), deskBounds.Height(),
getter_AddRefs(screen)); getter_AddRefs(screen));
return screen.forget(); return screen.forget();
} }
@ -2322,7 +2323,7 @@ void
nsBaseWidget::UpdateScrollCapture() nsBaseWidget::UpdateScrollCapture()
{ {
// Don't capture if no container or no size. // Don't capture if no container or no size.
if (!mScrollCaptureContainer || mBounds.width <= 0 || mBounds.height <= 0) { if (!mScrollCaptureContainer || mBounds.IsEmpty()) {
return; return;
} }
@ -3379,7 +3380,7 @@ nsBaseWidget::debug_DumpPaintEvent(FILE * aFileOut,
(void *) aWidget, (void *) aWidget,
aWidgetName, aWidgetName,
aWindowID, aWindowID,
rect.x, rect.y, rect.width, rect.height rect.X(), rect.Y(), rect.Width(), rect.Height()
); );
fprintf(aFileOut,"\n"); fprintf(aFileOut,"\n");
@ -3408,7 +3409,7 @@ nsBaseWidget::debug_DumpInvalidate(FILE* aFileOut,
if (aRect) { if (aRect) {
fprintf(aFileOut, fprintf(aFileOut,
" rect=%3d,%-3d %3d,%-3d", " rect=%3d,%-3d %3d,%-3d",
aRect->x, aRect->y, aRect->width, aRect->height); aRect->X(), aRect->Y(), aRect->Width(), aRect->Height());
} else { } else {
fprintf(aFileOut, fprintf(aFileOut,
" rect=%-15s", " rect=%-15s",

View file

@ -482,7 +482,7 @@ nsNativeTheme::IsLastTreeHeaderCell(nsIFrame* aFrame)
return false; return false;
while ((aFrame = aFrame->GetNextSibling())) { while ((aFrame = aFrame->GetNextSibling())) {
if (aFrame->GetRect().width > 0) if (aFrame->GetRect().Width() > 0)
return false; return false;
} }
return true; return true;
@ -512,7 +512,7 @@ nsNativeTheme::IsFirstTab(nsIFrame* aFrame)
return false; return false;
for (nsIFrame* first : aFrame->GetParent()->PrincipalChildList()) { for (nsIFrame* first : aFrame->GetParent()->PrincipalChildList()) {
if (first->GetRect().width > 0 && if (first->GetRect().Width() > 0 &&
first->GetContent()->IsXULElement(nsGkAtoms::tab)) first->GetContent()->IsXULElement(nsGkAtoms::tab))
return (first == aFrame); return (first == aFrame);
} }
@ -547,7 +547,7 @@ nsNativeTheme::IsNextToSelectedTab(nsIFrame* aFrame, int32_t aOffset)
nsIFrame* currentTab = aFrame->GetParent()->PrincipalChildList().FirstChild(); nsIFrame* currentTab = aFrame->GetParent()->PrincipalChildList().FirstChild();
for (int32_t i = 0; currentTab; currentTab = currentTab->GetNextSibling()) { for (int32_t i = 0; currentTab; currentTab = currentTab->GetNextSibling()) {
if (currentTab->GetRect().width == 0) if (currentTab->GetRect().Width() == 0)
continue; continue;
if (aFrame == currentTab) if (aFrame == currentTab)
thisTabIndex = i; thisTabIndex = i;
@ -625,7 +625,7 @@ nsNativeTheme::IsSubmenu(nsIFrame* aFrame, bool* aLeftOfParent)
LayoutDeviceIntRect selfBounds, parentBounds; LayoutDeviceIntRect selfBounds, parentBounds;
selfBounds = aFrame->GetNearestWidget()->GetScreenBounds(); selfBounds = aFrame->GetNearestWidget()->GetScreenBounds();
parentBounds = parent->GetNearestWidget()->GetScreenBounds(); parentBounds = parent->GetNearestWidget()->GetScreenBounds();
*aLeftOfParent = selfBounds.x < parentBounds.x; *aLeftOfParent = selfBounds.X() < parentBounds.X();
} }
return true; return true;
} }
@ -733,13 +733,13 @@ nsNativeTheme::GetAdjacentSiblingFrameWithSameAppearance(nsIFrame* aFrame,
nsIFrame* sibling = aFrame; nsIFrame* sibling = aFrame;
do { do {
sibling = aNextSibling ? sibling->GetNextSibling() : sibling->GetPrevSibling(); sibling = aNextSibling ? sibling->GetNextSibling() : sibling->GetPrevSibling();
} while (sibling && sibling->GetRect().width == 0); } while (sibling && sibling->GetRect().Width() == 0);
// Check same appearance and adjacency. // Check same appearance and adjacency.
if (!sibling || if (!sibling ||
sibling->StyleDisplay()->mAppearance != aFrame->StyleDisplay()->mAppearance || sibling->StyleDisplay()->mAppearance != aFrame->StyleDisplay()->mAppearance ||
(sibling->GetRect().XMost() != aFrame->GetRect().x && (sibling->GetRect().XMost() != aFrame->GetRect().X() &&
aFrame->GetRect().XMost() != sibling->GetRect().x)) aFrame->GetRect().XMost() != sibling->GetRect().X()))
return nullptr; return nullptr;
return sibling; return sibling;
} }

View file

@ -1736,10 +1736,10 @@ IMMHandler::HandleQueryCharPosition(nsWindow* aWindow,
// documented) and its horizontal width. So, it might be better to set // documented) and its horizontal width. So, it might be better to set
// top-right corner of the character and horizontal width, but we're not // top-right corner of the character and horizontal width, but we're not
// sure if it doesn't cause any problems with a lot of IMEs... // sure if it doesn't cause any problems with a lot of IMEs...
pCharPosition->pt.x = screenRect.x; pCharPosition->pt.x = screenRect.X();
pCharPosition->pt.y = screenRect.y; pCharPosition->pt.y = screenRect.Y();
pCharPosition->cLineHeight = r.height; pCharPosition->cLineHeight = r.Height();
WidgetQueryContentEvent editorRect(true, eQueryEditorRect, aWindow); WidgetQueryContentEvent editorRect(true, eQueryEditorRect, aWindow);
aWindow->InitEvent(editorRect); aWindow->InitEvent(editorRect);
@ -1755,7 +1755,7 @@ IMMHandler::HandleQueryCharPosition(nsWindow* aWindow,
LayoutDeviceIntRect editorRectInScreen; LayoutDeviceIntRect editorRectInScreen;
ResolveIMECaretPos(window, editorRectInWindow, nullptr, editorRectInScreen); ResolveIMECaretPos(window, editorRectInWindow, nullptr, editorRectInScreen);
::SetRect(&pCharPosition->rcDocument, ::SetRect(&pCharPosition->rcDocument,
editorRectInScreen.x, editorRectInScreen.y, editorRectInScreen.X(), editorRectInScreen.Y(),
editorRectInScreen.XMost(), editorRectInScreen.YMost()); editorRectInScreen.XMost(), editorRectInScreen.YMost());
} }
@ -2264,7 +2264,7 @@ IMMHandler::GetCharacterRectOfSelectedTextAt(nsWindow* aWindow,
("GetCharacterRectOfSelectedTextAt, Succeeded, aOffset=%u, " ("GetCharacterRectOfSelectedTextAt, Succeeded, aOffset=%u, "
"aCharRect={ x: %ld, y: %ld, width: %ld, height: %ld }, " "aCharRect={ x: %ld, y: %ld, width: %ld, height: %ld }, "
"charRect.GetWritingMode()=%s", "charRect.GetWritingMode()=%s",
aOffset, aCharRect.x, aCharRect.y, aCharRect.width, aCharRect.height, aOffset, aCharRect.X(), aCharRect.Y(), aCharRect.Width(), aCharRect.Height(),
GetWritingModeName(charRect.GetWritingMode()).get())); GetWritingModeName(charRect.GetWritingMode()).get()));
return true; return true;
} }
@ -2299,7 +2299,7 @@ IMMHandler::GetCaretRect(nsWindow* aWindow,
("GetCaretRect, SUCCEEDED, " ("GetCaretRect, SUCCEEDED, "
"aCaretRect={ x: %ld, y: %ld, width: %ld, height: %ld }, " "aCaretRect={ x: %ld, y: %ld, width: %ld, height: %ld }, "
"caretRect.GetWritingMode()=%s", "caretRect.GetWritingMode()=%s",
aCaretRect.x, aCaretRect.y, aCaretRect.width, aCaretRect.height, aCaretRect.X(), aCaretRect.Y(), aCaretRect.Width(), aCaretRect.Height(),
GetWritingModeName(caretRect.GetWritingMode()).get())); GetWritingModeName(caretRect.GetWritingMode()).get()));
return true; return true;
} }
@ -2326,17 +2326,17 @@ IMMHandler::SetIMERelatedWindowsPos(nsWindow* aWindow,
ResolveIMECaretPos(toplevelWindow, r, aWindow, caretRect); ResolveIMECaretPos(toplevelWindow, r, aWindow, caretRect);
} else { } else {
NS_WARNING("failed to get caret rect"); NS_WARNING("failed to get caret rect");
caretRect.width = 1; caretRect.SetWidth(1);
} }
if (!mNativeCaretIsCreated) { if (!mNativeCaretIsCreated) {
mNativeCaretIsCreated = ::CreateCaret(aWindow->GetWindowHandle(), nullptr, mNativeCaretIsCreated = ::CreateCaret(aWindow->GetWindowHandle(), nullptr,
caretRect.width, caretRect.height); caretRect.Width(), caretRect.Height());
MOZ_LOG(gIMMLog, LogLevel::Info, MOZ_LOG(gIMMLog, LogLevel::Info,
("SetIMERelatedWindowsPos, mNativeCaretIsCreated=%s, " ("SetIMERelatedWindowsPos, mNativeCaretIsCreated=%s, "
"width=%ld, height=%ld", "width=%ld, height=%ld",
GetBoolName(mNativeCaretIsCreated), caretRect.width, caretRect.height)); GetBoolName(mNativeCaretIsCreated), caretRect.Width(), caretRect.Height()));
} }
::SetCaretPos(caretRect.x, caretRect.y); ::SetCaretPos(caretRect.X(), caretRect.Y());
if (ShouldDrawCompositionStringOurselves()) { if (ShouldDrawCompositionStringOurselves()) {
MOZ_LOG(gIMMLog, LogLevel::Info, MOZ_LOG(gIMMLog, LogLevel::Info,
@ -2388,22 +2388,22 @@ IMMHandler::SetIMERelatedWindowsPos(nsWindow* aWindow,
candForm.dwStyle = CFS_EXCLUDE; candForm.dwStyle = CFS_EXCLUDE;
// Candidate window shouldn't overlap the target clause in any writing // Candidate window shouldn't overlap the target clause in any writing
// mode. // mode.
candForm.rcArea.left = targetClauseRect.x; candForm.rcArea.left = targetClauseRect.X();
candForm.rcArea.right = targetClauseRect.XMost(); candForm.rcArea.right = targetClauseRect.XMost();
candForm.rcArea.top = targetClauseRect.y; candForm.rcArea.top = targetClauseRect.Y();
candForm.rcArea.bottom = targetClauseRect.YMost(); candForm.rcArea.bottom = targetClauseRect.YMost();
if (!writingMode.IsVertical()) { if (!writingMode.IsVertical()) {
// In horizontal layout, current point of interest should be top-left // In horizontal layout, current point of interest should be top-left
// of the first character. // of the first character.
candForm.ptCurrentPos.x = firstTargetCharRect.x; candForm.ptCurrentPos.x = firstTargetCharRect.X();
candForm.ptCurrentPos.y = firstTargetCharRect.y; candForm.ptCurrentPos.y = firstTargetCharRect.Y();
} else if (writingMode.IsVerticalRL()) { } else if (writingMode.IsVerticalRL()) {
// In vertical layout (RL), candidate window should be positioned right // In vertical layout (RL), candidate window should be positioned right
// side of target clause. However, we don't set vertical writing font // side of target clause. However, we don't set vertical writing font
// to the IME. Therefore, the candidate window may be positioned // to the IME. Therefore, the candidate window may be positioned
// bottom-left of target clause rect with these information. // bottom-left of target clause rect with these information.
candForm.ptCurrentPos.x = targetClauseRect.x; candForm.ptCurrentPos.x = targetClauseRect.X();
candForm.ptCurrentPos.y = targetClauseRect.y; candForm.ptCurrentPos.y = targetClauseRect.Y();
} else { } else {
MOZ_ASSERT(writingMode.IsVerticalLR(), "Did we miss some causes?"); MOZ_ASSERT(writingMode.IsVerticalLR(), "Did we miss some causes?");
// In vertical layout (LR), candidate window should be poisitioned left // In vertical layout (LR), candidate window should be poisitioned left
@ -2411,7 +2411,7 @@ IMMHandler::SetIMERelatedWindowsPos(nsWindow* aWindow,
// to the IME, the candidate window may be positioned bottom-right of // to the IME, the candidate window may be positioned bottom-right of
// the target clause rect with these information. // the target clause rect with these information.
candForm.ptCurrentPos.x = targetClauseRect.XMost(); candForm.ptCurrentPos.x = targetClauseRect.XMost();
candForm.ptCurrentPos.y = targetClauseRect.y; candForm.ptCurrentPos.y = targetClauseRect.Y();
} }
} else { } else {
// If vertical writing is not supported by IME, let's set candidate // If vertical writing is not supported by IME, let's set candidate
@ -2419,7 +2419,7 @@ IMMHandler::SetIMERelatedWindowsPos(nsWindow* aWindow,
// the position must be the safest position to prevent the candidate // the position must be the safest position to prevent the candidate
// window to overlap with the target clause. // window to overlap with the target clause.
candForm.dwStyle = CFS_CANDIDATEPOS; candForm.dwStyle = CFS_CANDIDATEPOS;
candForm.ptCurrentPos.x = targetClauseRect.x; candForm.ptCurrentPos.x = targetClauseRect.X();
candForm.ptCurrentPos.y = targetClauseRect.YMost(); candForm.ptCurrentPos.y = targetClauseRect.YMost();
} }
MOZ_LOG(gIMMLog, LogLevel::Info, MOZ_LOG(gIMMLog, LogLevel::Info,
@ -2443,9 +2443,9 @@ IMMHandler::SetIMERelatedWindowsPos(nsWindow* aWindow,
COMPOSITIONFORM compForm; COMPOSITIONFORM compForm;
compForm.dwStyle = CFS_POINT; compForm.dwStyle = CFS_POINT;
compForm.ptCurrentPos.x = compForm.ptCurrentPos.x =
!writingMode.IsVerticalLR() ? firstSelectedCharRect.x : !writingMode.IsVerticalLR() ? firstSelectedCharRect.X() :
firstSelectedCharRect.XMost(); firstSelectedCharRect.XMost();
compForm.ptCurrentPos.y = firstSelectedCharRect.y; compForm.ptCurrentPos.y = firstSelectedCharRect.Y();
::ImmSetCompositionWindow(aContext.get(), &compForm); ::ImmSetCompositionWindow(aContext.get(), &compForm);
} }
@ -2473,19 +2473,18 @@ IMMHandler::SetIMERelatedWindowsPosOnPlugin(nsWindow* aWindow,
editorRectEvent.mReply.mRect + toplevelWindow->WidgetToScreenOffset(); editorRectEvent.mReply.mRect + toplevelWindow->WidgetToScreenOffset();
LayoutDeviceIntRect winRectInScreen = aWindow->GetClientBounds(); LayoutDeviceIntRect winRectInScreen = aWindow->GetClientBounds();
// composition window cannot be positioned on the edge of client area. // composition window cannot be positioned on the edge of client area.
winRectInScreen.width--; winRectInScreen.SizeTo(winRectInScreen.Width() - 1,
winRectInScreen.height--; winRectInScreen.Height() - 1);
LayoutDeviceIntRect clippedPluginRect; LayoutDeviceIntRect clippedPluginRect;
clippedPluginRect.x = clippedPluginRect.MoveTo(
std::min(std::max(pluginRectInScreen.x, winRectInScreen.x), std::min(std::max(pluginRectInScreen.X(), winRectInScreen.X()),
winRectInScreen.XMost()); winRectInScreen.XMost()),
clippedPluginRect.y = std::min(std::max(pluginRectInScreen.Y(), winRectInScreen.Y()),
std::min(std::max(pluginRectInScreen.y, winRectInScreen.y), winRectInScreen.YMost()));
winRectInScreen.YMost());
int32_t xMost = std::min(pluginRectInScreen.XMost(), winRectInScreen.XMost()); int32_t xMost = std::min(pluginRectInScreen.XMost(), winRectInScreen.XMost());
int32_t yMost = std::min(pluginRectInScreen.YMost(), winRectInScreen.YMost()); int32_t yMost = std::min(pluginRectInScreen.YMost(), winRectInScreen.YMost());
clippedPluginRect.width = std::max(0, xMost - clippedPluginRect.x); clippedPluginRect.SizeTo(std::max(0, xMost - clippedPluginRect.X()),
clippedPluginRect.height = std::max(0, yMost - clippedPluginRect.y); std::max(0, yMost - clippedPluginRect.Y()));
clippedPluginRect -= aWindow->WidgetToScreenOffset(); clippedPluginRect -= aWindow->WidgetToScreenOffset();
// Cover the plugin with native caret. This prevents IME's window and plugin // Cover the plugin with native caret. This prevents IME's window and plugin
@ -2495,8 +2494,8 @@ IMMHandler::SetIMERelatedWindowsPosOnPlugin(nsWindow* aWindow,
} }
mNativeCaretIsCreated = mNativeCaretIsCreated =
::CreateCaret(aWindow->GetWindowHandle(), nullptr, ::CreateCaret(aWindow->GetWindowHandle(), nullptr,
clippedPluginRect.width, clippedPluginRect.height); clippedPluginRect.Width(), clippedPluginRect.Height());
::SetCaretPos(clippedPluginRect.x, clippedPluginRect.y); ::SetCaretPos(clippedPluginRect.X(), clippedPluginRect.Y());
// Set the composition window to bottom-left of the clipped plugin. // Set the composition window to bottom-left of the clipped plugin.
// As far as we know, there is no IME for RTL language. Therefore, this code // As far as we know, there is no IME for RTL language. Therefore, this code
@ -2721,7 +2720,7 @@ IMMHandler::OnMouseButtonEvent(nsWindow* aWindow,
aIMENotification.mMouseButtonEventData.mCursorPos.AsIntPoint(); aIMENotification.mMouseButtonEventData.mCursorPos.AsIntPoint();
nsIntRect charRect = nsIntRect charRect =
aIMENotification.mMouseButtonEventData.mCharRect.AsIntRect(); aIMENotification.mMouseButtonEventData.mCharRect.AsIntRect();
int32_t cursorXInChar = cursorPos.x - charRect.x; int32_t cursorXInChar = cursorPos.x - charRect.X();
// The event might hit to zero-width character, see bug 694913. // The event might hit to zero-width character, see bug 694913.
// The reason might be: // The reason might be:
// * There are some zero-width characters are actually. // * There are some zero-width characters are actually.
@ -2730,8 +2729,8 @@ IMMHandler::OnMouseButtonEvent(nsWindow* aWindow,
// We should assume that user clicked on right most of the zero-width // We should assume that user clicked on right most of the zero-width
// character in such case. // character in such case.
int positioning = 1; int positioning = 1;
if (charRect.width > 0) { if (charRect.Width() > 0) {
positioning = cursorXInChar * 4 / charRect.width; positioning = cursorXInChar * 4 / charRect.Width();
positioning = (positioning + 2) % 4; positioning = (positioning + 2) % 4;
} }

View file

@ -51,8 +51,8 @@ CollectMonitors(HMONITOR aMon, HDC hDCScreen, LPRECT, LPARAM ioParam)
float dpi = WinUtils::MonitorDPI(aMon); float dpi = WinUtils::MonitorDPI(aMon);
MOZ_LOG(sScreenLog, LogLevel::Debug, MOZ_LOG(sScreenLog, LogLevel::Debug,
("New screen [%d %d %d %d (%d %d %d %d) %d %f %f %f]", ("New screen [%d %d %d %d (%d %d %d %d) %d %f %f %f]",
rect.x, rect.y, rect.width, rect.height, rect.X(), rect.Y(), rect.Width(), rect.Height(),
availRect.x, availRect.y, availRect.width, availRect.height, availRect.X(), availRect.Y(), availRect.Width(), availRect.Height(),
pixelDepth, contentsScaleFactor.scale, defaultCssScaleFactor.scale, pixelDepth, contentsScaleFactor.scale, defaultCssScaleFactor.scale,
dpi)); dpi));
auto screen = new Screen(rect, availRect, auto screen = new Screen(rect, availRect,

View file

@ -4480,10 +4480,10 @@ TSFTextStore::GetTextExt(TsViewCookie vcView,
} }
// IMEs don't like empty rects, fix here // IMEs don't like empty rects, fix here
if (event.mReply.mRect.width <= 0) if (event.mReply.mRect.Width() <= 0)
event.mReply.mRect.width = 1; event.mReply.mRect.SetWidth(1);
if (event.mReply.mRect.height <= 0) if (event.mReply.mRect.Height() <= 0)
event.mReply.mRect.height = 1; event.mReply.mRect.SetHeight(1);
// convert to unclipped screen rect // convert to unclipped screen rect
nsWindow* refWindow = static_cast<nsWindow*>( nsWindow* refWindow = static_cast<nsWindow*>(
@ -4509,7 +4509,7 @@ TSFTextStore::GetTextExt(TsViewCookie vcView,
// clip text rect to bounding rect // clip text rect to bounding rect
RECT textRect; RECT textRect;
::SetRect(&textRect, event.mReply.mRect.x, event.mReply.mRect.y, ::SetRect(&textRect, event.mReply.mRect.X(), event.mReply.mRect.Y(),
event.mReply.mRect.XMost(), event.mReply.mRect.YMost()); event.mReply.mRect.XMost(), event.mReply.mRect.YMost());
if (!::IntersectRect(prc, prc, &textRect)) if (!::IntersectRect(prc, prc, &textRect))
// Text is not visible // Text is not visible
@ -4621,7 +4621,7 @@ TSFTextStore::GetScreenExtInternal(RECT& aScreenExt)
boundRect.IntersectRect(event.mReply.mRect, boundRect); boundRect.IntersectRect(event.mReply.mRect, boundRect);
if (!boundRect.IsEmpty()) { if (!boundRect.IsEmpty()) {
boundRect.MoveBy(refWindow->WidgetToScreenOffset()); boundRect.MoveBy(refWindow->WidgetToScreenOffset());
::SetRect(&aScreenExt, boundRect.x, boundRect.y, ::SetRect(&aScreenExt, boundRect.X(), boundRect.Y(),
boundRect.XMost(), boundRect.YMost()); boundRect.XMost(), boundRect.YMost());
} else { } else {
::SetRectEmpty(&aScreenExt); ::SetRectEmpty(&aScreenExt);
@ -5941,9 +5941,9 @@ TSFTextStore::OnMouseButtonEventInternal(
nsIntPoint cursorPos = nsIntPoint cursorPos =
aIMENotification.mMouseButtonEventData.mCursorPos.AsIntPoint(); aIMENotification.mMouseButtonEventData.mCursorPos.AsIntPoint();
ULONG quadrant = 1; ULONG quadrant = 1;
if (charRect.width > 0) { if (charRect.Width() > 0) {
int32_t cursorXInChar = cursorPos.x - charRect.x; int32_t cursorXInChar = cursorPos.x - charRect.X();
quadrant = cursorXInChar * 4 / charRect.width; quadrant = cursorXInChar * 4 / charRect.Width();
quadrant = (quadrant + 2) % 4; quadrant = (quadrant + 2) % 4;
} }
ULONG edge = quadrant < 2 ? offset + 1 : offset; ULONG edge = quadrant < 2 ? offset + 1 : offset;
@ -6038,7 +6038,7 @@ TSFTextStore::CreateNativeCaret()
LayoutDeviceIntRect& caretRect = queryCaretRect.mReply.mRect; LayoutDeviceIntRect& caretRect = queryCaretRect.mReply.mRect;
mNativeCaretIsCreated = ::CreateCaret(mWidget->GetWindowHandle(), nullptr, mNativeCaretIsCreated = ::CreateCaret(mWidget->GetWindowHandle(), nullptr,
caretRect.width, caretRect.height); caretRect.Width(), caretRect.Height());
if (!mNativeCaretIsCreated) { if (!mNativeCaretIsCreated) {
MOZ_LOG(sTextStoreLog, LogLevel::Error, MOZ_LOG(sTextStoreLog, LogLevel::Error,
("0x%p TSFTextStore::CreateNativeCaret() FAILED due to " ("0x%p TSFTextStore::CreateNativeCaret() FAILED due to "
@ -6060,7 +6060,7 @@ TSFTextStore::CreateNativeCaret()
caretRect.MoveBy(-window->WidgetToScreenOffset()); caretRect.MoveBy(-window->WidgetToScreenOffset());
} }
::SetCaretPos(caretRect.x, caretRect.y); ::SetCaretPos(caretRect.X(), caretRect.Y());
} }
void void

View file

@ -673,10 +673,10 @@ WinUtils::MonitorFromRect(const gfx::Rect& rect)
IsPerMonitorDPIAware() ? 1.0 : LogToPhysFactor(GetPrimaryMonitor()); IsPerMonitorDPIAware() ? 1.0 : LogToPhysFactor(GetPrimaryMonitor());
RECT globalWindowBounds = { RECT globalWindowBounds = {
NSToIntRound(dpiScale * rect.x), NSToIntRound(dpiScale * rect.X()),
NSToIntRound(dpiScale * rect.y), NSToIntRound(dpiScale * rect.Y()),
NSToIntRound(dpiScale * (rect.x + rect.width)), NSToIntRound(dpiScale * (rect.XMost())),
NSToIntRound(dpiScale * (rect.y + rect.height)) NSToIntRound(dpiScale * (rect.YMost()))
}; };
return ::MonitorFromRect(&globalWindowBounds, MONITOR_DEFAULTTONEAREST); return ::MonitorFromRect(&globalWindowBounds, MONITOR_DEFAULTTONEAREST);
@ -1174,8 +1174,8 @@ WinUtils::InvalidatePluginAsWorkaround(nsIWidget* aWidget,
if (windowRect.top == 0 && windowRect.left == 0) { if (windowRect.top == 0 && windowRect.left == 0) {
RECT rect; RECT rect;
rect.left = aRect.x; rect.left = aRect.X();
rect.top = aRect.y; rect.top = aRect.Y();
rect.right = aRect.XMost(); rect.right = aRect.XMost();
rect.bottom = aRect.YMost(); rect.bottom = aRect.YMost();

View file

@ -87,7 +87,7 @@ nsDragService::CreateDragImage(nsIDOMNode *aDOMNode,
if (!surface) if (!surface)
return false; return false;
uint32_t bmWidth = dragRect.width, bmHeight = dragRect.height; uint32_t bmWidth = dragRect.Width(), bmHeight = dragRect.Height();
if (bmWidth == 0 || bmHeight == 0) if (bmWidth == 0 || bmHeight == 0)
return false; return false;
@ -152,8 +152,8 @@ nsDragService::CreateDragImage(nsIDOMNode *aDOMNode,
LayoutDeviceIntPoint screenPoint = LayoutDeviceIntPoint screenPoint =
ConvertToUnscaledDevPixels(pc, mScreenPosition); ConvertToUnscaledDevPixels(pc, mScreenPosition);
psdi->ptOffset.x = screenPoint.x - dragRect.x; psdi->ptOffset.x = screenPoint.x - dragRect.X();
psdi->ptOffset.y = screenPoint.y - dragRect.y; psdi->ptOffset.y = screenPoint.y - dragRect.Y();
DeleteDC(hdcSrc); DeleteDC(hdcSrc);
} }

View file

@ -1584,8 +1584,8 @@ nsNativeThemeWin::DrawWidgetBackground(gfxContext* aContext,
gfxFloat p2a = gfxFloat(aFrame->PresContext()->AppUnitsPerDevPixel()); gfxFloat p2a = gfxFloat(aFrame->PresContext()->AppUnitsPerDevPixel());
RECT widgetRect; RECT widgetRect;
RECT clipRect; RECT clipRect;
gfxRect tr(aRect.x, aRect.y, aRect.width, aRect.height), gfxRect tr(aRect.X(), aRect.Y(), aRect.Width(), aRect.Height()),
dr(aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); dr(aDirtyRect.X(), aDirtyRect.Y(), aDirtyRect.Width(), aDirtyRect.Height());
tr.Scale(1.0 / (p2a * themeScale)); tr.Scale(1.0 / (p2a * themeScale));
dr.Scale(1.0 / (p2a * themeScale)); dr.Scale(1.0 / (p2a * themeScale));
@ -3551,8 +3551,8 @@ nsresult nsNativeThemeWin::ClassicDrawWidgetBackground(gfxContext* aContext,
gfxFloat p2a = gfxFloat(aFrame->PresContext()->AppUnitsPerDevPixel()); gfxFloat p2a = gfxFloat(aFrame->PresContext()->AppUnitsPerDevPixel());
RECT widgetRect; RECT widgetRect;
gfxRect tr(aRect.x, aRect.y, aRect.width, aRect.height), gfxRect tr(aRect.X(), aRect.Y(), aRect.Width(), aRect.Height()),
dr(aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); dr(aDirtyRect.X(), aDirtyRect.Y(), aDirtyRect.Width(), aDirtyRect.Height());
tr.Scale(1.0 / p2a); tr.Scale(1.0 / p2a);
dr.Scale(1.0 / p2a); dr.Scale(1.0 / p2a);

View file

@ -230,10 +230,10 @@ CreateControl(LPCWSTR aType,
HWND hWnd = ::CreateWindowW(aType, HWND hWnd = ::CreateWindowW(aType,
aStr, aStr,
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | aStyle, WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | aStyle,
aRect.x, aRect.X(),
aRect.y, aRect.Y(),
aRect.width, aRect.Width(),
aRect.height, aRect.Height(),
(HWND)aHdlg, (HWND)aHdlg,
(HMENU)(intptr_t)aId, (HMENU)(intptr_t)aId,
aHInst, aHInst,

View file

@ -834,10 +834,10 @@ nsWindow::Create(nsIWidget* aParent,
className, className,
L"", L"",
style, style,
aRect.x, aRect.X(),
aRect.y, aRect.Y(),
aRect.width, aRect.Width(),
GetHeight(aRect.height), GetHeight(aRect.Height()),
parent, parent,
nullptr, nullptr,
nsToolkit::mDllInstance, nsToolkit::mDllInstance,
@ -1435,14 +1435,14 @@ nsWindow::CreateScrollSnapshot()
// We failed to get the clip assume that we need a full fallback. // We failed to get the clip assume that we need a full fallback.
clip.left = 0; clip.left = 0;
clip.top = 0; clip.top = 0;
clip.right = mBounds.width; clip.right = mBounds.Width();
clip.bottom = mBounds.height; clip.bottom = mBounds.Height();
return GetFallbackScrollSnapshot(clip); return GetFallbackScrollSnapshot(clip);
} }
// Check that the window is in a position to snapshot. We don't check for // Check that the window is in a position to snapshot. We don't check for
// clipped width as that doesn't currently matter for APZ scrolling. // clipped width as that doesn't currently matter for APZ scrolling.
if (clip.top || clip.bottom != mBounds.height) { if (clip.top || clip.bottom != mBounds.Height()) {
return GetFallbackScrollSnapshot(clip); return GetFallbackScrollSnapshot(clip);
} }
@ -1454,9 +1454,9 @@ nsWindow::CreateScrollSnapshot()
::ReleaseDC(mWnd, windowDC); ::ReleaseDC(mWnd, windowDC);
}); });
gfx::IntSize snapshotSize(mBounds.width, mBounds.height); gfx::IntSize snapshotSize(mBounds.Width(), mBounds.Height());
ScrollSnapshot* snapshot; ScrollSnapshot* snapshot;
if (clip.left || clip.right != mBounds.width) { if (clip.left || clip.right != mBounds.Width()) {
// Can't do a full snapshot, so use the partial snapshot. // Can't do a full snapshot, so use the partial snapshot.
snapshot = EnsureSnapshotSurface(mPartialSnapshot, snapshotSize); snapshot = EnsureSnapshotSurface(mPartialSnapshot, snapshotSize);
} else { } else {
@ -1480,7 +1480,7 @@ nsWindow::CreateScrollSnapshot()
already_AddRefed<SourceSurface> already_AddRefed<SourceSurface>
nsWindow::GetFallbackScrollSnapshot(const RECT& aRequiredClip) nsWindow::GetFallbackScrollSnapshot(const RECT& aRequiredClip)
{ {
gfx::IntSize snapshotSize(mBounds.width, mBounds.height); gfx::IntSize snapshotSize(mBounds.Width(), mBounds.Height());
// If the current snapshot is the correct size and covers the required clip, // If the current snapshot is the correct size and covers the required clip,
// just keep that by returning null. // just keep that by returning null.
@ -1693,7 +1693,7 @@ void nsWindow::SetThemeRegion()
(mWindowType == eWindowType_popup && !IsPopupWithTitleBar() && (mWindowType == eWindowType_popup && !IsPopupWithTitleBar() &&
(mPopupType == ePopupTypeTooltip || mPopupType == ePopupTypePanel))) { (mPopupType == ePopupTypeTooltip || mPopupType == ePopupTypePanel))) {
HRGN hRgn = nullptr; HRGN hRgn = nullptr;
RECT rect = {0,0,mBounds.width,mBounds.height}; RECT rect = {0,0,mBounds.Width(),mBounds.Height()};
HDC dc = ::GetDC(mWnd); HDC dc = ::GetDC(mWnd);
GetThemeBackgroundRegion(nsUXThemeData::GetTheme(eUXTooltip), dc, TTP_STANDARD, TS_NORMAL, &rect, &hRgn); GetThemeBackgroundRegion(nsUXThemeData::GetTheme(eUXTooltip), dc, TTP_STANDARD, TS_NORMAL, &rect, &hRgn);
@ -1804,14 +1804,13 @@ nsWindow::Move(double aX, double aY)
// Only perform this check for non-popup windows, since the positioning can // Only perform this check for non-popup windows, since the positioning can
// in fact change even when the x/y do not. We always need to perform the // in fact change even when the x/y do not. We always need to perform the
// check. See bug #97805 for details. // check. See bug #97805 for details.
if (mWindowType != eWindowType_popup && (mBounds.x == x) && (mBounds.y == y)) if (mWindowType != eWindowType_popup && mBounds.IsEqualXY(x, y))
{ {
// Nothing to do, since it is already positioned correctly. // Nothing to do, since it is already positioned correctly.
return; return;
} }
mBounds.x = x; mBounds.MoveTo(x, y);
mBounds.y = y;
if (mWnd) { if (mWnd) {
#ifdef DEBUG #ifdef DEBUG
@ -1843,7 +1842,7 @@ nsWindow::Move(double aX, double aY)
if (IsPlugin() && if (IsPlugin() &&
!mLayerManager && !mLayerManager &&
mClipRects && mClipRects &&
(mClipRectCount != 1 || !mClipRects[0].IsEqualInterior(LayoutDeviceIntRect(0, 0, mBounds.width, mBounds.height)))) { (mClipRectCount != 1 || !mClipRects[0].IsEqualInterior(LayoutDeviceIntRect(0, 0, mBounds.Width(), mBounds.Height())))) {
flags |= SWP_NOCOPYBITS; flags |= SWP_NOCOPYBITS;
} }
double oldScale = mDefaultScale; double oldScale = mDefaultScale;
@ -1875,7 +1874,7 @@ nsWindow::Resize(double aWidth, double aHeight, bool aRepaint)
ConstrainSize(&width, &height); ConstrainSize(&width, &height);
// Avoid unnecessary resizing calls // Avoid unnecessary resizing calls
if (mBounds.width == width && mBounds.height == height) { if (mBounds.IsEqualSize(width, height)) {
if (aRepaint) { if (aRepaint) {
Invalidate(); Invalidate();
} }
@ -1883,8 +1882,7 @@ nsWindow::Resize(double aWidth, double aHeight, bool aRepaint)
} }
// Set cached value for lightweight and printing // Set cached value for lightweight and printing
mBounds.width = width; mBounds.SizeTo(width, height);
mBounds.height = height;
if (mWnd) { if (mWnd) {
UINT flags = SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE; UINT flags = SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE;
@ -1928,8 +1926,7 @@ nsWindow::Resize(double aX, double aY, double aWidth,
ConstrainSize(&width, &height); ConstrainSize(&width, &height);
// Avoid unnecessary resizing calls // Avoid unnecessary resizing calls
if (mBounds.x == x && mBounds.y == y && if (mBounds.IsEqualRect(x, y, width, height)) {
mBounds.width == width && mBounds.height == height) {
if (aRepaint) { if (aRepaint) {
Invalidate(); Invalidate();
} }
@ -1937,10 +1934,7 @@ nsWindow::Resize(double aX, double aY, double aWidth,
} }
// Set cached value for lightweight and printing // Set cached value for lightweight and printing
mBounds.x = x; mBounds.SetRect(x, y, width, height);
mBounds.y = y;
mBounds.width = width;
mBounds.height = height;
if (mWnd) { if (mWnd) {
UINT flags = SWP_NOZORDER | SWP_NOACTIVATE; UINT flags = SWP_NOZORDER | SWP_NOACTIVATE;
@ -2147,8 +2141,8 @@ nsWindow::ConstrainPosition(bool aAllowSlop, int32_t *aX, int32_t *aY)
// We need to use the window size in the kind of pixels used for window- // We need to use the window size in the kind of pixels used for window-
// manipulation APIs. // manipulation APIs.
int32_t logWidth = std::max<int32_t>(NSToIntRound(mBounds.width / dpiScale), 1); int32_t logWidth = std::max<int32_t>(NSToIntRound(mBounds.Width() / dpiScale), 1);
int32_t logHeight = std::max<int32_t>(NSToIntRound(mBounds.height / dpiScale), 1); int32_t logHeight = std::max<int32_t>(NSToIntRound(mBounds.Height() / dpiScale), 1);
/* get our playing field. use the current screen, or failing that /* get our playing field. use the current screen, or failing that
for any reason, use device caps for the default screen. */ for any reason, use device caps for the default screen. */
@ -2292,14 +2286,12 @@ nsWindow::GetBounds()
LayoutDeviceIntRect rect; LayoutDeviceIntRect rect;
// assign size // assign size
rect.width = r.right - r.left; rect.SizeTo(r.right - r.left, r.bottom - r.top);
rect.height = r.bottom - r.top;
// popup window bounds' are in screen coordinates, not relative to parent // popup window bounds' are in screen coordinates, not relative to parent
// window // window
if (mWindowType == eWindowType_popup) { if (mWindowType == eWindowType_popup) {
rect.x = r.left; rect.MoveTo(r.left, r.top);
rect.y = r.top;
return rect; return rect;
} }
@ -2344,8 +2336,7 @@ nsWindow::GetBounds()
r.top -= clientOffset.y; r.top -= clientOffset.y;
} }
} }
rect.x = r.left; rect.MoveTo(r.left, r.top);
rect.y = r.top;
return rect; return rect;
} }
@ -2363,8 +2354,7 @@ nsWindow::GetClientBounds()
LayoutDeviceIntRect bounds = GetBounds(); LayoutDeviceIntRect bounds = GetBounds();
LayoutDeviceIntRect rect; LayoutDeviceIntRect rect;
rect.MoveTo(bounds.TopLeft() + GetClientOffset()); rect.MoveTo(bounds.TopLeft() + GetClientOffset());
rect.width = r.right - r.left; rect.SizeTo(r.right - r.left, r.bottom - r.top);
rect.height = r.bottom - r.top;
return rect; return rect;
} }
@ -2379,12 +2369,7 @@ nsWindow::GetScreenBounds()
RECT r; RECT r;
VERIFY(::GetWindowRect(mWnd, &r)); VERIFY(::GetWindowRect(mWnd, &r));
LayoutDeviceIntRect rect; return LayoutDeviceIntRect(r.left, r.top, r.right - r.left, r.bottom - r.top);
rect.x = r.left;
rect.y = r.top;
rect.width = r.right - r.left;
rect.height = r.bottom - r.top;
return rect;
} }
nsresult nsresult
@ -3094,16 +3079,16 @@ void nsWindow::UpdateOpaqueRegion(const LayoutDeviceIntRegion& aOpaqueRegion)
// priority is to include the bounds of all plugins. // priority is to include the bounds of all plugins.
LayoutDeviceIntRect largest = LayoutDeviceIntRect largest =
aOpaqueRegion.GetLargestRectangle(pluginBounds); aOpaqueRegion.GetLargestRectangle(pluginBounds);
margins.cxLeftWidth = largest.x; margins.cxLeftWidth = largest.X();
margins.cxRightWidth = clientBounds.width - largest.XMost(); margins.cxRightWidth = clientBounds.Width() - largest.XMost();
margins.cyBottomHeight = clientBounds.height - largest.YMost(); margins.cyBottomHeight = clientBounds.Height() - largest.YMost();
if (mCustomNonClient) { if (mCustomNonClient) {
// The minimum glass height must be the caption buttons height, // The minimum glass height must be the caption buttons height,
// otherwise the buttons are drawn incorrectly. // otherwise the buttons are drawn incorrectly.
largest.y = std::max<uint32_t>(largest.y, largest.MoveToY(std::max<uint32_t>(largest.Y(),
nsUXThemeData::GetCommandButtonBoxMetrics().cy); nsUXThemeData::GetCommandButtonBoxMetrics().cy));
} }
margins.cyTopHeight = largest.y; margins.cyTopHeight = largest.Y();
} }
// Only update glass area if there are changes // Only update glass area if there are changes
@ -3276,10 +3261,10 @@ nsWindow::Invalidate(const LayoutDeviceIntRect& aRect)
RECT rect; RECT rect;
rect.left = aRect.x; rect.left = aRect.X();
rect.top = aRect.y; rect.top = aRect.Y();
rect.right = aRect.x + aRect.width; rect.right = aRect.XMost();
rect.bottom = aRect.y + aRect.height; rect.bottom = aRect.YMost();
VERIFY(::InvalidateRect(mWnd, &rect, FALSE)); VERIFY(::InvalidateRect(mWnd, &rect, FALSE));
} }
@ -3366,8 +3351,8 @@ FullscreenTransitionThreadProc(LPVOID lpParam)
::SetWindowLongW(wnd, GWL_STYLE, 0); ::SetWindowLongW(wnd, GWL_STYLE, 0);
::SetWindowLongW(wnd, GWL_EXSTYLE, WS_EX_LAYERED | ::SetWindowLongW(wnd, GWL_EXSTYLE, WS_EX_LAYERED |
WS_EX_TRANSPARENT | WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE); WS_EX_TRANSPARENT | WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE);
::SetWindowPos(wnd, HWND_TOPMOST, data->mBounds.x, data->mBounds.y, ::SetWindowPos(wnd, HWND_TOPMOST, data->mBounds.X(), data->mBounds.Y(),
data->mBounds.width, data->mBounds.height, 0); data->mBounds.Width(), data->mBounds.Height(), 0);
data->mWnd = wnd; data->mWnd = wnd;
::ReleaseSemaphore(data->mSemaphore, 1, nullptr); ::ReleaseSemaphore(data->mSemaphore, 1, nullptr);
// The initialization data may no longer be valid // The initialization data may no longer be valid
@ -3426,10 +3411,10 @@ nsWindow::PrepareForFullscreenTransition(nsISupports** aData)
MOZ_ASSERT(BoundsUseDesktopPixels(), MOZ_ASSERT(BoundsUseDesktopPixels(),
"Should only be called on top-level window"); "Should only be called on top-level window");
double scale = GetDesktopToDeviceScale().scale; // XXX or GetDefaultScale() ? double scale = GetDesktopToDeviceScale().scale; // XXX or GetDefaultScale() ?
initData.mBounds.x = NSToIntRound(x * scale); initData.mBounds.SetRect(NSToIntRound(x * scale),
initData.mBounds.y = NSToIntRound(y * scale); NSToIntRound(y * scale),
initData.mBounds.width = NSToIntRound(width * scale); NSToIntRound(width * scale),
initData.mBounds.height = NSToIntRound(height * scale); NSToIntRound(height * scale));
// Create a semaphore for synchronizing the window handle which will // Create a semaphore for synchronizing the window handle which will
// be created by the transition thread and used by the main thread for // be created by the transition thread and used by the main thread for
@ -4024,8 +4009,8 @@ nsWindow::OnDefaultButtonLoaded(const LayoutDeviceIntRect& aButtonRect)
LayoutDeviceIntRect widgetRect = GetScreenBounds(); LayoutDeviceIntRect widgetRect = GetScreenBounds();
LayoutDeviceIntRect buttonRect(aButtonRect + widgetRect.TopLeft()); LayoutDeviceIntRect buttonRect(aButtonRect + widgetRect.TopLeft());
LayoutDeviceIntPoint centerOfButton(buttonRect.x + buttonRect.width / 2, LayoutDeviceIntPoint centerOfButton(buttonRect.X() + buttonRect.Width() / 2,
buttonRect.y + buttonRect.height / 2); buttonRect.Y() + buttonRect.Height() / 2);
// The center of the button can be outside of the widget. // The center of the button can be outside of the widget.
// E.g., it could be hidden by scrolling. // E.g., it could be hidden by scrolling.
if (!widgetRect.Contains(centerOfButton)) { if (!widgetRect.Contains(centerOfButton)) {
@ -4074,7 +4059,7 @@ nsWindow::UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries)
// Extend the bounds by one pixel to the right, because that's how much // Extend the bounds by one pixel to the right, because that's how much
// the actual window button shape extends past the client area of the // the actual window button shape extends past the client area of the
// window (and overlaps the right window frame). // window (and overlaps the right window frame).
bounds.width += 1; bounds.SetWidth(bounds.Width() + 1);
if (!mWindowButtonsRect) { if (!mWindowButtonsRect) {
mWindowButtonsRect = Some(bounds); mWindowButtonsRect = Some(bounds);
} }
@ -4640,8 +4625,7 @@ nsWindow::DispatchMouseEvent(EventMessage aEventMessage, WPARAM wParam,
if (mWidgetListener) { if (mWidgetListener) {
if (aEventMessage == eMouseMove) { if (aEventMessage == eMouseMove) {
LayoutDeviceIntRect rect = GetBounds(); LayoutDeviceIntRect rect = GetBounds();
rect.x = 0; rect.MoveTo(0, 0);
rect.y = 0;
if (rect.Contains(event.mRefPoint)) { if (rect.Contains(event.mRefPoint)) {
if (sCurrentWindow == nullptr || sCurrentWindow != this) { if (sCurrentWindow == nullptr || sCurrentWindow != this) {
@ -6728,9 +6712,7 @@ void nsWindow::OnWindowPosChanged(WINDOWPOS* wp)
// Handle window position changes // Handle window position changes
if (!(wp->flags & SWP_NOMOVE)) { if (!(wp->flags & SWP_NOMOVE)) {
mBounds.x = wp->x; mBounds.MoveTo(wp->x, wp->y);
mBounds.y = wp->y;
NotifyWindowMoved(wp->x, wp->y); NotifyWindowMoved(wp->x, wp->y);
} }
@ -6780,8 +6762,7 @@ void nsWindow::OnWindowPosChanged(WINDOWPOS* wp)
RDW_ALLCHILDREN); RDW_ALLCHILDREN);
} }
mBounds.width = newWidth; mBounds.SizeTo(newWidth, newHeight);
mBounds.height = newHeight;
mLastSize.width = newWidth; mLastSize.width = newWidth;
mLastSize.height = newHeight; mLastSize.height = newHeight;
@ -6801,8 +6782,7 @@ void nsWindow::OnWindowPosChanged(WINDOWPOS* wp)
// Recalculate the width and height based on the client area for gecko events. // Recalculate the width and height based on the client area for gecko events.
if (::GetClientRect(mWnd, &r)) { if (::GetClientRect(mWnd, &r)) {
rect.width = r.right - r.left; rect.SizeTo(r.right - r.left, r.bottom - r.top);
rect.height = r.bottom - r.top;
} }
// Send a gecko resize event // Send a gecko resize event
@ -7090,11 +7070,11 @@ nsWindow::ConfigureChildren(const nsTArray<Configuration>& aConfigurations)
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
LayoutDeviceIntRect bounds = w->GetBounds(); LayoutDeviceIntRect bounds = w->GetBounds();
if (bounds.Size() != configuration.mBounds.Size()) { if (bounds.Size() != configuration.mBounds.Size()) {
w->Resize(configuration.mBounds.x, configuration.mBounds.y, w->Resize(configuration.mBounds.X(), configuration.mBounds.Y(),
configuration.mBounds.width, configuration.mBounds.height, configuration.mBounds.Width(), configuration.mBounds.Height(),
true); true);
} else if (bounds.TopLeft() != configuration.mBounds.TopLeft()) { } else if (bounds.TopLeft() != configuration.mBounds.TopLeft()) {
w->Move(configuration.mBounds.x, configuration.mBounds.y); w->Move(configuration.mBounds.X(), configuration.mBounds.Y());
if (gfxWindowsPlatform::GetPlatform()->IsDirect2DBackend() || if (gfxWindowsPlatform::GetPlatform()->IsDirect2DBackend() ||
@ -7104,8 +7084,8 @@ nsWindow::ConfigureChildren(const nsTArray<Configuration>& aConfigurations)
// underlying problem should be found and fixed! // underlying problem should be found and fixed!
LayoutDeviceIntRegion r; LayoutDeviceIntRegion r;
r.Sub(bounds, configuration.mBounds); r.Sub(bounds, configuration.mBounds);
r.MoveBy(-bounds.x, r.MoveBy(-bounds.X(),
-bounds.y); -bounds.Y());
LayoutDeviceIntRect toInvalidate = r.GetBounds(); LayoutDeviceIntRect toInvalidate = r.GetBounds();
WinUtils::InvalidatePluginAsWorkaround(w, toInvalidate); WinUtils::InvalidatePluginAsWorkaround(w, toInvalidate);
@ -7132,9 +7112,9 @@ CreateHRGNFromArray(const nsTArray<LayoutDeviceIntRect>& aRects)
for (uint32_t i = 0; i < aRects.Length(); ++i) { for (uint32_t i = 0; i < aRects.Length(); ++i) {
const LayoutDeviceIntRect& r = aRects[i]; const LayoutDeviceIntRect& r = aRects[i];
bounds.UnionRect(bounds, r); bounds.UnionRect(bounds, r);
::SetRect(&rects[i], r.x, r.y, r.XMost(), r.YMost()); ::SetRect(&rects[i], r.X(), r.Y(), r.XMost(), r.YMost());
} }
::SetRect(&data->rdh.rcBound, bounds.x, bounds.y, bounds.XMost(), bounds.YMost()); ::SetRect(&data->rdh.rcBound, bounds.X(), bounds.Y(), bounds.XMost(), bounds.YMost());
return ::ExtCreateRegion(nullptr, buf.Length(), data); return ::ExtCreateRegion(nullptr, buf.Length(), data);
} }
@ -7266,11 +7246,11 @@ void nsWindow::OnDestroy()
bool nsWindow::OnResize(nsIntRect &aWindowRect) bool nsWindow::OnResize(nsIntRect &aWindowRect)
{ {
bool result = mWidgetListener ? bool result = mWidgetListener ?
mWidgetListener->WindowResized(this, aWindowRect.width, aWindowRect.height) : false; mWidgetListener->WindowResized(this, aWindowRect.Width(), aWindowRect.Height()) : false;
// If there is an attached view, inform it as well as the normal widget listener. // If there is an attached view, inform it as well as the normal widget listener.
if (mAttachedWidgetListener) { if (mAttachedWidgetListener) {
return mAttachedWidgetListener->WindowResized(this, aWindowRect.width, aWindowRect.height); return mAttachedWidgetListener->WindowResized(this, aWindowRect.Width(), aWindowRect.Height());
} }
return result; return result;
@ -8291,10 +8271,10 @@ nsWindow::SetCandidateWindowForPlugin(const CandidateWindowPosition& aPosition)
form.dwIndex = 0; form.dwIndex = 0;
if (aPosition.mExcludeRect) { if (aPosition.mExcludeRect) {
form.dwStyle = CFS_EXCLUDE; form.dwStyle = CFS_EXCLUDE;
form.rcArea.left = aPosition.mRect.x; form.rcArea.left = aPosition.mRect.X();
form.rcArea.top = aPosition.mRect.y; form.rcArea.top = aPosition.mRect.Y();
form.rcArea.right = aPosition.mRect.x + aPosition.mRect.width; form.rcArea.right = aPosition.mRect.XMost();
form.rcArea.bottom = aPosition.mRect.y + aPosition.mRect.height; form.rcArea.bottom = aPosition.mRect.YMost();
} else { } else {
form.dwStyle = CFS_CANDIDATEPOS; form.dwStyle = CFS_CANDIDATEPOS;
} }