Bug 1543315 - part 4: Mark ResizeReflow() as MOZ_CAN_RUN_SCRIPT r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D27220

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Masayuki Nakano 2019-04-13 12:39:47 +00:00
parent 2332e34945
commit e8514bbdc6
9 changed files with 17 additions and 11 deletions

View File

@ -351,8 +351,8 @@ nsDocShellTreeOwner::SizeShellTo(nsIDocShellTreeItem* aShellItem, int32_t aCX,
NS_ENSURE_STATE(mTreeOwner || webBrowserChrome);
if (mTreeOwner) {
return mTreeOwner->SizeShellTo(aShellItem, aCX, aCY);
if (nsCOMPtr<nsIDocShellTreeOwner> treeOwner = mTreeOwner) {
return treeOwner->SizeShellTo(aShellItem, aCX, aCY);
}
if (aShellItem == mWebBrowser->mDocShell) {
@ -393,7 +393,7 @@ nsDocShellTreeOwner::SizeShellTo(nsIDocShellTreeItem* aShellItem, int32_t aCX,
RefPtr<nsPresContext> presContext = mWebBrowser->mDocShell->GetPresContext();
NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
PresShell* presShell = presContext->GetPresShell();
RefPtr<PresShell> presShell = presContext->GetPresShell();
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(

View File

@ -55,6 +55,7 @@ interface nsIDocShellTreeOwner : nsISupports
Tells the tree owner to size its window or parent window in such a way
that the shell passed along will be the size specified.
*/
[can_run_script]
void sizeShellTo(in nsIDocShellTreeItem shell, in long cx, in long cy);
/*

View File

@ -3816,13 +3816,13 @@ nsresult nsGlobalWindowOuter::SetDocShellWidthAndHeight(int32_t aInnerWidth,
int32_t aInnerHeight) {
NS_ENSURE_TRUE(mDocShell, NS_ERROR_FAILURE);
nsCOMPtr<nsIDocShell> docShell = mDocShell;
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
mDocShell->GetTreeOwner(getter_AddRefs(treeOwner));
docShell->GetTreeOwner(getter_AddRefs(treeOwner));
NS_ENSURE_TRUE(treeOwner, NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(
treeOwner->SizeShellTo(mDocShell, aInnerWidth, aInnerHeight),
NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(treeOwner->SizeShellTo(docShell, aInnerWidth, aInnerHeight),
NS_ERROR_FAILURE);
return NS_OK;
}
@ -5331,8 +5331,9 @@ void nsGlobalWindowOuter::SizeToContentOuter(CallerType aCallerType,
nsIntSize newDevSize(CSSToDevIntPixels(cssSize));
nsCOMPtr<nsIDocShell> docShell = mDocShell;
aError =
treeOwner->SizeShellTo(mDocShell, newDevSize.width, newDevSize.height);
treeOwner->SizeShellTo(docShell, newDevSize.width, newDevSize.height);
}
already_AddRefed<nsPIWindowRoot> nsGlobalWindowOuter::GetTopWindowRoot() {

View File

@ -600,6 +600,7 @@ class nsGlobalWindowOuter final : public mozilla::dom::EventTarget,
double GetScrollXOuter();
double GetScrollYOuter();
MOZ_CAN_RUN_SCRIPT_BOUNDARY
void SizeToContentOuter(mozilla::dom::CallerType aCallerType,
mozilla::ErrorResult& aError);
nsIControllers* GetControllersOuter(mozilla::ErrorResult& aError);
@ -850,6 +851,7 @@ class nsGlobalWindowOuter final : public mozilla::dom::EventTarget,
// Arguments to this function should have values in app units
void SetCSSViewportWidthAndHeight(nscoord width, nscoord height);
// Arguments to this function should have values in device pixels
MOZ_CAN_RUN_SCRIPT_BOUNDARY
nsresult SetDocShellWidthAndHeight(int32_t width, int32_t height);
static bool CanSetProperty(const char* aPrefName);

View File

@ -96,7 +96,7 @@ class PresShell final : public nsIPresShell,
NS_IMETHOD RepaintSelection(RawSelectionType aRawSelectionType) override;
nsresult Initialize() override;
nsresult ResizeReflow(
MOZ_CAN_RUN_SCRIPT nsresult ResizeReflow(
nscoord aWidth, nscoord aHeight, nscoord aOldWidth = 0,
nscoord aOldHeight = 0,
ResizeReflowOptions aOptions = ResizeReflowOptions::eBSizeExact) override;

View File

@ -354,6 +354,7 @@ class nsDocumentViewer final : public nsIContentViewer,
already_AddRefed<nsINode> GetPopupLinkNode();
already_AddRefed<nsIImageLoadingContent> GetPopupImageNode();
MOZ_CAN_RUN_SCRIPT_BOUNDARY
nsresult GetContentSizeInternal(int32_t* aWidth, int32_t* aHeight,
nscoord aMaxWidth, nscoord aMaxHeight);

View File

@ -341,7 +341,7 @@ class nsIPresShell : public nsStubDocumentObserver {
* Reflow the frame model into a new width and height. The
* coordinates for aWidth and aHeight must be in standard nscoord's.
*/
virtual nsresult ResizeReflow(
MOZ_CAN_RUN_SCRIPT virtual nsresult ResizeReflow(
nscoord aWidth, nscoord aHeight, nscoord aOldWidth = 0,
nscoord aOldHeight = 0,
ResizeReflowOptions aOptions = ResizeReflowOptions::eBSizeExact) = 0;

View File

@ -360,6 +360,7 @@ class nsViewManager final {
*/
LayoutDeviceIntRect ViewToWidget(nsView* aView, const nsRect& aRect) const;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
void DoSetWindowDimensions(nscoord aWidth, nscoord aHeight);
bool ShouldDelayResize() const;

View File

@ -95,7 +95,7 @@ class nsXULWindow : public nsIBaseWindow,
NS_IMETHOD GetAvailScreenSize(int32_t* aAvailWidth, int32_t* aAvailHeight);
void ApplyChromeFlags();
void SizeShell();
MOZ_CAN_RUN_SCRIPT_BOUNDARY void SizeShell();
void OnChromeLoaded();
void StaggerPosition(int32_t& aRequestedX, int32_t& aRequestedY,
int32_t aSpecWidth, int32_t aSpecHeight);