Track whether nsStyleVisibility::mLanguage came from explicit information in the document. (Bug 702121, patch 1) r=jfkthame

This commit is contained in:
L. David Baron 2012-08-20 19:23:32 -07:00
Родитель 54799a245c
Коммит 31b5c3639b
3 изменённых файлов: 17 добавлений и 5 удалений

Просмотреть файл

@ -2947,6 +2947,7 @@ nsRuleNode::SetFont(nsPresContext* aPresContext, nsStyleContext* aContext,
nsContentUtils::ASCIIToLower(lang);
aFont->mLanguage = do_GetAtom(lang);
aFont->mExplicitLanguage = true;
}
const nsFont* defaultVariableFont =

Просмотреть файл

@ -89,8 +89,9 @@ static nsChangeHint CalcShadowDifference(nsCSSShadowArray* lhs,
// nsStyleFont
//
nsStyleFont::nsStyleFont(const nsFont& aFont, nsPresContext *aPresContext)
: mFont(aFont),
mGenericID(kGenericFont_NONE)
: mFont(aFont)
, mGenericID(kGenericFont_NONE)
, mExplicitLanguage(false)
{
MOZ_COUNT_CTOR(nsStyleFont);
Init(aPresContext);
@ -101,6 +102,7 @@ nsStyleFont::nsStyleFont(const nsStyleFont& aSrc)
, mSize(aSrc.mSize)
, mGenericID(aSrc.mGenericID)
, mScriptLevel(aSrc.mScriptLevel)
, mExplicitLanguage(aSrc.mExplicitLanguage)
, mScriptUnconstrainedSize(aSrc.mScriptUnconstrainedSize)
, mScriptMinSize(aSrc.mScriptMinSize)
, mScriptSizeMultiplier(aSrc.mScriptSizeMultiplier)
@ -111,8 +113,10 @@ nsStyleFont::nsStyleFont(const nsStyleFont& aSrc)
nsStyleFont::nsStyleFont(nsPresContext* aPresContext)
// passing nullptr to GetDefaultFont make it use the doc language
: mFont(*(aPresContext->GetDefaultFont(kPresContext_DefaultVariableFont_ID, nullptr))),
mGenericID(kGenericFont_NONE)
: mFont(*(aPresContext->GetDefaultFont(kPresContext_DefaultVariableFont_ID,
nullptr)))
, mGenericID(kGenericFont_NONE)
, mExplicitLanguage(false)
{
MOZ_COUNT_CTOR(nsStyleFont);
Init(aPresContext);
@ -137,6 +141,8 @@ nsStyleFont::Init(nsPresContext* aPresContext)
if (!language.IsEmpty() &&
language.FindChar(PRUnichar(',')) == kNotFound) {
mLanguage = do_GetAtom(language);
// NOTE: This does *not* count as an explicit language; in other
// words, it doesn't trigger language-specific hyphenation.
} else {
// we didn't find a (usable) Content-Language, so we fall back
// to whatever the presContext guessed from the charset
@ -161,7 +167,8 @@ nsStyleFont::Destroy(nsPresContext* aContext) {
nsChangeHint nsStyleFont::CalcDifference(const nsStyleFont& aOther) const
{
if (mSize != aOther.mSize ||
mLanguage != aOther.mLanguage) {
mLanguage != aOther.mLanguage ||
mExplicitLanguage != aOther.mExplicitLanguage) {
return NS_STYLE_HINT_REFLOW;
}
return CalcFontDifference(mFont, aOther.mFont);

Просмотреть файл

@ -108,6 +108,10 @@ public:
// MathML scriptlevel support
PRInt8 mScriptLevel; // [inherited]
// was mLanguage set based on a lang attribute in the document?
bool mExplicitLanguage; // [inherited]
// The value mSize would have had if scriptminsize had never been applied
nscoord mScriptUnconstrainedSize;
nscoord mScriptMinSize; // [inherited] length