зеркало из https://github.com/mozilla/pjs.git
Don't pass null frames to nsHTMLReflowState::GetContainingBlockFor. Bug
273458, r+sr=dbaron
This commit is contained in:
Родитель
22d80261c5
Коммит
a77b73bb3a
|
@ -100,6 +100,14 @@ NS_NewComputedDOMStyle(nsIComputedDOMStyle** aComputedStyle)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsIFrame*
|
||||
GetContainingBlockFor(nsIFrame* aFrame) {
|
||||
if (!aFrame) {
|
||||
return nsnull;
|
||||
}
|
||||
return nsHTMLReflowState::GetContainingBlockFor(aFrame);
|
||||
}
|
||||
|
||||
nsComputedDOMStyle::nsComputedDOMStyle()
|
||||
: mInner(this), mPresShellWeak(nsnull), mT2P(0.0f)
|
||||
{
|
||||
|
@ -1835,8 +1843,7 @@ nsComputedDOMStyle::GetTextIndent(nsIFrame *aFrame,
|
|||
break;
|
||||
case eStyleUnit_Percent:
|
||||
{
|
||||
nsIFrame *container =
|
||||
nsHTMLReflowState::GetContainingBlockFor(aFrame);
|
||||
nsIFrame *container = GetContainingBlockFor(aFrame);
|
||||
if (container) {
|
||||
val->SetTwips(container->GetSize().width *
|
||||
text->mTextIndent.GetPercentValue());
|
||||
|
@ -2715,7 +2722,7 @@ nsComputedDOMStyle::GetMaxHeight(nsIFrame *aFrame,
|
|||
nscoord minHeight = 0;
|
||||
|
||||
if (positionData->mMinHeight.GetUnit() == eStyleUnit_Percent) {
|
||||
container = nsHTMLReflowState::GetContainingBlockFor(aFrame);
|
||||
container = GetContainingBlockFor(aFrame);
|
||||
if (container) {
|
||||
size = container->GetSize();
|
||||
minHeight = nscoord(size.height *
|
||||
|
@ -2732,7 +2739,7 @@ nsComputedDOMStyle::GetMaxHeight(nsIFrame *aFrame,
|
|||
break;
|
||||
case eStyleUnit_Percent:
|
||||
if (!container) {
|
||||
container = nsHTMLReflowState::GetContainingBlockFor(aFrame);
|
||||
container = GetContainingBlockFor(aFrame);
|
||||
if (container) {
|
||||
size = container->GetSize();
|
||||
} else {
|
||||
|
@ -2775,7 +2782,7 @@ nsComputedDOMStyle::GetMaxWidth(nsIFrame *aFrame,
|
|||
nscoord minWidth = 0;
|
||||
|
||||
if (positionData->mMinWidth.GetUnit() == eStyleUnit_Percent) {
|
||||
container = nsHTMLReflowState::GetContainingBlockFor(aFrame);
|
||||
container = GetContainingBlockFor(aFrame);
|
||||
if (container) {
|
||||
size = container->GetSize();
|
||||
minWidth = nscoord(size.width *
|
||||
|
@ -2792,7 +2799,7 @@ nsComputedDOMStyle::GetMaxWidth(nsIFrame *aFrame,
|
|||
break;
|
||||
case eStyleUnit_Percent:
|
||||
if (!container) {
|
||||
container = nsHTMLReflowState::GetContainingBlockFor(aFrame);
|
||||
container = GetContainingBlockFor(aFrame);
|
||||
if (container) {
|
||||
size = container->GetSize();
|
||||
} else {
|
||||
|
@ -2836,7 +2843,7 @@ nsComputedDOMStyle::GetMinHeight(nsIFrame *aFrame,
|
|||
val->SetTwips(positionData->mMinHeight.GetCoordValue());
|
||||
break;
|
||||
case eStyleUnit_Percent:
|
||||
container = nsHTMLReflowState::GetContainingBlockFor(aFrame);
|
||||
container = GetContainingBlockFor(aFrame);
|
||||
if (container) {
|
||||
val->SetTwips(container->GetSize().height *
|
||||
positionData->mMinHeight.GetPercentValue());
|
||||
|
@ -2876,7 +2883,7 @@ nsComputedDOMStyle::GetMinWidth(nsIFrame *aFrame,
|
|||
val->SetTwips(positionData->mMinWidth.GetCoordValue());
|
||||
break;
|
||||
case eStyleUnit_Percent:
|
||||
container = nsHTMLReflowState::GetContainingBlockFor(aFrame);
|
||||
container = GetContainingBlockFor(aFrame);
|
||||
if (container) {
|
||||
val->SetTwips(container->GetSize().width *
|
||||
positionData->mMinWidth.GetPercentValue());
|
||||
|
@ -2970,7 +2977,7 @@ nsComputedDOMStyle::GetAbsoluteOffset(PRUint8 aSide, nsIFrame* aFrame,
|
|||
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
||||
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsIFrame* container = nsHTMLReflowState::GetContainingBlockFor(aFrame);
|
||||
nsIFrame* container = GetContainingBlockFor(aFrame);
|
||||
if (container) {
|
||||
nscoord margin = GetMarginWidthCoordFor(aSide, aFrame);
|
||||
nscoord border = GetBorderWidthCoordFor(aSide, container);
|
||||
|
@ -3059,7 +3066,7 @@ nsComputedDOMStyle::GetRelativeOffset(PRUint8 aSide, nsIFrame* aFrame,
|
|||
val->SetTwips(sign * coord.GetCoordValue());
|
||||
break;
|
||||
case eStyleUnit_Percent:
|
||||
container = nsHTMLReflowState::GetContainingBlockFor(aFrame);
|
||||
container = GetContainingBlockFor(aFrame);
|
||||
if (container) {
|
||||
nsMargin border;
|
||||
nsMargin padding;
|
||||
|
|
Загрузка…
Ссылка в новой задаче