mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-04 21:18:35 +00:00
Make getComputedStyle remove the extra default font that we add to the end of the font-family list so it returns the original computed value. b=94078 r=hyatt sr=jst
This commit is contained in:
parent
0c252bde5d
commit
06944cc30e
@ -845,7 +845,31 @@ nsComputedDOMStyle::GetFontFamily(nsIFrame *aFrame,
|
||||
GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font, aFrame);
|
||||
|
||||
if(font) {
|
||||
val->SetString(font->mFont.name);
|
||||
nsCOMPtr<nsIPresShell> presShell=do_QueryReferent(mPresShellWeak);
|
||||
NS_ASSERTION(presShell, "pres shell is required");
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
NS_ASSERTION(presContext, "pres context is required");
|
||||
|
||||
if (font->mFlags & NS_STYLE_FONT_USE_FIXED) {
|
||||
const nsString& fontName = font->mFixedFont.name;
|
||||
const nsFont& defaultFont = presContext->GetDefaultFixedFontDeprecated();
|
||||
PRInt32 lendiff = fontName.Length() - defaultFont.name.Length();
|
||||
if (lendiff > 0) {
|
||||
val->SetString(Substring(fontName, 0, lendiff-1)); // -1 removes comma
|
||||
} else {
|
||||
val->SetString(fontName);
|
||||
}
|
||||
} else {
|
||||
const nsString& fontName = font->mFont.name;
|
||||
const nsFont& defaultFont = presContext->GetDefaultFontDeprecated();
|
||||
PRInt32 lendiff = fontName.Length() - defaultFont.name.Length();
|
||||
if (lendiff > 0) {
|
||||
val->SetString(Substring(fontName, 0, lendiff-1)); // -1 removes comma
|
||||
} else {
|
||||
val->SetString(fontName);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
val->SetString("");
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
mType = CSS_STRING;
|
||||
}
|
||||
|
||||
void SetString(const nsString& aString)
|
||||
void SetString(const nsAString& aString)
|
||||
{
|
||||
mString.Assign(aString);
|
||||
mType = CSS_STRING;
|
||||
|
@ -845,7 +845,31 @@ nsComputedDOMStyle::GetFontFamily(nsIFrame *aFrame,
|
||||
GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font, aFrame);
|
||||
|
||||
if(font) {
|
||||
val->SetString(font->mFont.name);
|
||||
nsCOMPtr<nsIPresShell> presShell=do_QueryReferent(mPresShellWeak);
|
||||
NS_ASSERTION(presShell, "pres shell is required");
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
NS_ASSERTION(presContext, "pres context is required");
|
||||
|
||||
if (font->mFlags & NS_STYLE_FONT_USE_FIXED) {
|
||||
const nsString& fontName = font->mFixedFont.name;
|
||||
const nsFont& defaultFont = presContext->GetDefaultFixedFontDeprecated();
|
||||
PRInt32 lendiff = fontName.Length() - defaultFont.name.Length();
|
||||
if (lendiff > 0) {
|
||||
val->SetString(Substring(fontName, 0, lendiff-1)); // -1 removes comma
|
||||
} else {
|
||||
val->SetString(fontName);
|
||||
}
|
||||
} else {
|
||||
const nsString& fontName = font->mFont.name;
|
||||
const nsFont& defaultFont = presContext->GetDefaultFontDeprecated();
|
||||
PRInt32 lendiff = fontName.Length() - defaultFont.name.Length();
|
||||
if (lendiff > 0) {
|
||||
val->SetString(Substring(fontName, 0, lendiff-1)); // -1 removes comma
|
||||
} else {
|
||||
val->SetString(fontName);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
val->SetString("");
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
mType = CSS_STRING;
|
||||
}
|
||||
|
||||
void SetString(const nsString& aString)
|
||||
void SetString(const nsAString& aString)
|
||||
{
|
||||
mString.Assign(aString);
|
||||
mType = CSS_STRING;
|
||||
|
Loading…
x
Reference in New Issue
Block a user