зеркало из https://github.com/mozilla/gecko-dev.git
Fixing bug 400204. Make window.innerWidth n' friends not throw when accessed on a non-displayed window. r+sr+a=jonas@sicking.cc
This commit is contained in:
Родитель
dc71994164
Коммит
a90d100e1d
|
@ -2915,10 +2915,11 @@ nsGlobalWindow::GetInnerWidth(PRInt32* aInnerWidth)
|
|||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
mDocShell->GetPresContext(getter_AddRefs(presContext));
|
||||
NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
|
||||
|
||||
*aInnerWidth = nsPresContext::AppUnitsToIntCSSPixels(
|
||||
presContext->DevPixelsToAppUnits(width));
|
||||
if (presContext) {
|
||||
*aInnerWidth = nsPresContext::
|
||||
AppUnitsToIntCSSPixels(presContext->DevPixelsToAppUnits(width));
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2951,8 +2952,8 @@ nsGlobalWindow::SetInnerWidth(PRInt32 aInnerWidth)
|
|||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
mDocShell->GetPresContext(getter_AddRefs(presContext));
|
||||
NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
|
||||
|
||||
if (presContext) {
|
||||
PRInt32 width;
|
||||
width = presContext->AppUnitsToDevPixels(
|
||||
nsPresContext::CSSPixelsToAppUnits(aInnerWidth));
|
||||
|
@ -2963,6 +2964,8 @@ nsGlobalWindow::SetInnerWidth(PRInt32 aInnerWidth)
|
|||
|
||||
NS_ENSURE_SUCCESS(treeOwner->SizeShellTo(docShellAsItem, width, height),
|
||||
NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2985,10 +2988,11 @@ nsGlobalWindow::GetInnerHeight(PRInt32* aInnerHeight)
|
|||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
mDocShell->GetPresContext(getter_AddRefs(presContext));
|
||||
NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
|
||||
|
||||
*aInnerHeight = nsPresContext::AppUnitsToIntCSSPixels(
|
||||
presContext->DevPixelsToAppUnits(height));
|
||||
if (presContext) {
|
||||
*aInnerHeight = nsPresContext::
|
||||
AppUnitsToIntCSSPixels(presContext->DevPixelsToAppUnits(height));
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -3021,8 +3025,8 @@ nsGlobalWindow::SetInnerHeight(PRInt32 aInnerHeight)
|
|||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
mDocShell->GetPresContext(getter_AddRefs(presContext));
|
||||
NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
|
||||
|
||||
if (presContext) {
|
||||
PRInt32 height;
|
||||
height = presContext->AppUnitsToDevPixels(
|
||||
nsPresContext::CSSPixelsToAppUnits(aInnerHeight));
|
||||
|
@ -3033,6 +3037,8 @@ nsGlobalWindow::SetInnerHeight(PRInt32 aInnerHeight)
|
|||
NS_ENSURE_SUCCESS(treeOwner->
|
||||
SizeShellTo(docShellAsItem, width, height),
|
||||
NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче