Skip to content

Commit

Permalink
Bug 1803611 - Part 2: Implement AppWindow::Set/GetDimensions. r=emilio
Browse files Browse the repository at this point in the history
Depends on D166877

Differential Revision: https://phabricator.services.mozilla.com/D166878
  • Loading branch information
matc-pub committed Jan 27, 2023
1 parent b185310 commit 4826171
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
24 changes: 16 additions & 8 deletions xpfe/appshell/AppWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -725,19 +725,27 @@ NS_IMETHODIMP AppWindow::GetPositionAndSize(int32_t* x, int32_t* y, int32_t* cx,

NS_IMETHODIMP
AppWindow::SetDimensions(DimensionRequest&& aRequest) {
// For the chrome the inner size is the root shell size, and for the content
// it's the primary content size. We lack an indicator here that would allow
// us to distinguish between the two.
return NS_ERROR_NOT_IMPLEMENTED;
if (aRequest.mDimensionKind == DimensionKind::Inner) {
// For the chrome the inner size is the root shell size, and for the
// content it's the primary content size. We lack an indicator here that
// would allow us to distinguish between the two.
return NS_ERROR_NOT_IMPLEMENTED;
}

MOZ_TRY(aRequest.SupplementFrom(this));
return aRequest.ApplyOuterTo(this);
}

NS_IMETHODIMP
AppWindow::GetDimensions(DimensionKind aDimensionKind, int32_t* aX, int32_t* aY,
int32_t* aCX, int32_t* aCY) {
// For the chrome the inner size is the root shell size, and for the content
// it's the primary content size. We lack an indicator here that would allow
// us to distinguish between the two.
return NS_ERROR_NOT_IMPLEMENTED;
if (aDimensionKind == DimensionKind::Inner) {
// For the chrome the inner size is the root shell size, and for the
// content it's the primary content size. We lack an indicator here that
// would allow us to distinguish between the two.
return NS_ERROR_NOT_IMPLEMENTED;
}
return GetPositionAndSize(aX, aY, aCX, aCY);
}

nsresult AppWindow::MoveResize(const Maybe<LayoutDeviceIntPoint>& aPosition,
Expand Down
9 changes: 6 additions & 3 deletions xpfe/appshell/nsChromeTreeOwner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,18 +308,21 @@ NS_IMETHODIMP nsChromeTreeOwner::GetPositionAndSize(int32_t* x, int32_t* y,

NS_IMETHODIMP
nsChromeTreeOwner::SetDimensions(DimensionRequest&& aRequest) {
MOZ_TRY(aRequest.SupplementFrom(this));
NS_ENSURE_STATE(mAppWindow);
if (aRequest.mDimensionKind == DimensionKind::Outer) {
return aRequest.ApplyOuterTo(this);
return mAppWindow->SetDimensions(std::move(aRequest));
}

MOZ_TRY(aRequest.SupplementFrom(this));
return aRequest.ApplyInnerTo(this, /* aAsRootShell */ true);
}

NS_IMETHODIMP
nsChromeTreeOwner::GetDimensions(DimensionKind aDimensionKind, int32_t* aX,
int32_t* aY, int32_t* aCX, int32_t* aCY) {
NS_ENSURE_STATE(mAppWindow);
if (aDimensionKind == DimensionKind::Outer) {
return GetPositionAndSize(aX, aY, aCX, aCY);
return mAppWindow->GetDimensions(aDimensionKind, aX, aY, aCX, aCY);
}
if (aY || aX) {
return NS_ERROR_NOT_IMPLEMENTED;
Expand Down
9 changes: 6 additions & 3 deletions xpfe/appshell/nsContentTreeOwner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,18 +410,21 @@ NS_IMETHODIMP nsContentTreeOwner::GetPositionAndSize(int32_t* aX, int32_t* aY,

NS_IMETHODIMP
nsContentTreeOwner::SetDimensions(DimensionRequest&& aRequest) {
MOZ_TRY(aRequest.SupplementFrom(this));
NS_ENSURE_STATE(mAppWindow);
if (aRequest.mDimensionKind == DimensionKind::Outer) {
return aRequest.ApplyOuterTo(this);
return mAppWindow->SetDimensions(std::move(aRequest));
}

MOZ_TRY(aRequest.SupplementFrom(this));
return aRequest.ApplyInnerTo(this, /* aAsRootShell */ false);
}

NS_IMETHODIMP
nsContentTreeOwner::GetDimensions(DimensionKind aDimensionKind, int32_t* aX,
int32_t* aY, int32_t* aCX, int32_t* aCY) {
NS_ENSURE_STATE(mAppWindow);
if (aDimensionKind == DimensionKind::Outer) {
return GetPositionAndSize(aX, aY, aCX, aCY);
return mAppWindow->GetDimensions(aDimensionKind, aX, aY, aCX, aCY);
}
if (aY || aX) {
return NS_ERROR_NOT_IMPLEMENTED;
Expand Down

0 comments on commit 4826171

Please sign in to comment.