Backed out 6 changesets (bug 1121792) for mochitest failures in malloc_usable_size . CLOSED TREE

Backed out changeset 879211a561cc (bug 1121792)
Backed out changeset 195d689a6b12 (bug 1121792)
Backed out changeset 9726f4b6035a (bug 1121792)
Backed out changeset be24fa5c3e70 (bug 1121792)
Backed out changeset 2e4e3ae6cddd (bug 1121792)
Backed out changeset e535870263d8 (bug 1121792)
This commit is contained in:
Narcis Beleuzu 2023-04-12 22:26:19 +03:00
Родитель 9d9db1d757
Коммит 8d21434933
33 изменённых файлов: 28 добавлений и 423 удалений

3
Cargo.lock сгенерированный
Просмотреть файл

@ -3072,7 +3072,6 @@ dependencies = [
"servo_arc",
"smallbitvec",
"smallvec",
"thin-vec",
"void",
]
@ -4999,7 +4998,6 @@ dependencies = [
"static_prefs",
"style_derive",
"style_traits",
"thin-vec",
"time 0.1.45",
"to_shmem",
"to_shmem_derive",
@ -5275,7 +5273,6 @@ dependencies = [
"servo_arc",
"smallbitvec",
"smallvec",
"thin-vec",
]
[[package]]

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

@ -772,8 +772,9 @@ bool Gecko_MatchLang(const Element* aElement, nsAtom* aOverrideLang,
// from the parent we have to be prepared to look at all parent
// nodes. The language itself is encoded in the LANG attribute.
if (auto* language = aHasOverrideLang ? aOverrideLang : aElement->GetLang()) {
return nsStyleUtil::LangTagCompare(nsAtomCString(language),
NS_ConvertUTF16toUTF8(aValue));
return nsStyleUtil::DashMatchCompare(
nsDependentAtomString(language), nsDependentString(aValue),
nsASCIICaseInsensitiveStringComparator);
}
// Try to get the language from the HTTP header or if this
@ -783,10 +784,11 @@ bool Gecko_MatchLang(const Element* aElement, nsAtom* aOverrideLang,
nsAutoString language;
aElement->OwnerDoc()->GetContentLanguage(language);
NS_ConvertUTF16toUTF8 langString(aValue);
nsDependentString langString(aValue);
language.StripWhitespace();
for (auto const& lang : language.Split(char16_t(','))) {
if (nsStyleUtil::LangTagCompare(NS_ConvertUTF16toUTF8(lang), langString)) {
if (nsStyleUtil::DashMatchCompare(lang, langString,
nsASCIICaseInsensitiveStringComparator)) {
return true;
}
}

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

@ -9,8 +9,6 @@
#include "mozilla/dom/Document.h"
#include "mozilla/ExpandedPrincipal.h"
#include "mozilla/intl/MozLocaleBindings.h"
#include "mozilla/TextUtils.h"
#include "nsIContent.h"
#include "nsCSSProps.h"
#include "nsContentUtils.h"
@ -53,63 +51,6 @@ bool nsStyleUtil::DashMatchCompare(const nsAString& aAttributeValue,
return result;
}
bool nsStyleUtil::LangTagCompare(const nsACString& aAttributeValue,
const nsACString& aSelectorValue) {
class AutoLangId {
public:
AutoLangId() = delete;
AutoLangId(const AutoLangId& aOther) = delete;
explicit AutoLangId(const nsACString& aLangTag) : mIsValid(false) {
mLangId = intl::ffi::unic_langid_new(&aLangTag, &mIsValid);
}
~AutoLangId() { intl::ffi::unic_langid_destroy(mLangId); }
operator intl::ffi::LanguageIdentifier*() const { return mLangId; }
bool IsValid() const { return mIsValid; }
void Reset(const nsACString& aLangTag) {
intl::ffi::unic_langid_destroy(mLangId);
mLangId = intl::ffi::unic_langid_new(&aLangTag, &mIsValid);
}
private:
intl::ffi::LanguageIdentifier* mLangId;
bool mIsValid;
};
if (aAttributeValue.IsEmpty() || aSelectorValue.IsEmpty()) {
return false;
}
AutoLangId attrLangId(aAttributeValue);
if (!attrLangId.IsValid()) {
return false;
}
AutoLangId selectorId(aSelectorValue);
if (!selectorId.IsValid()) {
// If it was "invalid" because of a wildcard language subtag, replace that
// with 'und' and try again.
// XXX Should unic_langid_new handle the wildcard internally?
if (aSelectorValue[0] == '*') {
nsAutoCString temp(aSelectorValue);
temp.Replace(0, 1, "und");
selectorId.Reset(temp);
if (!selectorId.IsValid()) {
return false;
}
intl::ffi::unic_langid_clear_language(selectorId);
} else {
return false;
}
}
return intl::ffi::unic_langid_matches(attrLangId, selectorId,
/* match addrLangId as range */ false,
/* match selectorId as range */ true);
}
bool nsStyleUtil::ValueIncludes(const nsAString& aValueList,
const nsAString& aValue,
const nsStringComparator& aComparator) {

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

@ -37,9 +37,6 @@ class nsStyleUtil {
const nsAString& aSelectorValue,
const nsStringComparator& aComparator);
static bool LangTagCompare(const nsACString& aAttributeValue,
const nsACString& aSelectorValue);
static bool ValueIncludes(const nsAString& aValueList,
const nsAString& aValue,
const nsStringComparator& aComparator);

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

@ -44,7 +44,6 @@ servo_arc = { path = "../servo_arc" }
smallbitvec = "2.3.0"
smallvec = "1.0"
string_cache = { version = "0.8", optional = true }
thin-vec = { version = "0.2.1", features = ["gecko-ffi"] }
time = { version = "0.1.17", optional = true }
url = { version = "2.0", optional = true }
uuid = { version = "0.8", features = ["v4"], optional = true }

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

@ -427,26 +427,6 @@ where
}
}
impl<T> MallocShallowSizeOf for thin_vec::ThinVec<T> {
fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
if self.is_empty() {
// If it's the singleton we might not be a heap pointer.
return 0;
}
unsafe { ops.malloc_size_of(self.as_ptr()) }
}
}
impl<T: MallocSizeOf> MallocSizeOf for thin_vec::ThinVec<T> {
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
let mut n = self.shallow_size_of(ops);
for elem in self.iter() {
n += elem.size_of(ops);
}
n
}
}
macro_rules! malloc_size_of_hash_set {
($ty:ty) => {
impl<T, S> MallocShallowSizeOf for $ty

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

@ -73,7 +73,6 @@ servo_url = {path = "../url", optional = true}
to_shmem = {path = "../to_shmem"}
to_shmem_derive = {path = "../to_shmem_derive"}
time = "0.1"
thin-vec = { version = "0.2.1", features = ["gecko-ffi"] }
uluru = "3.0"
unicode-bidi = "0.3"
unicode-segmentation = "1.0"

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

@ -11,7 +11,7 @@ pub enum PseudoElement {
% for pseudo in PSEUDOS:
/// ${pseudo.value}
% if pseudo.is_tree_pseudo_element():
${pseudo.capitalized_pseudo()}(thin_vec::ThinVec<Atom>),
${pseudo.capitalized_pseudo()}(Box<Box<[Atom]>>),
% elif pseudo.pseudo_ident == "highlight":
${pseudo.capitalized_pseudo()}(AtomIdent),
% else:
@ -210,7 +210,7 @@ impl PseudoElement {
},
_ => {
if starts_with_ignore_ascii_case(name, "-moz-tree-") {
return PseudoElement::tree_pseudo_element(name, Default::default())
return PseudoElement::tree_pseudo_element(name, Box::new([]))
}
const WEBKIT_PREFIX: &str = "-webkit-";
if allow_unkown_webkit && starts_with_ignore_ascii_case(name, WEBKIT_PREFIX) {
@ -228,12 +228,12 @@ impl PseudoElement {
///
/// Returns `None` if the pseudo-element is not recognized.
#[inline]
pub fn tree_pseudo_element(name: &str, args: thin_vec::ThinVec<Atom>) -> Option<Self> {
pub fn tree_pseudo_element(name: &str, args: Box<[Atom]>) -> Option<Self> {
debug_assert!(starts_with_ignore_ascii_case(name, "-moz-tree-"));
let tree_part = &name[10..];
% for pseudo in TREE_PSEUDOS:
if tree_part.eq_ignore_ascii_case("${pseudo.value[11:]}") {
return Some(${pseudo_element_variant(pseudo, "args")});
return Some(${pseudo_element_variant(pseudo, "args.into()")});
}
% endfor
None

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

@ -20,7 +20,6 @@ use selectors::parser::SelectorParseErrorKind;
use selectors::SelectorList;
use std::fmt;
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss as ToCss_};
use thin_vec::ThinVec;
pub use crate::gecko::pseudo_element::{
PseudoElement, EAGER_PSEUDOS, EAGER_PSEUDO_COUNT, PSEUDO_COUNT,
@ -39,9 +38,7 @@ bitflags! {
}
/// The type used to store the language argument to the `:lang` pseudo-class.
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, ToCss, ToShmem)]
#[css(comma)]
pub struct Lang(#[css(iterable)] pub ThinVec<AtomIdent>);
pub type Lang = AtomIdent;
macro_rules! pseudo_class_name {
([$(($css:expr, $name:ident, $state:tt, $flags:tt),)*]) => {
@ -72,9 +69,9 @@ impl ToCss for NonTSPseudoClass {
([$(($css:expr, $name:ident, $state:tt, $flags:tt),)*]) => {
match *self {
$(NonTSPseudoClass::$name => concat!(":", $css),)*
NonTSPseudoClass::Lang(ref lang) => {
NonTSPseudoClass::Lang(ref s) => {
dest.write_str(":lang(")?;
lang.to_css(&mut CssWriter::new(dest))?;
cssparser::ToCss::to_css(s, dest)?;
return dest.write_char(')');
},
NonTSPseudoClass::MozLocaleDir(ref dir) => {
@ -378,13 +375,8 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
) -> Result<NonTSPseudoClass, ParseError<'i>> {
let pseudo_class = match_ignore_ascii_case! { &name,
"lang" => {
let result = parser.parse_comma_separated(|input| {
Ok(AtomIdent::from(input.expect_ident_or_string()?.as_ref()))
})?;
if result.is_empty() {
return Err(parser.new_custom_error(StyleParseErrorKind::UnspecifiedError));
}
NonTSPseudoClass::Lang(Lang(result.into()))
let name = parser.expect_ident_or_string()?;
NonTSPseudoClass::Lang(Lang::from(name.as_ref()))
},
"-moz-locale-dir" => {
NonTSPseudoClass::MozLocaleDir(Direction::parse(parser)?)
@ -434,7 +426,7 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
if starts_with_ignore_ascii_case(&name, "-moz-tree-") {
// Tree pseudo-elements can have zero or more arguments, separated
// by either comma or space.
let mut args = ThinVec::new();
let mut args = Vec::new();
loop {
let location = parser.current_source_location();
match parser.next() {
@ -448,6 +440,7 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
_ => unreachable!("Parser::next() shouldn't return any other error"),
}
}
let args = args.into_boxed_slice();
if let Some(pseudo) = PseudoElement::tree_pseudo_element(&name, args) {
if self.is_pseudo_element_enabled(&pseudo) {
return Ok(pseudo);

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

@ -1560,20 +1560,21 @@ impl<'le> TElement for GeckoElement<'le> {
}
fn match_element_lang(&self, override_lang: Option<Option<AttrValue>>, value: &Lang) -> bool {
// Gecko supports :lang() from CSS Selectors 4, which accepts a list
// of language tags, and does BCP47-style range matching.
// Gecko supports :lang() from CSS Selectors 3, which only accepts a
// single language tag, and which performs simple dash-prefix matching
// on it.
let override_lang_ptr = match override_lang {
Some(Some(ref atom)) => atom.as_ptr(),
_ => ptr::null_mut(),
};
value.0.iter().any(|lang| unsafe {
unsafe {
Gecko_MatchLang(
self.0,
override_lang_ptr,
override_lang.is_some(),
lang.as_slice().as_ptr(),
value.as_slice().as_ptr(),
)
})
}
}
fn is_html_document_body_element(&self) -> bool {

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

@ -19,4 +19,3 @@ servo_arc = { path = "../servo_arc" }
smallbitvec = "2.1.1"
smallvec = "1.0"
string_cache = { version = "0.8", optional = true }
thin-vec = { version = "0.2.1", features = ["gecko-ffi"] }

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

@ -18,7 +18,6 @@ extern crate smallbitvec;
extern crate smallvec;
#[cfg(feature = "string_cache")]
extern crate string_cache;
extern crate thin_vec;
use servo_arc::{Arc, ThinArc};
use smallbitvec::{InternalStorage, SmallBitVec};
@ -38,7 +37,6 @@ use std::os::raw::c_void;
use std::ptr::{self, NonNull};
use std::slice;
use std::str;
use thin_vec::ThinVec;
/// Result type for ToShmem::to_shmem.
///
@ -485,54 +483,6 @@ impl<H: ToShmem, T: ToShmem> ToShmem for ThinArc<H, T> {
}
}
impl<T: ToShmem> ToShmem for ThinVec<T> {
fn to_shmem(&self, builder: &mut SharedMemoryBuilder) -> Result<Self> {
let len = self.len();
if len == 0 {
return Ok(ManuallyDrop::new(Self::new()))
}
assert_eq!(mem::size_of::<Self>(), mem::size_of::<*const ()>());
// nsTArrayHeader size.
// FIXME: Would be nice not to hard-code this, but in practice thin-vec crate also relies
// on this.
let header_size = 2 * mem::size_of::<u32>();
let header_align = mem::size_of::<u32>();
let item_size = mem::size_of::<T>();
let item_align = mem::align_of::<T>();
// We don't need to support underalignment for now.
assert!(item_align >= header_align);
let header_padding = item_align - header_size;
let layout = Layout::from_size_align(header_size + header_padding + padded_size(item_size, item_align) * len, item_align).unwrap();
let shmem_header_ptr = builder.alloc::<u8>(layout);
let shmem_data_ptr = unsafe { shmem_header_ptr.add(header_size + header_padding) };
let data_ptr = self.as_ptr() as *const T as *const u8;
let header_ptr = unsafe { data_ptr.sub(header_size + header_padding) };
unsafe {
// Copy the header. Note this might copy a wrong capacity, but it doesn't matter,
// because shared memory ptrs are immutable anyways, and we can't relocate.
ptr::copy(header_ptr, shmem_header_ptr, header_size);
// ToShmem + copy the contents into the shared buffer.
to_shmem_slice_ptr(self.iter(), shmem_data_ptr as *mut T, builder)?;
// Return the new ThinVec, which is just a pointer to the shared memory buffer.
let shmem_thinvec: Self = mem::transmute(shmem_header_ptr);
// Sanity-check that the ptr and length match.
debug_assert_eq!(shmem_thinvec.as_ptr(), shmem_data_ptr as *const T);
debug_assert_eq!(shmem_thinvec.len(), len);
Ok(ManuallyDrop::new(shmem_thinvec))
}
}
}
impl ToShmem for SmallBitVec {
fn to_shmem(&self, builder: &mut SharedMemoryBuilder) -> Result<Self> {
let storage = match self.clone().into_storage() {

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

@ -321,7 +321,6 @@ renaming_overrides_prefixing = true
"BeforeFlag" = "StyleEasingBeforeFlag"
"FontPaletteValueSet" = "gfx::FontPaletteValueSet"
"PaletteValues" = "gfx::FontPaletteValueSet::PaletteValues"
"ThinVec" = "nsTArray"
[export.body]
"CSSPixelLength" = """

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

@ -28,8 +28,8 @@ This tests a detail related to :lang support. If :lang is not supported, a messa
<script>
test(function() {
assert_equals(document.getElementById('colonlangcontroltest').offsetWidth, 0)
assert_in_array(document.getElementById('box').offsetWidth, [50, 100]);
}, "A :lang value with language and region subtags will match a lang attribute value with language, script and region subtags under CSS Selectors 4, but not Selectors 3.");
assert_equals(document.getElementById('box').offsetWidth, 50);
}, "A :lang value with language and region subtags will NOT match a lang attribute value with language, script and region subtags.");
</script>
<div id='log'></div>

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

@ -1,11 +0,0 @@
<!DOCTYPE html>
<html lang="en-US">
<meta charset="utf-8">
<title>CSS Selectors 4 - :lang matching reference</title>
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
<style>
div.test { color: green; }
</style>
<div class="test">This should be green</div>

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

@ -1,13 +0,0 @@
<!DOCTYPE html>
<html lang="en-US">
<meta charset="utf-8">
<title>CSS Selectors 4 - :lang matching</title>
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#the-lang-pseudo">
<link rel="match" href="lang-000-ref.html">
<style>
:lang(en-US) { color: green; }
</style>
<div class="test">This should be green</div>

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

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html lang="en-US">
<meta charset="utf-8">
<title>CSS Selectors 4 - :lang matching</title>
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#the-lang-pseudo">
<link rel="match" href="lang-000-ref.html">
<style>
div.test { color: red; }
:lang(fr) { color: green; }
</style>
<div class="test"><span lang="fr">This should be green</span></div>

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

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html lang="en-US">
<meta charset="utf-8">
<title>CSS Selectors 4 - :lang matching</title>
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#the-lang-pseudo">
<link rel="match" href="lang-000-ref.html">
<style>
div.test { color: red; }
:lang("FR") { color: green; }
</style>
<div class="test"><span lang="fr">This should be green</span></div>

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

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html lang="en-US">
<meta charset="utf-8">
<title>CSS Selectors 4 - :lang matching</title>
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#the-lang-pseudo">
<link rel="match" href="lang-000-ref.html">
<style>
div.test { color: red; }
:lang("Fr") { color: green; }
</style>
<div class="test"><span lang="fR">This should be green</span></div>

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

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html lang="en-US">
<meta charset="utf-8">
<title>CSS Selectors 4 - :lang matching</title>
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#the-lang-pseudo">
<link rel="match" href="lang-000-ref.html">
<style>
div.test { color: red; }
:lang("fr") { color: green; }
</style>
<div class="test"><span lang="fr-CH">This should be green</span></div>

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

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html lang="en-US">
<meta charset="utf-8">
<title>CSS Selectors 4 - :lang matching</title>
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#the-lang-pseudo">
<link rel="match" href="lang-000-ref.html">
<style>
div.test { color: green; }
:lang("fr-CH") { color: red; }
</style>
<div class="test"><span lang="fr">This should be green</span></div>

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

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html lang="en-US">
<meta charset="utf-8">
<title>CSS Selectors 4 - :lang matching</title>
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#the-lang-pseudo">
<link rel="match" href="lang-000-ref.html">
<style>
div.test { color: green; }
:lang("fr-CH") { color: red; }
</style>
<div class="test"><span lang="fr-FR">This should be green</span></div>

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

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html lang="en-US">
<meta charset="utf-8">
<title>CSS Selectors 4 - :lang matching</title>
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#the-lang-pseudo">
<link rel="match" href="lang-000-ref.html">
<style>
div.test { color: red; }
:lang("*-CH") { color: green; }
</style>
<div class="test"><span lang="fr-CH">This should be green</span></div>

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

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html lang="en-US">
<meta charset="utf-8">
<title>CSS Selectors 4 - :lang matching</title>
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#the-lang-pseudo">
<link rel="match" href="lang-000-ref.html">
<style>
div.test { color: red; }
:lang("*-Latn") { color: green; }
</style>
<div class="test"><span lang="fr-Latn-FR">This should be green</span></div>

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

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html lang="en-US">
<meta charset="utf-8">
<title>CSS Selectors 4 - :lang matching</title>
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#the-lang-pseudo">
<link rel="match" href="lang-000-ref.html">
<style>
div.test { color: red; }
:lang("fr-FR") { color: green; }
</style>
<div class="test"><span lang="fr-Latn-FR">This should be green</span></div>

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

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html lang="en-US">
<meta charset="utf-8">
<title>CSS Selectors 4 - :lang matching</title>
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#the-lang-pseudo">
<link rel="match" href="lang-000-ref.html">
<style>
div.test { color: red; }
:lang("*-FR") { color: green; }
</style>
<div class="test"><span lang="fr-Latn-FR">This should be green</span></div>

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

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html lang="en-US">
<meta charset="utf-8">
<title>CSS Selectors 4 - :lang matching</title>
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#the-lang-pseudo">
<link rel="match" href="lang-000-ref.html">
<style>
div.test { color: red; }
:lang("fr", "nl", "de") { color: green; }
</style>
<div class="test"><span lang="fr-Latn-FR">This should be green</span></div>

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

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html lang="en-US">
<meta charset="utf-8">
<title>CSS Selectors 4 - :lang matching</title>
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#the-lang-pseudo">
<link rel="match" href="lang-000-ref.html">
<style>
div.test { color: red; }
:lang(de, nl, fr) { color: green; }
</style>
<div class="test"><span lang="fr-Latn-FR">This should be green</span></div>

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

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html lang="en-US">
<meta charset="utf-8">
<title>CSS Selectors 4 - :lang matching</title>
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#the-lang-pseudo">
<link rel="match" href="lang-000-ref.html">
<style>
div.test { color: green; }
:lang(de, nl, 0, fr) { color: red; }
</style>
<div class="test"><span lang="fr">This should be green</span></div>

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

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html lang="en-US">
<meta charset="utf-8">
<title>CSS Selectors 4 - :lang matching</title>
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#the-lang-pseudo">
<link rel="match" href="lang-000-ref.html">
<style>
div.test { color: green; }
:lang(0) { color: red; }
</style>
<div class="test"><span lang="0">This should be green</span></div>

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

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html lang="en-US">
<meta charset="utf-8">
<title>CSS Selectors 4 - :lang matching</title>
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#the-lang-pseudo">
<link rel="match" href="lang-000-ref.html">
<style>
div.test { color: red; }
:lang(\*-FR) { color: green; }
</style>
<div class="test"><span lang="fr-Latn-FR">This should be green</span></div>

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

@ -1,13 +0,0 @@
<!doctype html>
<title>Setting both http-equiv and name attributes on a meta element</title>
<meta http-equiv=content-language name=color-scheme content=de-DE>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
// We don't attempt to test the color-scheme here because "de-DE" is not a valid
// value for it.
test(() => {
assert_equals(document.querySelector(":root:lang(de-DE)"), document.documentElement);
}, "<meta> set the content-language to de-DE");
</script>

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

@ -12,12 +12,7 @@
// This creates a test()
assert_root_color_scheme("dark", "<meta> set the color-scheme to dark");
// We can't test content-language against :lang(), because CSS Selectors 4
// references BCP 47 syntax and RFC4647 "Matching of Language Tags", but
// "dark" is not a well-formed BCP 47 tag and therefore cannot be matched.
// Therefore, the test that content-language gets set is split off to a
// separate testcase using a well-formed lang tag as the content.
// test(() => {
// assert_equals(document.querySelector(":root:lang(dark)"), document.documentElement);
// }, "<meta> set the content-language to dark");
test(() => {
assert_equals(document.querySelector(":root:lang(dark)"), document.documentElement);
}, "<meta> set the content-language to dark");
</script>