#128394 Cursor position widely off from actual text when selection is made.

Taking langGroup into consideration when selecting font for text selection, it
should be consistent with the way of rendering text.

r=rbs, sr=attinasi, a=asa, adt
This commit is contained in:
shanjian%netscape.com 2002-04-03 23:26:58 +00:00
parent 969eb059d1
commit 4e99a38eeb
2 changed files with 18 additions and 2 deletions

View File

@ -3400,9 +3400,17 @@ nsTextFrame::GetPosition(nsIPresContext* aCX,
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;
aCX->GetMetricsFor(font->mFont, getter_AddRefs(fm));
nsCOMPtr<nsIDeviceContext> dx;
aCX->GetDeviceContext(getter_AddRefs(dx));
dx->GetMetricsFor(font->mFont, langGroup, *getter_AddRefs(fm));
acx->SetFont(fm);
// Get the renderable form of the text

View File

@ -3400,9 +3400,17 @@ nsTextFrame::GetPosition(nsIPresContext* aCX,
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;
aCX->GetMetricsFor(font->mFont, getter_AddRefs(fm));
nsCOMPtr<nsIDeviceContext> dx;
aCX->GetDeviceContext(getter_AddRefs(dx));
dx->GetMetricsFor(font->mFont, langGroup, *getter_AddRefs(fm));
acx->SetFont(fm);
// Get the renderable form of the text