зеркало из https://github.com/mozilla/pjs.git
Check for null FontMetrics to prevent crash. r=shanjian sr=kin
This commit is contained in:
Родитель
ea8a2f65f3
Коммит
b5834292c2
|
@ -2290,6 +2290,10 @@ ComputeLineHeight(nsIPresContext* aPresContext,
|
|||
nsCOMPtr<nsIFontMetrics> fm;
|
||||
deviceContext->GetMetricsFor(font->mFont, langGroup, *getter_AddRefs(fm));
|
||||
|
||||
if (!fm) {
|
||||
NS_WARNING( "null font metrics for the device context - we have to fix this someday...");
|
||||
}
|
||||
|
||||
if (unit == eStyleUnit_Factor) {
|
||||
// For factor units the computed value of the line-height property
|
||||
// is found by multiplying the factor by the font's <b>actual</b>
|
||||
|
@ -2303,7 +2307,7 @@ ComputeLineHeight(nsIPresContext* aPresContext,
|
|||
// precise layout in the face of imprecise fonts.
|
||||
nscoord emHeight = font->mFont.size;
|
||||
#ifdef NEW_FONT_HEIGHT_APIS
|
||||
if (!nsHTMLReflowState::UseComputedHeight()) {
|
||||
if (!nsHTMLReflowState::UseComputedHeight() && fm) {
|
||||
fm->GetEmHeight(emHeight);
|
||||
}
|
||||
#endif
|
||||
|
@ -2312,7 +2316,7 @@ ComputeLineHeight(nsIPresContext* aPresContext,
|
|||
NS_ASSERTION(eStyleUnit_Normal == unit, "bad unit");
|
||||
lineHeight = font->mFont.size;
|
||||
#ifdef NEW_FONT_HEIGHT_APIS
|
||||
if (!nsHTMLReflowState::UseComputedHeight()) {
|
||||
if (!nsHTMLReflowState::UseComputedHeight() && fm) {
|
||||
lineHeight = GetNormalLineHeight(fm);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -2290,6 +2290,10 @@ ComputeLineHeight(nsIPresContext* aPresContext,
|
|||
nsCOMPtr<nsIFontMetrics> fm;
|
||||
deviceContext->GetMetricsFor(font->mFont, langGroup, *getter_AddRefs(fm));
|
||||
|
||||
if (!fm) {
|
||||
NS_WARNING( "null font metrics for the device context - we have to fix this someday...");
|
||||
}
|
||||
|
||||
if (unit == eStyleUnit_Factor) {
|
||||
// For factor units the computed value of the line-height property
|
||||
// is found by multiplying the factor by the font's <b>actual</b>
|
||||
|
@ -2303,7 +2307,7 @@ ComputeLineHeight(nsIPresContext* aPresContext,
|
|||
// precise layout in the face of imprecise fonts.
|
||||
nscoord emHeight = font->mFont.size;
|
||||
#ifdef NEW_FONT_HEIGHT_APIS
|
||||
if (!nsHTMLReflowState::UseComputedHeight()) {
|
||||
if (!nsHTMLReflowState::UseComputedHeight() && fm) {
|
||||
fm->GetEmHeight(emHeight);
|
||||
}
|
||||
#endif
|
||||
|
@ -2312,7 +2316,7 @@ ComputeLineHeight(nsIPresContext* aPresContext,
|
|||
NS_ASSERTION(eStyleUnit_Normal == unit, "bad unit");
|
||||
lineHeight = font->mFont.size;
|
||||
#ifdef NEW_FONT_HEIGHT_APIS
|
||||
if (!nsHTMLReflowState::UseComputedHeight()) {
|
||||
if (!nsHTMLReflowState::UseComputedHeight() && fm) {
|
||||
lineHeight = GetNormalLineHeight(fm);
|
||||
}
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче