Skip to content

Commit

Permalink
Bug 1423551: Use BaseRect access methods instead of member variables …
Browse files Browse the repository at this point in the history
…in view/. r=jet

MozReview-Commit-ID: 1VlWJWAqRB3

--HG--
extra : rebase_source : 4c713d43fda024ac4f2c590b77c84ad3cfbd9ff5
  • Loading branch information
msreckovic committed Jan 10, 2018
1 parent 44670d6 commit 3db2b5e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
21 changes: 10 additions & 11 deletions view/nsView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,7 @@ void nsView::Destroy()

void nsView::SetPosition(nscoord aX, nscoord aY)
{
mDimBounds.x += aX - mPosX;
mDimBounds.y += aY - mPosY;
mDimBounds.MoveBy(aX - mPosX, aY - mPosY);
mPosX = aX;
mPosY = aY;

Expand Down Expand Up @@ -291,8 +290,8 @@ LayoutDeviceIntRect nsView::CalcWidgetBounds(nsWindowType aType)

// Compute where the top-left of our widget ended up relative to the parent
// widget, in appunits.
nsPoint roundedOffset(NSIntPixelsToAppUnits(newBounds.x, p2a),
NSIntPixelsToAppUnits(newBounds.y, p2a));
nsPoint roundedOffset(NSIntPixelsToAppUnits(newBounds.X(), p2a),
NSIntPixelsToAppUnits(newBounds.Y(), p2a));

// mViewToWidgetOffset is added to coordinates relative to the view origin
// to get coordinates relative to the widget.
Expand Down Expand Up @@ -365,15 +364,15 @@ void nsView::DoResetWidgetBounds(bool aMoveOnly,
DesktopRect deskRect = newBounds / scale;
if (changedPos) {
if (changedSize && !aMoveOnly) {
widget->ResizeClient(deskRect.x, deskRect.y,
deskRect.width, deskRect.height,
widget->ResizeClient(deskRect.X(), deskRect.Y(),
deskRect.Width(), deskRect.Height(),
aInvalidateChangedSize);
} else {
widget->MoveClient(deskRect.x, deskRect.y);
widget->MoveClient(deskRect.X(), deskRect.Y());
}
} else {
if (changedSize && !aMoveOnly) {
widget->ResizeClient(deskRect.width, deskRect.height,
widget->ResizeClient(deskRect.Width(), deskRect.Height(),
aInvalidateChangedSize);
} // else do nothing!
}
Expand Down Expand Up @@ -812,12 +811,12 @@ void nsView::List(FILE* out, int32_t aIndent) const
int32_t Z = mWindow->GetZIndex();
fprintf(out, "(widget=%p[%" PRIuPTR "] z=%d pos={%d,%d,%d,%d}) ",
(void*)mWindow, widgetRefCnt, Z,
nonclientBounds.x, nonclientBounds.y,
windowBounds.width, windowBounds.height);
nonclientBounds.X(), nonclientBounds.Y(),
windowBounds.Width(), windowBounds.Height());
}
nsRect brect = GetBounds();
fprintf(out, "{%d,%d,%d,%d}",
brect.x, brect.y, brect.width, brect.height);
brect.X(), brect.Y(), brect.Width(), brect.Height());
fprintf(out, " z=%d vis=%d frame=%p <\n",
mZIndex, mVis, static_cast<void*>(mFrame));
for (nsView* kid = mFirstChild; kid; kid = kid->GetNextSibling()) {
Expand Down
10 changes: 5 additions & 5 deletions view/nsViewManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ nsViewManager::CreateView(const nsRect& aBounds,
{
auto *v = new nsView(this, aVisibilityFlag);
v->SetParent(aParent);
v->SetPosition(aBounds.x, aBounds.y);
nsRect dim(0, 0, aBounds.width, aBounds.height);
v->SetPosition(aBounds.X(), aBounds.Y());
nsRect dim(0, 0, aBounds.Width(), aBounds.Height());
v->SetDimensions(dim, false);
return v;
}
Expand Down Expand Up @@ -165,8 +165,8 @@ nsViewManager::GetWindowDimensions(nscoord *aWidth, nscoord *aHeight)
if (nullptr != mRootView) {
if (mDelayedResize == nsSize(NSCOORD_NONE, NSCOORD_NONE)) {
nsRect dim = mRootView->GetDimensions();
*aWidth = dim.width;
*aHeight = dim.height;
*aWidth = dim.Width();
*aHeight = dim.Height();
} else {
*aWidth = mDelayedResize.width;
*aHeight = mDelayedResize.height;
Expand All @@ -188,7 +188,7 @@ void nsViewManager::DoSetWindowDimensions(nscoord aWidth, nscoord aHeight)
// Don't resize the widget. It is already being set elsewhere.
mRootView->SetDimensions(newDim, true, false);
if (mPresShell)
mPresShell->ResizeReflow(aWidth, aHeight, oldDim.width, oldDim.height);
mPresShell->ResizeReflow(aWidth, aHeight, oldDim.Width(), oldDim.Height());
}
}

Expand Down

0 comments on commit 3db2b5e

Please sign in to comment.