зеркало из 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,18 +2952,20 @@ nsGlobalWindow::SetInnerWidth(PRInt32 aInnerWidth)
|
|||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
mDocShell->GetPresContext(getter_AddRefs(presContext));
|
||||
NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
|
||||
|
||||
PRInt32 width;
|
||||
width = presContext->AppUnitsToDevPixels(
|
||||
nsPresContext::CSSPixelsToAppUnits(aInnerWidth));
|
||||
if (presContext) {
|
||||
PRInt32 width;
|
||||
width = presContext->AppUnitsToDevPixels(
|
||||
nsPresContext::CSSPixelsToAppUnits(aInnerWidth));
|
||||
|
||||
nsCOMPtr<nsIBaseWindow> docShellAsWin(do_QueryInterface(mDocShell));
|
||||
PRInt32 notused, height = 0;
|
||||
docShellAsWin->GetSize(¬used, &height);
|
||||
nsCOMPtr<nsIBaseWindow> docShellAsWin(do_QueryInterface(mDocShell));
|
||||
PRInt32 notused, height = 0;
|
||||
docShellAsWin->GetSize(¬used, &height);
|
||||
|
||||
NS_ENSURE_SUCCESS(treeOwner->SizeShellTo(docShellAsItem, width, height),
|
||||
NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
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,18 +3025,20 @@ nsGlobalWindow::SetInnerHeight(PRInt32 aInnerHeight)
|
|||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
mDocShell->GetPresContext(getter_AddRefs(presContext));
|
||||
NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
|
||||
|
||||
PRInt32 height;
|
||||
height = presContext->AppUnitsToDevPixels(
|
||||
nsPresContext::CSSPixelsToAppUnits(aInnerHeight));
|
||||
if (presContext) {
|
||||
PRInt32 height;
|
||||
height = presContext->AppUnitsToDevPixels(
|
||||
nsPresContext::CSSPixelsToAppUnits(aInnerHeight));
|
||||
|
||||
nsCOMPtr<nsIBaseWindow> docShellAsWin(do_QueryInterface(mDocShell));
|
||||
PRInt32 width = 0, notused;
|
||||
docShellAsWin->GetSize(&width, ¬used);
|
||||
NS_ENSURE_SUCCESS(treeOwner->
|
||||
SizeShellTo(docShellAsItem, width, height),
|
||||
NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIBaseWindow> docShellAsWin(do_QueryInterface(mDocShell));
|
||||
PRInt32 width = 0, notused;
|
||||
docShellAsWin->GetSize(&width, ¬used);
|
||||
NS_ENSURE_SUCCESS(treeOwner->
|
||||
SizeShellTo(docShellAsItem, width, height),
|
||||
NS_ERROR_FAILURE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче