mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1213842 - :lang() should not fall back to HTTP headers if empty lang attribute is specified; r=bz
This commit is contained in:
parent
03c8ae97d1
commit
db4fe4bcfb
@ -911,11 +911,11 @@ public:
|
||||
mozilla::dom::Element* GetEditingHost();
|
||||
|
||||
/**
|
||||
* Determing language. Look at the nearest ancestor element that has a lang
|
||||
* Determining language. Look at the nearest ancestor element that has a lang
|
||||
* attribute in the XML namespace or is an HTML/SVG element and has a lang in
|
||||
* no namespace attribute.
|
||||
* no namespace attribute. Returns false if no language was specified.
|
||||
*/
|
||||
void GetLang(nsAString& aResult) const {
|
||||
bool GetLang(nsAString& aResult) const {
|
||||
for (const nsIContent* content = this; content; content = content->GetParent()) {
|
||||
if (content->GetAttrCount() > 0) {
|
||||
// xml:lang has precedence over lang on HTML elements (see
|
||||
@ -930,10 +930,11 @@ public:
|
||||
NS_ASSERTION(hasAttr || aResult.IsEmpty(),
|
||||
"GetAttr that returns false should not make string non-empty");
|
||||
if (hasAttr) {
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Overloaded from nsINode
|
||||
|
@ -1884,8 +1884,7 @@ static bool SelectorMatches(Element* aElement,
|
||||
// from the parent we have to be prepared to look at all parent
|
||||
// nodes. The language itself is encoded in the LANG attribute.
|
||||
nsAutoString language;
|
||||
aElement->GetLang(language);
|
||||
if (!language.IsEmpty()) {
|
||||
if (aElement->GetLang(language)) {
|
||||
if (!nsStyleUtil::DashMatchCompare(language,
|
||||
nsDependentString(pseudoClass->u.mString),
|
||||
nsASCIICaseInsensitiveStringComparator())) {
|
||||
|
@ -1,5 +0,0 @@
|
||||
[the-lang-attribute-009.html]
|
||||
type: testharness
|
||||
[If the HTTP header contains a language declaration but the html element uses an empty lang value, the UA will not recognize the language declared in the HTTP header.]
|
||||
expected: FAIL
|
||||
|
@ -1,5 +0,0 @@
|
||||
[the-lang-attribute-010.html]
|
||||
type: testharness
|
||||
[If the meta Content-Language element contains a language declaration but the html element uses an empty lang value, the UA will not recognize the language declared in the meta Content-Language element.]
|
||||
expected: FAIL
|
||||
|
Loading…
Reference in New Issue
Block a user