#142562 problem with <td align=right or align=center

We are observing langGroup in some place while ignor it in others. This patch
make all font metrics call consistent. nsIRenderingContext API is change to
make things neat.
r=rbs, sr=waterson


git-svn-id: svn://10.0.0.236/trunk@122131 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
shanjian%netscape.com
2002-05-24 20:11:14 +00:00
parent 2f838a3f76
commit a9c700ad59
54 changed files with 168 additions and 190 deletions

View File

@@ -393,7 +393,6 @@ nsresult nsBlinkTimer::RemoveBlinkFrame(nsIFrame* aFrame)
return NS_OK;
}
//----------------------------------------------------------------------
#ifdef IBMBIDI
@@ -560,15 +559,9 @@ public:
NS_ASSERTION(plainFont, "null plainFont: font problems in TextStyle::TextStyle");
PRUint8 originalDecorations = plainFont->decorations;
plainFont->decorations = NS_FONT_DECORATION_NONE;
nsCOMPtr<nsIDeviceContext> deviceContext;
aRenderingContext.GetDeviceContext(*getter_AddRefs(deviceContext));
nsCOMPtr<nsIAtom> langGroup;
if (mVisibility->mLanguage) {
mVisibility->mLanguage->GetLanguageGroup(getter_AddRefs(langGroup));
}
mAveCharWidth = 0;
deviceContext->GetMetricsFor(*plainFont, langGroup, mNormalFont);
aRenderingContext.SetFont(mNormalFont); // some users of the struct expect this state
SetFontFromStyle(&aRenderingContext, sc); // some users of the struct expect this state
aRenderingContext.GetFontMetrics(mNormalFont);
mNormalFont->GetSpaceWidth(mSpaceWidth);
#if defined(_WIN32) || defined(XP_OS2)
mNormalFont->GetAveCharWidth(mAveCharWidth);
@@ -3397,22 +3390,7 @@ nsTextFrame::GetPosition(nsIPresContext* aCX,
}
// Find the font metrics for this text
nsIStyleContext* styleContext;
GetStyleContext(&styleContext);
const nsStyleFont *font = (const nsStyleFont*)
styleContext->GetStyleData(eStyleStruct_Font);
const nsStyleVisibility* visibility = (const nsStyleVisibility*)
styleContext->GetStyleData(eStyleStruct_Visibility);
NS_RELEASE(styleContext);
nsCOMPtr<nsIAtom> langGroup;
if (visibility && visibility->mLanguage) {
visibility->mLanguage->GetLanguageGroup(getter_AddRefs(langGroup));
}
nsCOMPtr<nsIFontMetrics> fm;
nsCOMPtr<nsIDeviceContext> dx;
aCX->GetDeviceContext(getter_AddRefs(dx));
dx->GetMetricsFor(font->mFont, langGroup, *getter_AddRefs(fm));
acx->SetFont(fm);
SetFontFromStyle(acx, mStyleContext);
// Get the renderable form of the text
nsCOMPtr<nsIDocument> doc(getter_AddRefs(GetDocument(aCX)));
@@ -5405,8 +5383,7 @@ nsTextFrame::Reflow(nsIPresContext* aPresContext,
aData.Mid(aText, mContentOffset, mContentLength);
// Set the font
const nsStyleFont* font = (const nsStyleFont*)mStyleContext->GetStyleData(eStyleStruct_Font);
aReflowState.rendContext->SetFont(font->mFont);
SetFontFromStyle(aReflowState.rendContext, mStyleContext);
// Now get the exact bounding metrics of the text
nsBoundingMetrics bm;
@@ -5522,9 +5499,8 @@ nsTextFrame::TrimTrailingWhiteSpace(nsIPresContext* aPresContext,
if (XP_IS_SPACE(ch)) {
// Get font metrics for a space so we can adjust the width by the
// right amount.
const nsStyleFont* fontStyle = (const nsStyleFont*)
mStyleContext->GetStyleData(eStyleStruct_Font);
aRC.SetFont(fontStyle->mFont);
SetFontFromStyle(&aRC, mStyleContext);
aRC.GetWidth(' ', dw);
// NOTE: Trailing whitespace includes word and letter spacing!
nsStyleUnit unit;