Bug 1786048 - Part 3: Merge nsIEmbeddingSiteWindow into nsIBaseWindow. r=emilio

Implementations of nsIEmbeddingSiteWindow and nsIBaseWindow largely
overlap, and where they don't, the nsIEmbeddingSiteWindow implementation
of the otherwise shared interface is primarily stubbed out with the
exception of Get/SetDimensions().

This patch moves a reimplementation of Get/SetDimensions() from
nsIEmbeddingSiteWindow to nsIBaseWindow. The other methods of
nsIEmbeddingSiteWindow remain covered by nsIBaseWindow.
Get/SetDimensions() can be implemented as part of nsIWebBrowserChrome
where nsIBaseWindow is not necessary. This removes the need for
nsIEmbeddingSiteWindow.

Blur() has also been moved to nsIWebBrowserChrome, as only
nsContentTreeOwner has an actual implementation which we in theory also
want to call from BrowserChild/Parent, but the spec suggests to
"selectively or uniformly ignore calls".

GetVisibility() had an implementation in BrowserChild that pretended to
always be visible. Instead of providing an interface for that,
nsDocShell now handles the not implemented case for tree owners.

nsIEmbeddingSiteWindow::GetSiteWindow() used to call through to
nsIBaseWindow::GetParentNativeWindow().

The Get/SetDimensions() implementation has been replaced with a strongly
typed setter, which is now also used directly from nsGlobalWindowOuter
to avoid problems that come with autodetecting unchanged dimensions,
when the current dimensions are outdated (e.g. immediately reverting a
change can be ignored).

Differential Revision: https://phabricator.services.mozilla.com/D160260
This commit is contained in:
Matthias Camenzind
2022-12-15 23:13:00 +00:00
parent 641877d61b
commit d634177ee2
39 changed files with 1170 additions and 681 deletions

View File

@@ -4783,6 +4783,17 @@ void nsDocShell::DoGetPositionAndSize(int32_t* aX, int32_t* aY, int32_t* aWidth,
}
}
NS_IMETHODIMP
nsDocShell::SetDimensions(DimensionRequest&& aRequest) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsDocShell::GetDimensions(DimensionKind aDimensionKind, int32_t* aX,
int32_t* aY, int32_t* aCX, int32_t* aCY) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsDocShell::Repaint(bool aForce) {
PresShell* presShell = GetPresShell();
@@ -4908,7 +4919,13 @@ nsDocShell::GetVisibility(bool* aVisibility) {
// Check with the tree owner as well to give embedders a chance to
// expose visibility as well.
return treeOwnerAsWin->GetVisibility(aVisibility);
nsresult rv = treeOwnerAsWin->GetVisibility(aVisibility);
if (rv == NS_ERROR_NOT_IMPLEMENTED) {
// The tree owner had no opinion on our visibility.
*aVisibility = true;
return NS_OK;
}
return rv;
}
void nsDocShell::ActivenessMaybeChanged() {