Bug 631352. Changes to @lang need to restyle all descendants. r=dbaron, a=blocker

This commit is contained in:
Boris Zbarsky 2011-02-08 16:30:57 -05:00
parent ac8850b133
commit 0e2f2b9189
4 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<body>
<div>This text should be visible</div>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<style>
div:not(:lang(foo)) { display: none; }
</style>
</head>
<body onload="document.body.offsetWidth; document.body.lang = 'foo'">
<div>This text should be visible</div>
</body>
</html>

View File

@ -1609,3 +1609,4 @@ random-if(winWidget) == 621918-1.svg 621918-1-ref.svg # 1-pixel diacritic positi
random-if(winWidget) HTTP(..) == 621918-2.svg 621918-2-ref.svg # same 1px issue as above, and HTTP(..) for filters.svg, used to mask antialiasing issues where glyphs touch
== 625409-1.html 625409-1-ref.html
== 627393-1.html about:blank
== 631352-1.html 631352-1-ref.html

View File

@ -2573,6 +2573,14 @@ nsCSSRuleProcessor::HasAttributeDependentStyle(AttributeRuleProcessorData* aData
{
data.change = nsRestyleHint(data.change | eRestyle_Subtree);
}
// We don't know the namespace of the attribute, and xml:lang applies to
// all elements. If the lang attribute changes, we need to restyle our
// whole subtree, since the :lang selector on our descendants can examine
// our lang attribute.
if (aData->mAttribute == nsGkAtoms::lang) {
data.change = nsRestyleHint(data.change | eRestyle_Subtree);
}
}
RuleCascadeData* cascade = GetRuleCascade(aData->mPresContext);