set line height to inherit only as needed

init ref count before first remap style
This commit is contained in:
peterl%netscape.com 1999-09-09 05:37:37 +00:00
Родитель 016d356b09
Коммит ee1f9d1b32
3 изменённых файлов: 33 добавлений и 12 удалений

Просмотреть файл

@ -818,7 +818,14 @@ void StyleTextImpl::ResetFrom(const nsStyleText* aParent, nsIPresContext* aPresC
mWhiteSpace = aParent->mWhiteSpace;
mLetterSpacing = aParent->mLetterSpacing;
mLineHeight.SetInheritValue();
if ((eStyleUnit_Normal == aParent->mLineHeight.GetUnit()) ||
(eStyleUnit_Factor == aParent->mLineHeight.GetUnit()) ||
(eStyleUnit_Coord == aParent->mLineHeight.GetUnit())) {
mLineHeight = aParent->mLineHeight;
}
else {
mLineHeight.SetInheritValue();
}
mTextIndent = aParent->mTextIndent;
mWordSpacing = aParent->mWordSpacing;
}
@ -1420,8 +1427,6 @@ StyleContextImpl::StyleContextImpl(nsIStyleContext* aParent,
mRules->EnumerateForwards(HashStyleRule, &mRuleHash);
}
RemapStyle(aPresContext);
#ifdef DEBUG_REFS
mInstance = ++gInstanceCount;
fprintf(stdout, "%d of %d + StyleContext\n", mInstance, gInstanceCount);
@ -2066,5 +2071,7 @@ NS_NewStyleContext(nsIStyleContext** aInstancePtrResult,
if (nsnull == context) {
return NS_ERROR_OUT_OF_MEMORY;
}
return context->QueryInterface(kIStyleContextIID, (void **) aInstancePtrResult);
nsresult result = context->QueryInterface(kIStyleContextIID, (void **) aInstancePtrResult);
context->RemapStyle(aPresContext); // remap after initial ref-count is set
return result;
}

Просмотреть файл

@ -818,7 +818,14 @@ void StyleTextImpl::ResetFrom(const nsStyleText* aParent, nsIPresContext* aPresC
mWhiteSpace = aParent->mWhiteSpace;
mLetterSpacing = aParent->mLetterSpacing;
mLineHeight.SetInheritValue();
if ((eStyleUnit_Normal == aParent->mLineHeight.GetUnit()) ||
(eStyleUnit_Factor == aParent->mLineHeight.GetUnit()) ||
(eStyleUnit_Coord == aParent->mLineHeight.GetUnit())) {
mLineHeight = aParent->mLineHeight;
}
else {
mLineHeight.SetInheritValue();
}
mTextIndent = aParent->mTextIndent;
mWordSpacing = aParent->mWordSpacing;
}
@ -1420,8 +1427,6 @@ StyleContextImpl::StyleContextImpl(nsIStyleContext* aParent,
mRules->EnumerateForwards(HashStyleRule, &mRuleHash);
}
RemapStyle(aPresContext);
#ifdef DEBUG_REFS
mInstance = ++gInstanceCount;
fprintf(stdout, "%d of %d + StyleContext\n", mInstance, gInstanceCount);
@ -2066,5 +2071,7 @@ NS_NewStyleContext(nsIStyleContext** aInstancePtrResult,
if (nsnull == context) {
return NS_ERROR_OUT_OF_MEMORY;
}
return context->QueryInterface(kIStyleContextIID, (void **) aInstancePtrResult);
nsresult result = context->QueryInterface(kIStyleContextIID, (void **) aInstancePtrResult);
context->RemapStyle(aPresContext); // remap after initial ref-count is set
return result;
}

Просмотреть файл

@ -818,7 +818,14 @@ void StyleTextImpl::ResetFrom(const nsStyleText* aParent, nsIPresContext* aPresC
mWhiteSpace = aParent->mWhiteSpace;
mLetterSpacing = aParent->mLetterSpacing;
mLineHeight.SetInheritValue();
if ((eStyleUnit_Normal == aParent->mLineHeight.GetUnit()) ||
(eStyleUnit_Factor == aParent->mLineHeight.GetUnit()) ||
(eStyleUnit_Coord == aParent->mLineHeight.GetUnit())) {
mLineHeight = aParent->mLineHeight;
}
else {
mLineHeight.SetInheritValue();
}
mTextIndent = aParent->mTextIndent;
mWordSpacing = aParent->mWordSpacing;
}
@ -1420,8 +1427,6 @@ StyleContextImpl::StyleContextImpl(nsIStyleContext* aParent,
mRules->EnumerateForwards(HashStyleRule, &mRuleHash);
}
RemapStyle(aPresContext);
#ifdef DEBUG_REFS
mInstance = ++gInstanceCount;
fprintf(stdout, "%d of %d + StyleContext\n", mInstance, gInstanceCount);
@ -2066,5 +2071,7 @@ NS_NewStyleContext(nsIStyleContext** aInstancePtrResult,
if (nsnull == context) {
return NS_ERROR_OUT_OF_MEMORY;
}
return context->QueryInterface(kIStyleContextIID, (void **) aInstancePtrResult);
nsresult result = context->QueryInterface(kIStyleContextIID, (void **) aInstancePtrResult);
context->RemapStyle(aPresContext); // remap after initial ref-count is set
return result;
}