diff --git a/content/html/style/src/nsCSSParser.cpp b/content/html/style/src/nsCSSParser.cpp
index 24ef2290153..f97cbc4d374 100644
--- a/content/html/style/src/nsCSSParser.cpp
+++ b/content/html/style/src/nsCSSParser.cpp
@@ -5197,7 +5197,9 @@ PRBool CSSParserImpl::ParseFont(nsresult& aErrorCode)
// Get optional "/" line-height
nsCSSValue lineHeight;
if (ExpectSymbol(aErrorCode, '/', PR_TRUE)) {
- if (! ParseVariant(aErrorCode, lineHeight, VARIANT_NUMBER | VARIANT_LP | VARIANT_NORMAL, nsnull)) {
+ if (! ParsePositiveVariant(aErrorCode, lineHeight,
+ VARIANT_NUMBER | VARIANT_LP | VARIANT_NORMAL,
+ nsnull)) {
return PR_FALSE;
}
}
diff --git a/layout/generic/nsHTMLReflowState.cpp b/layout/generic/nsHTMLReflowState.cpp
index 55bb6004d77..71d09568439 100644
--- a/layout/generic/nsHTMLReflowState.cpp
+++ b/layout/generic/nsHTMLReflowState.cpp
@@ -2185,27 +2185,14 @@ nsHTMLReflowState::CalcLineHeight(nsIPresContext* aPresContext,
nsIRenderingContext* aRenderingContext,
nsIFrame* aFrame)
{
- nscoord lineHeight = -1;
- nsStyleContext* sc = aFrame->GetStyleContext();
- if (sc) {
- lineHeight = ComputeLineHeight(aPresContext, aRenderingContext, sc);
- }
- if (lineHeight < 0) {
- // Negative line-heights are not allowed by the spec. Translate
- // them into "normal" when found.
- const nsStyleFont* font = sc->GetStyleFont();
- if (UseComputedHeight()) {
- lineHeight = font->mFont.size;
- }
- else {
- SetFontFromStyle(aRenderingContext, sc);
- nsCOMPtr fm;
- aRenderingContext->GetFontMetrics(*getter_AddRefs(fm));
- if (fm) {
- lineHeight = GetNormalLineHeight(fm);
- }
- }
- }
+ NS_ASSERTION(aFrame && aFrame->GetStyleContext(),
+ "Bogus data passed in to CalcLineHeight");
+
+ nscoord lineHeight = ComputeLineHeight(aPresContext, aRenderingContext,
+ aFrame->GetStyleContext());
+
+ NS_ASSERTION(lineHeight >= 0, "ComputeLineHeight screwed up");
+
return lineHeight;
}
diff --git a/layout/html/base/src/nsHTMLReflowState.cpp b/layout/html/base/src/nsHTMLReflowState.cpp
index 55bb6004d77..71d09568439 100644
--- a/layout/html/base/src/nsHTMLReflowState.cpp
+++ b/layout/html/base/src/nsHTMLReflowState.cpp
@@ -2185,27 +2185,14 @@ nsHTMLReflowState::CalcLineHeight(nsIPresContext* aPresContext,
nsIRenderingContext* aRenderingContext,
nsIFrame* aFrame)
{
- nscoord lineHeight = -1;
- nsStyleContext* sc = aFrame->GetStyleContext();
- if (sc) {
- lineHeight = ComputeLineHeight(aPresContext, aRenderingContext, sc);
- }
- if (lineHeight < 0) {
- // Negative line-heights are not allowed by the spec. Translate
- // them into "normal" when found.
- const nsStyleFont* font = sc->GetStyleFont();
- if (UseComputedHeight()) {
- lineHeight = font->mFont.size;
- }
- else {
- SetFontFromStyle(aRenderingContext, sc);
- nsCOMPtr fm;
- aRenderingContext->GetFontMetrics(*getter_AddRefs(fm));
- if (fm) {
- lineHeight = GetNormalLineHeight(fm);
- }
- }
- }
+ NS_ASSERTION(aFrame && aFrame->GetStyleContext(),
+ "Bogus data passed in to CalcLineHeight");
+
+ nscoord lineHeight = ComputeLineHeight(aPresContext, aRenderingContext,
+ aFrame->GetStyleContext());
+
+ NS_ASSERTION(lineHeight >= 0, "ComputeLineHeight screwed up");
+
return lineHeight;
}
diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp
index 24ef2290153..f97cbc4d374 100644
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -5197,7 +5197,9 @@ PRBool CSSParserImpl::ParseFont(nsresult& aErrorCode)
// Get optional "/" line-height
nsCSSValue lineHeight;
if (ExpectSymbol(aErrorCode, '/', PR_TRUE)) {
- if (! ParseVariant(aErrorCode, lineHeight, VARIANT_NUMBER | VARIANT_LP | VARIANT_NORMAL, nsnull)) {
+ if (! ParsePositiveVariant(aErrorCode, lineHeight,
+ VARIANT_NUMBER | VARIANT_LP | VARIANT_NORMAL,
+ nsnull)) {
return PR_FALSE;
}
}