From 98d4d3661b5960211c41953170f7e70c9ebe56df Mon Sep 17 00:00:00 2001 From: "jerry.tan%sun.com" Date: Mon, 23 Dec 2002 06:01:14 +0000 Subject: [PATCH] bug 181644, patch by rick.ju@sun.com, r=bz, sr=roc+moz git-svn-id: svn://10.0.0.236/trunk@135580 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsHTMLReflowState.cpp | 20 +++++-------------- .../html/base/src/nsHTMLReflowState.cpp | 20 +++++-------------- 2 files changed, 10 insertions(+), 30 deletions(-) diff --git a/mozilla/layout/generic/nsHTMLReflowState.cpp b/mozilla/layout/generic/nsHTMLReflowState.cpp index ddd25c9a8aa..4c485bf98bd 100644 --- a/mozilla/layout/generic/nsHTMLReflowState.cpp +++ b/mozilla/layout/generic/nsHTMLReflowState.cpp @@ -851,22 +851,12 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsIPresContext* aPresContext, // space of the block frame that contains it GetPlaceholderOffset(aPlaceholderFrame, aBlockFrame, placeholderOffset); - // The y-offset is the baseline of where the text would be if it were - // in the flow. We need the top position and not the baseline position - nsIFontMetrics* metrics; - const nsStyleFont* font; + // Use the top of the inline box which the placeholder lives in as the + // hypothetical box's top. + nsPoint offset; + aPlaceholderFrame->GetOrigin(offset); + placeholderOffset.y -= offset.y; - frame->GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font); - aPresContext->GetMetricsFor(font->mFont, &metrics); - if (metrics) { - nscoord ascent; - - // Adjust the y-offset up by the font ascent. That will translate from - // the baseline to the top of where the text would be - metrics->GetMaxAscent(ascent); - placeholderOffset.y -= ascent; - NS_RELEASE(metrics); - } aHypotheticalBox.mTop = placeholderOffset.y; // To determine the left and right offsets we need to look at the block's 'direction' diff --git a/mozilla/layout/html/base/src/nsHTMLReflowState.cpp b/mozilla/layout/html/base/src/nsHTMLReflowState.cpp index ddd25c9a8aa..4c485bf98bd 100644 --- a/mozilla/layout/html/base/src/nsHTMLReflowState.cpp +++ b/mozilla/layout/html/base/src/nsHTMLReflowState.cpp @@ -851,22 +851,12 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsIPresContext* aPresContext, // space of the block frame that contains it GetPlaceholderOffset(aPlaceholderFrame, aBlockFrame, placeholderOffset); - // The y-offset is the baseline of where the text would be if it were - // in the flow. We need the top position and not the baseline position - nsIFontMetrics* metrics; - const nsStyleFont* font; + // Use the top of the inline box which the placeholder lives in as the + // hypothetical box's top. + nsPoint offset; + aPlaceholderFrame->GetOrigin(offset); + placeholderOffset.y -= offset.y; - frame->GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font); - aPresContext->GetMetricsFor(font->mFont, &metrics); - if (metrics) { - nscoord ascent; - - // Adjust the y-offset up by the font ascent. That will translate from - // the baseline to the top of where the text would be - metrics->GetMaxAscent(ascent); - placeholderOffset.y -= ascent; - NS_RELEASE(metrics); - } aHypotheticalBox.mTop = placeholderOffset.y; // To determine the left and right offsets we need to look at the block's 'direction'