mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
layout: Implement a non-recursive version of CSS quotes
(#34770)
* Squash and don't explicitly use noto-cjk in tests Signed-off-by: Xiaocheng Hu <xiaochengh.work@gmail.com> * Mark quotes-034.html.ini failure Signed-off-by: Xiaocheng Hu <xiaochengh.work@gmail.com> * Address review comments Signed-off-by: Xiaocheng Hu <xiaochengh.work@gmail.com> --------- Signed-off-by: Xiaocheng Hu <xiaochengh.work@gmail.com>
This commit is contained in:
parent
31de9c1c21
commit
11f54b9f23
25 changed files with 536 additions and 229 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -4135,6 +4135,7 @@ dependencies = [
|
||||||
"fonts_traits",
|
"fonts_traits",
|
||||||
"fxhash",
|
"fxhash",
|
||||||
"html5ever",
|
"html5ever",
|
||||||
|
"icu_locid",
|
||||||
"icu_segmenter",
|
"icu_segmenter",
|
||||||
"ipc-channel",
|
"ipc-channel",
|
||||||
"itertools 0.13.0",
|
"itertools 0.13.0",
|
||||||
|
@ -6902,6 +6903,7 @@ dependencies = [
|
||||||
"hilog",
|
"hilog",
|
||||||
"hitrace",
|
"hitrace",
|
||||||
"http 1.2.0",
|
"http 1.2.0",
|
||||||
|
"icu_locid",
|
||||||
"image",
|
"image",
|
||||||
"ipc-channel",
|
"ipc-channel",
|
||||||
"jni",
|
"jni",
|
||||||
|
|
|
@ -77,6 +77,7 @@ hyper = "1.6"
|
||||||
hyper-rustls = { version = "0.27", default-features = false, features = ["http1", "http2", "logging", "tls12", "webpki-tokio"] }
|
hyper-rustls = { version = "0.27", default-features = false, features = ["http1", "http2", "logging", "tls12", "webpki-tokio"] }
|
||||||
hyper-util = { version = "0.1", features = ["client", "client-legacy", "http2", "tokio"] }
|
hyper-util = { version = "0.1", features = ["client", "client-legacy", "http2", "tokio"] }
|
||||||
hyper_serde = { path = "components/hyper_serde" }
|
hyper_serde = { path = "components/hyper_serde" }
|
||||||
|
icu_locid = "1.5.0"
|
||||||
icu_segmenter = "1.5.0"
|
icu_segmenter = "1.5.0"
|
||||||
image = "0.24"
|
image = "0.24"
|
||||||
imsz = "0.2"
|
imsz = "0.2"
|
||||||
|
|
|
@ -30,6 +30,7 @@ fonts = { path = "../fonts" }
|
||||||
fonts_traits = { workspace = true }
|
fonts_traits = { workspace = true }
|
||||||
fxhash = { workspace = true }
|
fxhash = { workspace = true }
|
||||||
html5ever = { workspace = true }
|
html5ever = { workspace = true }
|
||||||
|
icu_locid = { workspace = true }
|
||||||
icu_segmenter = { workspace = true }
|
icu_segmenter = { workspace = true }
|
||||||
ipc-channel = { workspace = true }
|
ipc-channel = { workspace = true }
|
||||||
itertools = { workspace = true }
|
itertools = { workspace = true }
|
||||||
|
|
|
@ -15,10 +15,12 @@ use style::dom::{TElement, TShadowRoot};
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
use style::selector_parser::PseudoElement;
|
use style::selector_parser::PseudoElement;
|
||||||
use style::values::generics::counters::{Content, ContentItem};
|
use style::values::generics::counters::{Content, ContentItem};
|
||||||
|
use style::values::specified::Quotes;
|
||||||
|
|
||||||
use crate::context::LayoutContext;
|
use crate::context::LayoutContext;
|
||||||
use crate::dom::{BoxSlot, LayoutBox, NodeExt};
|
use crate::dom::{BoxSlot, LayoutBox, NodeExt};
|
||||||
use crate::fragment_tree::{BaseFragmentInfo, FragmentFlags, Tag};
|
use crate::fragment_tree::{BaseFragmentInfo, FragmentFlags, Tag};
|
||||||
|
use crate::quotes::quotes_for_lang;
|
||||||
use crate::replaced::ReplacedContents;
|
use crate::replaced::ReplacedContents;
|
||||||
use crate::style_ext::{Display, DisplayGeneratingBox, DisplayInside, DisplayOutside};
|
use crate::style_ext::{Display, DisplayGeneratingBox, DisplayInside, DisplayOutside};
|
||||||
|
|
||||||
|
@ -394,6 +396,17 @@ where
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_quote_from_pair<I, S>(item: &ContentItem<I>, opening: &S, closing: &S) -> String
|
||||||
|
where
|
||||||
|
S: ToString + ?Sized,
|
||||||
|
{
|
||||||
|
match item {
|
||||||
|
ContentItem::OpenQuote => opening.to_string(),
|
||||||
|
ContentItem::CloseQuote => closing.to_string(),
|
||||||
|
_ => unreachable!("Got an unexpected ContentItem type when processing quotes."),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <https://www.w3.org/TR/CSS2/generate.html#propdef-content>
|
/// <https://www.w3.org/TR/CSS2/generate.html#propdef-content>
|
||||||
fn generate_pseudo_element_content<'dom, Node>(
|
fn generate_pseudo_element_content<'dom, Node>(
|
||||||
pseudo_element_style: &ComputedValues,
|
pseudo_element_style: &ComputedValues,
|
||||||
|
@ -449,10 +462,30 @@ where
|
||||||
vec.push(PseudoElementContentItem::Replaced(replaced_content));
|
vec.push(PseudoElementContentItem::Replaced(replaced_content));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
ContentItem::OpenQuote | ContentItem::CloseQuote => {
|
||||||
|
// TODO(xiaochengh): calculate quote depth
|
||||||
|
let maybe_quote = match &pseudo_element_style.get_list().quotes {
|
||||||
|
Quotes::QuoteList(quote_list) => {
|
||||||
|
quote_list.0.first().map(|quote_pair| {
|
||||||
|
get_quote_from_pair(
|
||||||
|
item,
|
||||||
|
&*quote_pair.opening,
|
||||||
|
&*quote_pair.closing,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
Quotes::Auto => {
|
||||||
|
let lang = &pseudo_element_style.get_font()._x_lang;
|
||||||
|
let quotes = quotes_for_lang(lang.0.as_ref(), 0);
|
||||||
|
Some(get_quote_from_pair(item, "es.opening, "es.closing))
|
||||||
|
},
|
||||||
|
};
|
||||||
|
if let Some(quote) = maybe_quote {
|
||||||
|
vec.push(PseudoElementContentItem::Text(quote));
|
||||||
|
}
|
||||||
|
},
|
||||||
ContentItem::Counter(_, _) |
|
ContentItem::Counter(_, _) |
|
||||||
ContentItem::Counters(_, _, _) |
|
ContentItem::Counters(_, _, _) |
|
||||||
ContentItem::OpenQuote |
|
|
||||||
ContentItem::CloseQuote |
|
|
||||||
ContentItem::NoOpenQuote |
|
ContentItem::NoOpenQuote |
|
||||||
ContentItem::NoCloseQuote => {
|
ContentItem::NoCloseQuote => {
|
||||||
// TODO: Add support for counters and quotes.
|
// TODO: Add support for counters and quotes.
|
||||||
|
|
|
@ -21,6 +21,7 @@ mod construct_modern;
|
||||||
mod lists;
|
mod lists;
|
||||||
mod positioned;
|
mod positioned;
|
||||||
pub mod query;
|
pub mod query;
|
||||||
|
mod quotes;
|
||||||
mod replaced;
|
mod replaced;
|
||||||
mod sizing;
|
mod sizing;
|
||||||
mod style_ext;
|
mod style_ext;
|
||||||
|
|
427
components/layout_2020/quotes.rs
Normal file
427
components/layout_2020/quotes.rs
Normal file
|
@ -0,0 +1,427 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
// Quotes data is obtained from ICU CLDR data file /tmp/cldr-common-46.0.zip.
|
||||||
|
|
||||||
|
// TODO(xiaochengh): This file should better be moved to elsewhere and maintained automatically.
|
||||||
|
// Or even better, extend the icu create to provide the data directly.
|
||||||
|
|
||||||
|
use std::collections::HashMap;
|
||||||
|
use std::sync::OnceLock;
|
||||||
|
|
||||||
|
use icu_locid::Locale;
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug)]
|
||||||
|
pub struct QuotePair {
|
||||||
|
pub opening: char,
|
||||||
|
pub closing: char,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug)]
|
||||||
|
struct QuotesData {
|
||||||
|
quotes: QuotePair,
|
||||||
|
alternative_quotes: QuotePair,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl QuotesData {
|
||||||
|
const fn from(chars: (char, char, char, char)) -> Self {
|
||||||
|
QuotesData {
|
||||||
|
quotes: QuotePair {
|
||||||
|
opening: chars.0,
|
||||||
|
closing: chars.1,
|
||||||
|
},
|
||||||
|
alternative_quotes: QuotePair {
|
||||||
|
opening: chars.2,
|
||||||
|
closing: chars.3,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static DEFAULT_QUOTES: QuotesData =
|
||||||
|
QuotesData::from(('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}'));
|
||||||
|
|
||||||
|
static QUOTES_MAP: OnceLock<HashMap<&'static str, QuotesData>> = OnceLock::new();
|
||||||
|
|
||||||
|
fn create_quotes_map() -> HashMap<&'static str, QuotesData> {
|
||||||
|
let input = [
|
||||||
|
("aa", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ab", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("af", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ak", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("an", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ann", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("apc", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("arn", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("as", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("asa", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("az", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ba", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("bal", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("bem", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("bew", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("bez", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("bgc", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("bgn", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("bho", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("blt", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("bn", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("bo", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("brx", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("bss", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("byn", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("cad", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("cch", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ccp", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ce", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ceb", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("cgg", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("cho", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("chr", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("cic", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ckb", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("co", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("csw", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("cu", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("cy", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("da", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("dav", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("dje", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("doi", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("dv", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("dz", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ebu", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ee", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("en", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("eo", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("es", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("fil", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("fo", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("frr", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("fur", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("fy", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ga", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("gaa", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("gd", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("gez", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("gl", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("gn", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("gu", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("guz", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("gv", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ha", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("haw", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("hi", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("hnj", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("id", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ig", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ii", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("io", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("iu", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("jbo", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("jmc", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("jv", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("kaa", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("kaj", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("kam", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("kcg", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("kde", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("kea", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ken", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("kgp", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("khq", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ki", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("kl", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("kln", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("km", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("kn", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ko", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("kok", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("kpe", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ks", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ksb", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ksh", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ku", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("kw", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("kxv", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("la", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("lg", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("lkt", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("lmo", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ln", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("lo", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("lrc", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ltg", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("lu", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("luo", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("lv", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("mai", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("mas", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("mdf", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("mer", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("mfe", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("mgh", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("mgo", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("mhn", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("mi", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("mic", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ml", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("mn", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("mni", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("moh", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("mr", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ms", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("mt", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("mus", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("my", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("myv", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("naq", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("nb", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("nd", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("nds", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ne", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("nn", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("nqo", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("nr", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("nus", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("nv", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ny", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("nyn", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("oc", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("om", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("or", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("os", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("osa", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("pa", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("pap", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("pcm", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("pis", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("prg", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ps", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("pt", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("qu", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("quc", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("raj", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("rhg", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("rif", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("rm", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("rof", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("rwk", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("sa", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("saq", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("sat", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("sbp", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("scn", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("sd", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("se", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("seh", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ses", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("shn", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("si", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("sid", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("skr", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("sma", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("smj", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("smn", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("sms", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("so", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ss", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ssy", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("su", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("sw", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("szl", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ta", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("te", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("teo", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("tg", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("th", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("tig", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("to", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("tok", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("tpi", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("tr", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("trv", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("trw", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ts", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("tt", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("twq", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("tyv", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("tzm", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ug", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("vai", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ve", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("vec", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("vi", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("vmw", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("vo", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("vun", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("wa", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("wae", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("wal", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("wbp", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("wo", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("xh", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("xnr", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("xog", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("yi", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("yo", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("yrl", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("za", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("zh", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("zu", ('\u{201c}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("agq", ('\u{201e}', '\u{201d}', '\u{201a}', '\u{2019}')),
|
||||||
|
("ff", ('\u{201e}', '\u{201d}', '\u{201a}', '\u{2019}')),
|
||||||
|
("am", ('\u{ab}', '\u{bb}', '\u{2039}', '\u{203a}')),
|
||||||
|
("az-Arab", ('\u{ab}', '\u{bb}', '\u{2039}', '\u{203a}')),
|
||||||
|
("az-Cyrl", ('\u{ab}', '\u{bb}', '\u{2039}', '\u{203a}')),
|
||||||
|
("fa", ('\u{ab}', '\u{bb}', '\u{2039}', '\u{203a}')),
|
||||||
|
("fr-CH", ('\u{ab}', '\u{bb}', '\u{2039}', '\u{203a}')),
|
||||||
|
("gsw", ('\u{ab}', '\u{bb}', '\u{2039}', '\u{203a}')),
|
||||||
|
("jgo", ('\u{ab}', '\u{bb}', '\u{2039}', '\u{203a}')),
|
||||||
|
("kkj", ('\u{ab}', '\u{bb}', '\u{2039}', '\u{203a}')),
|
||||||
|
("mzn", ('\u{ab}', '\u{bb}', '\u{2039}', '\u{203a}')),
|
||||||
|
("sdh", ('\u{ab}', '\u{bb}', '\u{2039}', '\u{203a}')),
|
||||||
|
("ar", ('\u{201d}', '\u{201c}', '\u{2019}', '\u{2018}')),
|
||||||
|
("lld", ('\u{201d}', '\u{201c}', '\u{2019}', '\u{2018}')),
|
||||||
|
("ms-Arab", ('\u{201d}', '\u{201c}', '\u{2019}', '\u{2018}')),
|
||||||
|
("syr", ('\u{201d}', '\u{201c}', '\u{2019}', '\u{2018}')),
|
||||||
|
("ur", ('\u{201d}', '\u{201c}', '\u{2019}', '\u{2018}')),
|
||||||
|
("ast", ('\u{ab}', '\u{bb}', '\u{201c}', '\u{201d}')),
|
||||||
|
("blo", ('\u{ab}', '\u{bb}', '\u{201c}', '\u{201d}')),
|
||||||
|
("bm", ('\u{ab}', '\u{bb}', '\u{201c}', '\u{201d}')),
|
||||||
|
("br", ('\u{ab}', '\u{bb}', '\u{201c}', '\u{201d}')),
|
||||||
|
("ca", ('\u{ab}', '\u{bb}', '\u{201c}', '\u{201d}')),
|
||||||
|
("dyo", ('\u{ab}', '\u{bb}', '\u{201c}', '\u{201d}')),
|
||||||
|
("el", ('\u{ab}', '\u{bb}', '\u{201c}', '\u{201d}')),
|
||||||
|
("es-US", ('\u{ab}', '\u{bb}', '\u{201c}', '\u{201d}')),
|
||||||
|
("eu", ('\u{ab}', '\u{bb}', '\u{201c}', '\u{201d}')),
|
||||||
|
("ewo", ('\u{ab}', '\u{bb}', '\u{201c}', '\u{201d}')),
|
||||||
|
("ie", ('\u{ab}', '\u{bb}', '\u{201c}', '\u{201d}')),
|
||||||
|
("it", ('\u{ab}', '\u{bb}', '\u{201c}', '\u{201d}')),
|
||||||
|
("kab", ('\u{ab}', '\u{bb}', '\u{201c}', '\u{201d}')),
|
||||||
|
("kk", ('\u{ab}', '\u{bb}', '\u{201c}', '\u{201d}')),
|
||||||
|
("lij", ('\u{ab}', '\u{bb}', '\u{201c}', '\u{201d}')),
|
||||||
|
("mg", ('\u{ab}', '\u{bb}', '\u{201c}', '\u{201d}')),
|
||||||
|
("mua", ('\u{ab}', '\u{bb}', '\u{201c}', '\u{201d}')),
|
||||||
|
("nnh", ('\u{ab}', '\u{bb}', '\u{201c}', '\u{201d}')),
|
||||||
|
("pt-PT", ('\u{ab}', '\u{bb}', '\u{201c}', '\u{201d}')),
|
||||||
|
("sc", ('\u{ab}', '\u{bb}', '\u{201c}', '\u{201d}')),
|
||||||
|
("sg", ('\u{ab}', '\u{bb}', '\u{201c}', '\u{201d}')),
|
||||||
|
("sq", ('\u{ab}', '\u{bb}', '\u{201c}', '\u{201d}')),
|
||||||
|
("ti", ('\u{ab}', '\u{bb}', '\u{201c}', '\u{201d}')),
|
||||||
|
("bas", ('\u{ab}', '\u{bb}', '\u{201e}', '\u{201c}')),
|
||||||
|
("be", ('\u{ab}', '\u{bb}', '\u{201e}', '\u{201c}')),
|
||||||
|
("cv", ('\u{ab}', '\u{bb}', '\u{201e}', '\u{201c}')),
|
||||||
|
("ky", ('\u{ab}', '\u{bb}', '\u{201e}', '\u{201c}')),
|
||||||
|
("ru", ('\u{ab}', '\u{bb}', '\u{201e}', '\u{201c}')),
|
||||||
|
("sah", ('\u{ab}', '\u{bb}', '\u{201e}', '\u{201c}')),
|
||||||
|
("uk", ('\u{ab}', '\u{bb}', '\u{201e}', '\u{201c}')),
|
||||||
|
("bg", ('\u{201e}', '\u{201c}', '\u{201e}', '\u{201c}')),
|
||||||
|
("lt", ('\u{201e}', '\u{201c}', '\u{201e}', '\u{201c}')),
|
||||||
|
("bs-Cyrl", ('\u{201e}', '\u{201c}', '\u{201a}', '\u{2018}')),
|
||||||
|
("cs", ('\u{201e}', '\u{201c}', '\u{201a}', '\u{2018}')),
|
||||||
|
("de", ('\u{201e}', '\u{201c}', '\u{201a}', '\u{2018}')),
|
||||||
|
("dsb", ('\u{201e}', '\u{201c}', '\u{201a}', '\u{2018}')),
|
||||||
|
("et", ('\u{201e}', '\u{201c}', '\u{201a}', '\u{2018}')),
|
||||||
|
("hr", ('\u{201e}', '\u{201c}', '\u{201a}', '\u{2018}')),
|
||||||
|
("hsb", ('\u{201e}', '\u{201c}', '\u{201a}', '\u{2018}')),
|
||||||
|
("is", ('\u{201e}', '\u{201c}', '\u{201a}', '\u{2018}')),
|
||||||
|
("lb", ('\u{201e}', '\u{201c}', '\u{201a}', '\u{2018}')),
|
||||||
|
("luy", ('\u{201e}', '\u{201c}', '\u{201a}', '\u{2018}')),
|
||||||
|
("mk", ('\u{201e}', '\u{201c}', '\u{201a}', '\u{2018}')),
|
||||||
|
("sk", ('\u{201e}', '\u{201c}', '\u{201a}', '\u{2018}')),
|
||||||
|
("sl", ('\u{201e}', '\u{201c}', '\u{201a}', '\u{2018}')),
|
||||||
|
("bs", ('\u{201e}', '\u{201d}', '\u{2018}', '\u{2019}')),
|
||||||
|
("dua", ('\u{ab}', '\u{bb}', '\u{2018}', '\u{2019}')),
|
||||||
|
("el-POLYTON", ('\u{ab}', '\u{bb}', '\u{2018}', '\u{2019}')),
|
||||||
|
("ksf", ('\u{ab}', '\u{bb}', '\u{2018}', '\u{2019}')),
|
||||||
|
("no", ('\u{ab}', '\u{bb}', '\u{2018}', '\u{2019}')),
|
||||||
|
("rw", ('\u{ab}', '\u{bb}', '\u{2018}', '\u{2019}')),
|
||||||
|
("fi", ('\u{201d}', '\u{201d}', '\u{2019}', '\u{2019}')),
|
||||||
|
("he", ('\u{201d}', '\u{201d}', '\u{2019}', '\u{2019}')),
|
||||||
|
("lag", ('\u{201d}', '\u{201d}', '\u{2019}', '\u{2019}')),
|
||||||
|
("rn", ('\u{201d}', '\u{201d}', '\u{2019}', '\u{2019}')),
|
||||||
|
("sn", ('\u{201d}', '\u{201d}', '\u{2019}', '\u{2019}')),
|
||||||
|
("sv", ('\u{201d}', '\u{201d}', '\u{2019}', '\u{2019}')),
|
||||||
|
("fr-CA", ('\u{ab}', '\u{bb}', '\u{201d}', '\u{201c}')),
|
||||||
|
("fr", ('\u{ab}', '\u{bb}', '\u{ab}', '\u{bb}')),
|
||||||
|
("hy", ('\u{ab}', '\u{bb}', '\u{ab}', '\u{bb}')),
|
||||||
|
("yav", ('\u{ab}', '\u{bb}', '\u{ab}', '\u{bb}')),
|
||||||
|
("hu", ('\u{201e}', '\u{201d}', '\u{bb}', '\u{ab}')),
|
||||||
|
("ia", ('\u{2018}', '\u{2019}', '\u{201c}', '\u{201d}')),
|
||||||
|
("nso", ('\u{2018}', '\u{2019}', '\u{201c}', '\u{201d}')),
|
||||||
|
("ti-ER", ('\u{2018}', '\u{2019}', '\u{201c}', '\u{201d}')),
|
||||||
|
("tn", ('\u{2018}', '\u{2019}', '\u{201c}', '\u{201d}')),
|
||||||
|
("ja", ('\u{300c}', '\u{300d}', '\u{300e}', '\u{300f}')),
|
||||||
|
("yue", ('\u{300c}', '\u{300d}', '\u{300e}', '\u{300f}')),
|
||||||
|
("zh-Hant", ('\u{300c}', '\u{300d}', '\u{300e}', '\u{300f}')),
|
||||||
|
("ka", ('\u{201e}', '\u{201c}', '\u{ab}', '\u{bb}')),
|
||||||
|
("nl", ('\u{2018}', '\u{2019}', '\u{2018}', '\u{2019}')),
|
||||||
|
("nmg", ('\u{201e}', '\u{201d}', '\u{ab}', '\u{bb}')),
|
||||||
|
("pl", ('\u{201e}', '\u{201d}', '\u{ab}', '\u{bb}')),
|
||||||
|
("ro", ('\u{201e}', '\u{201d}', '\u{ab}', '\u{bb}')),
|
||||||
|
("shi", ('\u{ab}', '\u{bb}', '\u{201e}', '\u{201d}')),
|
||||||
|
("zgh", ('\u{ab}', '\u{bb}', '\u{201e}', '\u{201d}')),
|
||||||
|
("sr", ('\u{201e}', '\u{201d}', '\u{2019}', '\u{2019}')),
|
||||||
|
("st", ('\u{201c}', '\u{2019}', '\u{201c}', '\u{201d}')),
|
||||||
|
("tk", ('\u{201c}', '\u{201d}', '\u{201c}', '\u{201d}')),
|
||||||
|
("uz", ('\u{201c}', '\u{201d}', '\u{2019}', '\u{2018}')),
|
||||||
|
]
|
||||||
|
.map(|(lang, chars)| (lang, QuotesData::from(chars)));
|
||||||
|
HashMap::from(input)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn quotes_data_for_lang(lang: &str) -> QuotesData {
|
||||||
|
// All valid language codes are at least two bytes long.
|
||||||
|
if lang.len() < 2 {
|
||||||
|
return DEFAULT_QUOTES;
|
||||||
|
}
|
||||||
|
|
||||||
|
let quotes_map = QUOTES_MAP.get_or_init(create_quotes_map);
|
||||||
|
|
||||||
|
// Found an exact match for the requested lang.
|
||||||
|
if let Some(quotes_data) = quotes_map.get(lang) {
|
||||||
|
return *quotes_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try parsing lang as a Locale and canonicalizing the subtags, then see if
|
||||||
|
// we can match it with region or script subtags, if present, or just the
|
||||||
|
// primary language tag.
|
||||||
|
let locale = match lang.parse::<Locale>() {
|
||||||
|
Err(_) => return DEFAULT_QUOTES,
|
||||||
|
Ok(locale) => locale,
|
||||||
|
};
|
||||||
|
|
||||||
|
let lang = locale.id.language.to_string();
|
||||||
|
|
||||||
|
if let Some(quotes_data) = quotes_map.get(lang.as_str()) {
|
||||||
|
return *quotes_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(quotes_data) = locale
|
||||||
|
.id
|
||||||
|
.region
|
||||||
|
.and_then(|region| quotes_map.get(format!("{lang}-{region}").as_str()))
|
||||||
|
{
|
||||||
|
return *quotes_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(quotes_data) = locale
|
||||||
|
.id
|
||||||
|
.script
|
||||||
|
.and_then(|script| quotes_map.get(format!("{lang}-{script}").as_str()))
|
||||||
|
{
|
||||||
|
return *quotes_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFAULT_QUOTES
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn quotes_for_lang(lang: &str, depth: usize) -> QuotePair {
|
||||||
|
let quotes_data = quotes_data_for_lang(lang);
|
||||||
|
match depth {
|
||||||
|
0 => quotes_data.quotes,
|
||||||
|
_ => quotes_data.alternative_quotes,
|
||||||
|
}
|
||||||
|
}
|
|
@ -716,6 +716,7 @@ pub(crate) trait LayoutElementHelpers<'dom> {
|
||||||
fn style_attribute(self) -> *const Option<Arc<Locked<PropertyDeclarationBlock>>>;
|
fn style_attribute(self) -> *const Option<Arc<Locked<PropertyDeclarationBlock>>>;
|
||||||
fn local_name(self) -> &'dom LocalName;
|
fn local_name(self) -> &'dom LocalName;
|
||||||
fn namespace(self) -> &'dom Namespace;
|
fn namespace(self) -> &'dom Namespace;
|
||||||
|
fn get_lang_attr_val_for_layout(self) -> Option<&'dom str>;
|
||||||
fn get_lang_for_layout(self) -> String;
|
fn get_lang_for_layout(self) -> String;
|
||||||
fn get_state_for_layout(self) -> ElementState;
|
fn get_state_for_layout(self) -> ElementState;
|
||||||
fn insert_selector_flags(self, flags: ElementSelectorFlags);
|
fn insert_selector_flags(self, flags: ElementSelectorFlags);
|
||||||
|
@ -783,6 +784,15 @@ impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
|
||||||
let document = self.upcast::<Node>().owner_doc_for_layout();
|
let document = self.upcast::<Node>().owner_doc_for_layout();
|
||||||
let shared_lock = document.style_shared_lock();
|
let shared_lock = document.style_shared_lock();
|
||||||
|
|
||||||
|
// TODO(xiaochengh): This is probably not enough. When the root element doesn't have a `lang`,
|
||||||
|
// we should check the browser settings and system locale.
|
||||||
|
if let Some(lang) = self.get_lang_attr_val_for_layout() {
|
||||||
|
hints.push(from_declaration(
|
||||||
|
shared_lock,
|
||||||
|
PropertyDeclaration::XLang(specified::XLang(Atom::from(lang.to_owned()))),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
let bgcolor = if let Some(this) = self.downcast::<HTMLBodyElement>() {
|
let bgcolor = if let Some(this) = self.downcast::<HTMLBodyElement>() {
|
||||||
this.get_background_color()
|
this.get_background_color()
|
||||||
} else if let Some(this) = self.downcast::<HTMLTableElement>() {
|
} else if let Some(this) = self.downcast::<HTMLTableElement>() {
|
||||||
|
@ -1181,18 +1191,23 @@ impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
|
||||||
&(self.unsafe_get()).namespace
|
&(self.unsafe_get()).namespace
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_lang_attr_val_for_layout(self) -> Option<&'dom str> {
|
||||||
|
if let Some(attr) = self.get_attr_val_for_layout(&ns!(xml), &local_name!("lang")) {
|
||||||
|
return Some(attr);
|
||||||
|
}
|
||||||
|
if let Some(attr) = self.get_attr_val_for_layout(&ns!(), &local_name!("lang")) {
|
||||||
|
return Some(attr);
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
fn get_lang_for_layout(self) -> String {
|
fn get_lang_for_layout(self) -> String {
|
||||||
let mut current_node = Some(self.upcast::<Node>());
|
let mut current_node = Some(self.upcast::<Node>());
|
||||||
while let Some(node) = current_node {
|
while let Some(node) = current_node {
|
||||||
current_node = node.composed_parent_node_ref();
|
current_node = node.composed_parent_node_ref();
|
||||||
match node.downcast::<Element>() {
|
match node.downcast::<Element>() {
|
||||||
Some(elem) => {
|
Some(elem) => {
|
||||||
if let Some(attr) =
|
if let Some(attr) = elem.get_lang_attr_val_for_layout() {
|
||||||
elem.get_attr_val_for_layout(&ns!(xml), &local_name!("lang"))
|
|
||||||
{
|
|
||||||
return attr.to_owned();
|
|
||||||
}
|
|
||||||
if let Some(attr) = elem.get_attr_val_for_layout(&ns!(), &local_name!("lang")) {
|
|
||||||
return attr.to_owned();
|
return attr.to_owned();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -3546,7 +3561,9 @@ impl VirtualMethods for Element {
|
||||||
|
|
||||||
fn attribute_affects_presentational_hints(&self, attr: &Attr) -> bool {
|
fn attribute_affects_presentational_hints(&self, attr: &Attr) -> bool {
|
||||||
// FIXME: This should be more fine-grained, not all elements care about these.
|
// FIXME: This should be more fine-grained, not all elements care about these.
|
||||||
if attr.local_name() == &local_name!("width") || attr.local_name() == &local_name!("height")
|
if attr.local_name() == &local_name!("width") ||
|
||||||
|
attr.local_name() == &local_name!("height") ||
|
||||||
|
attr.local_name() == &local_name!("lang")
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,7 @@ tokio = { workspace = true }
|
||||||
tracing = { workspace = true, optional = true }
|
tracing = { workspace = true, optional = true }
|
||||||
tracing-subscriber = { workspace = true, optional = true, features = ["env-filter"] }
|
tracing-subscriber = { workspace = true, optional = true, features = ["env-filter"] }
|
||||||
tracing-perfetto = { workspace = true, optional = true }
|
tracing-perfetto = { workspace = true, optional = true }
|
||||||
|
icu_locid = "1.5.0"
|
||||||
|
|
||||||
[target.'cfg(target_os = "android")'.dependencies]
|
[target.'cfg(target_os = "android")'.dependencies]
|
||||||
android_logger = "0.14"
|
android_logger = "0.14"
|
||||||
|
|
|
@ -1,190 +0,0 @@
|
||||||
/*
|
|
||||||
|
|
||||||
https://html.spec.whatwg.org/multipage/#quotes
|
|
||||||
|
|
||||||
> This block is automatically generated from the Unicode Common Locale Data Repository.
|
|
||||||
> http://cldr.unicode.org/
|
|
||||||
>
|
|
||||||
> User agents are expected to use either the block [from the spec]
|
|
||||||
> (which will be regularly updated)
|
|
||||||
> or to automatically generate their own copy directly from the source material.
|
|
||||||
> The language codes are derived from the CLDR file names.
|
|
||||||
> The quotes are derived from the delimiter blocks,
|
|
||||||
> with fallback handled as specified in the CLDR documentation.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
@namespace url(http://www.w3.org/1999/xhtml);
|
|
||||||
|
|
||||||
|
|
||||||
:root { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(af), :not(:lang(af)) > :lang(af) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(agq), :not(:lang(agq)) > :lang(agq) { quotes: '\201e' '\201d' '\201a' '\2019' } /* „ ” ‚ ’ */
|
|
||||||
:root:lang(ak), :not(:lang(ak)) > :lang(ak) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(am), :not(:lang(am)) > :lang(am) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
|
|
||||||
:root:lang(ar), :not(:lang(ar)) > :lang(ar) { quotes: '\201d' '\201c' '\2019' '\2018' } /* ” “ ’ ‘ */
|
|
||||||
:root:lang(asa), :not(:lang(asa)) > :lang(asa) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(ast), :not(:lang(ast)) > :lang(ast) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
|
|
||||||
:root:lang(az), :not(:lang(az)) > :lang(az) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(az-Cyrl), :not(:lang(az-Cyrl)) > :lang(az-Cyrl) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
|
|
||||||
:root:lang(bas), :not(:lang(bas)) > :lang(bas) { quotes: '\00ab' '\00bb' '\201e' '\201c' } /* « » „ “ */
|
|
||||||
:root:lang(bem), :not(:lang(bem)) > :lang(bem) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(bez), :not(:lang(bez)) > :lang(bez) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(bg), :not(:lang(bg)) > :lang(bg) { quotes: '\201e' '\201c' '\201e' '\201c' } /* „ “ „ “ */
|
|
||||||
:root:lang(bm), :not(:lang(bm)) > :lang(bm) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
|
|
||||||
:root:lang(bn), :not(:lang(bn)) > :lang(bn) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(br), :not(:lang(br)) > :lang(br) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
|
|
||||||
:root:lang(brx), :not(:lang(brx)) > :lang(brx) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(bs), :not(:lang(bs)) > :lang(bs) { quotes: '\201e' '\201c' '\2018' '\2019' } /* „ “ ‘ ’ */
|
|
||||||
:root:lang(bs-Cyrl), :not(:lang(bs-Cyrl)) > :lang(bs-Cyrl) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
|
|
||||||
:root:lang(ca), :not(:lang(ca)) > :lang(ca) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
|
|
||||||
:root:lang(cgg), :not(:lang(cgg)) > :lang(cgg) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(chr), :not(:lang(chr)) > :lang(chr) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(cs), :not(:lang(cs)) > :lang(cs) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
|
|
||||||
:root:lang(cy), :not(:lang(cy)) > :lang(cy) { quotes: '\2018' '\2019' '\201c' '\201d' } /* ‘ ’ “ ” */
|
|
||||||
:root:lang(da), :not(:lang(da)) > :lang(da) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(dav), :not(:lang(dav)) > :lang(dav) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(de), :not(:lang(de)) > :lang(de) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
|
|
||||||
:root:lang(de-CH), :not(:lang(de-CH)) > :lang(de-CH) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
|
|
||||||
:root:lang(dje), :not(:lang(dje)) > :lang(dje) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(dsb), :not(:lang(dsb)) > :lang(dsb) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
|
|
||||||
:root:lang(dua), :not(:lang(dua)) > :lang(dua) { quotes: '\00ab' '\00bb' '\2018' '\2019' } /* « » ‘ ’ */
|
|
||||||
:root:lang(dyo), :not(:lang(dyo)) > :lang(dyo) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
|
|
||||||
:root:lang(dz), :not(:lang(dz)) > :lang(dz) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(ebu), :not(:lang(ebu)) > :lang(ebu) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(ee), :not(:lang(ee)) > :lang(ee) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(el), :not(:lang(el)) > :lang(el) { quotes: '\00ab' '\00bb' '\0022' '\0022' } /* « » " " */
|
|
||||||
:root:lang(en), :not(:lang(en)) > :lang(en) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(es), :not(:lang(es)) > :lang(es) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
|
|
||||||
:root:lang(et), :not(:lang(et)) > :lang(et) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
|
|
||||||
:root:lang(eu), :not(:lang(eu)) > :lang(eu) { quotes: '\0022' '\0022' '\0022' '\0022' } /* " " " " */
|
|
||||||
:root:lang(ewo), :not(:lang(ewo)) > :lang(ewo) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
|
|
||||||
:root:lang(fa), :not(:lang(fa)) > :lang(fa) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
|
|
||||||
:root:lang(ff), :not(:lang(ff)) > :lang(ff) { quotes: '\201e' '\201d' '\201a' '\2019' } /* „ ” ‚ ’ */
|
|
||||||
:root:lang(fi), :not(:lang(fi)) > :lang(fi) { quotes: '\201d' '\201d' '\2019' '\2019' } /* ” ” ’ ’ */
|
|
||||||
:root:lang(fil), :not(:lang(fil)) > :lang(fil) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(fr), :not(:lang(fr)) > :lang(fr) { quotes: '\00ab' '\00bb' '\00ab' '\00bb' } /* « » « » */
|
|
||||||
:root:lang(fr-CA), :not(:lang(fr-CA)) > :lang(fr-CA) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
|
|
||||||
:root:lang(fr-CH), :not(:lang(fr-CH)) > :lang(fr-CH) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
|
|
||||||
:root:lang(ga), :not(:lang(ga)) > :lang(ga) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(gd), :not(:lang(gd)) > :lang(gd) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(gl), :not(:lang(gl)) > :lang(gl) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(gsw), :not(:lang(gsw)) > :lang(gsw) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
|
|
||||||
:root:lang(gu), :not(:lang(gu)) > :lang(gu) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(guz), :not(:lang(guz)) > :lang(guz) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(ha), :not(:lang(ha)) > :lang(ha) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(he), :not(:lang(he)) > :lang(he) { quotes: '\05f4' '\05f4' '\05f3' '\05f3' } /* ״ ״ ׳ ׳ */
|
|
||||||
:root:lang(hi), :not(:lang(hi)) > :lang(hi) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(hr), :not(:lang(hr)) > :lang(hr) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
|
|
||||||
:root:lang(hsb), :not(:lang(hsb)) > :lang(hsb) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
|
|
||||||
:root:lang(hu), :not(:lang(hu)) > :lang(hu) { quotes: '\201e' '\201d' '\00bb' '\00ab' } /* „ ” » « */
|
|
||||||
:root:lang(hy), :not(:lang(hy)) > :lang(hy) { quotes: '\00ab' '\00bb' '\00ab' '\00bb' } /* « » « » */
|
|
||||||
:root:lang(id), :not(:lang(id)) > :lang(id) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(ig), :not(:lang(ig)) > :lang(ig) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(is), :not(:lang(is)) > :lang(is) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
|
|
||||||
:root:lang(it), :not(:lang(it)) > :lang(it) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
|
|
||||||
:root:lang(ja), :not(:lang(ja)) > :lang(ja) { quotes: '\300c' '\300d' '\300e' '\300f' } /* 「 」 『 』 */
|
|
||||||
:root:lang(jgo), :not(:lang(jgo)) > :lang(jgo) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
|
|
||||||
:root:lang(jmc), :not(:lang(jmc)) > :lang(jmc) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(ka), :not(:lang(ka)) > :lang(ka) { quotes: '\201e' '\201c' '\00ab' '\00bb' } /* „ “ « » */
|
|
||||||
:root:lang(kab), :not(:lang(kab)) > :lang(kab) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
|
|
||||||
:root:lang(kam), :not(:lang(kam)) > :lang(kam) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(kde), :not(:lang(kde)) > :lang(kde) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(kea), :not(:lang(kea)) > :lang(kea) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(khq), :not(:lang(khq)) > :lang(khq) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(ki), :not(:lang(ki)) > :lang(ki) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(kk), :not(:lang(kk)) > :lang(kk) { quotes: '\201c' '\0022' '\2018' '\2019' } /* “ " ‘ ’ */
|
|
||||||
:root:lang(kkj), :not(:lang(kkj)) > :lang(kkj) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
|
|
||||||
:root:lang(kln), :not(:lang(kln)) > :lang(kln) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(km), :not(:lang(km)) > :lang(km) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(kn), :not(:lang(kn)) > :lang(kn) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(ko), :not(:lang(ko)) > :lang(ko) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(ksb), :not(:lang(ksb)) > :lang(ksb) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(ksf), :not(:lang(ksf)) > :lang(ksf) { quotes: '\00ab' '\00bb' '\2018' '\2019' } /* « » ‘ ’ */
|
|
||||||
:root:lang(ky), :not(:lang(ky)) > :lang(ky) { quotes: '\00ab' '\00bb' '\201e' '\201c' } /* « » „ “ */
|
|
||||||
:root:lang(lag), :not(:lang(lag)) > :lang(lag) { quotes: '\201d' '\201d' '\2019' '\2019' } /* ” ” ’ ’ */
|
|
||||||
:root:lang(lb), :not(:lang(lb)) > :lang(lb) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
|
|
||||||
:root:lang(lg), :not(:lang(lg)) > :lang(lg) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(ln), :not(:lang(ln)) > :lang(ln) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(lo), :not(:lang(lo)) > :lang(lo) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(lt), :not(:lang(lt)) > :lang(lt) { quotes: '\201e' '\201c' '\201e' '\201c' } /* „ “ „ “ */
|
|
||||||
:root:lang(lu), :not(:lang(lu)) > :lang(lu) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(luo), :not(:lang(luo)) > :lang(luo) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(luy), :not(:lang(luy)) > :lang(luy) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
|
|
||||||
:root:lang(lv), :not(:lang(lv)) > :lang(lv) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(mas), :not(:lang(mas)) > :lang(mas) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(mer), :not(:lang(mer)) > :lang(mer) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(mfe), :not(:lang(mfe)) > :lang(mfe) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(mg), :not(:lang(mg)) > :lang(mg) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
|
|
||||||
:root:lang(mgo), :not(:lang(mgo)) > :lang(mgo) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(mk), :not(:lang(mk)) > :lang(mk) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
|
|
||||||
:root:lang(ml), :not(:lang(ml)) > :lang(ml) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(mn), :not(:lang(mn)) > :lang(mn) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(mr), :not(:lang(mr)) > :lang(mr) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(ms), :not(:lang(ms)) > :lang(ms) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(mt), :not(:lang(mt)) > :lang(mt) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(mua), :not(:lang(mua)) > :lang(mua) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
|
|
||||||
:root:lang(my), :not(:lang(my)) > :lang(my) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(naq), :not(:lang(naq)) > :lang(naq) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(nb), :not(:lang(nb)) > :lang(nb) { quotes: '\00ab' '\00bb' '\2018' '\2019' } /* « » ‘ ’ */
|
|
||||||
:root:lang(nd), :not(:lang(nd)) > :lang(nd) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(ne), :not(:lang(ne)) > :lang(ne) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(nl), :not(:lang(nl)) > :lang(nl) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(nmg), :not(:lang(nmg)) > :lang(nmg) { quotes: '\201e' '\201d' '\00ab' '\00bb' } /* „ ” « » */
|
|
||||||
:root:lang(nn), :not(:lang(nn)) > :lang(nn) { quotes: '\00ab' '\00bb' '\2018' '\2019' } /* « » ‘ ’ */
|
|
||||||
:root:lang(nnh), :not(:lang(nnh)) > :lang(nnh) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
|
|
||||||
:root:lang(nus), :not(:lang(nus)) > :lang(nus) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(nyn), :not(:lang(nyn)) > :lang(nyn) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(pa), :not(:lang(pa)) > :lang(pa) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(pl), :not(:lang(pl)) > :lang(pl) { quotes: '\201e' '\201d' '\00ab' '\00bb' } /* „ ” « » */
|
|
||||||
:root:lang(pt), :not(:lang(pt)) > :lang(pt) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(pt-PT), :not(:lang(pt-PT)) > :lang(pt-PT) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
|
|
||||||
:root:lang(rn), :not(:lang(rn)) > :lang(rn) { quotes: '\201d' '\201d' '\2019' '\2019' } /* ” ” ’ ’ */
|
|
||||||
:root:lang(ro), :not(:lang(ro)) > :lang(ro) { quotes: '\201c' '\201d' '\00ab' '\00bb' } /* “ ” « » */
|
|
||||||
:root:lang(rof), :not(:lang(rof)) > :lang(rof) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(ru), :not(:lang(ru)) > :lang(ru) { quotes: '\00ab' '\00bb' '\201e' '\201c' } /* « » „ “ */
|
|
||||||
:root:lang(rw), :not(:lang(rw)) > :lang(rw) { quotes: '\00ab' '\00bb' '\2018' '\2019' } /* « » ‘ ’ */
|
|
||||||
:root:lang(rwk), :not(:lang(rwk)) > :lang(rwk) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(saq), :not(:lang(saq)) > :lang(saq) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(sbp), :not(:lang(sbp)) > :lang(sbp) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(seh), :not(:lang(seh)) > :lang(seh) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(ses), :not(:lang(ses)) > :lang(ses) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(sg), :not(:lang(sg)) > :lang(sg) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
|
|
||||||
:root:lang(shi), :not(:lang(shi)) > :lang(shi) { quotes: '\00ab' '\00bb' '\201e' '\201d' } /* « » „ ” */
|
|
||||||
:root:lang(shi-Latn), :not(:lang(shi-Latn)) > :lang(shi-Latn) { quotes: '\00ab' '\00bb' '\201e' '\201d' } /* « » „ ” */
|
|
||||||
:root:lang(si), :not(:lang(si)) > :lang(si) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(sk), :not(:lang(sk)) > :lang(sk) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
|
|
||||||
:root:lang(sl), :not(:lang(sl)) > :lang(sl) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
|
|
||||||
:root:lang(sn), :not(:lang(sn)) > :lang(sn) { quotes: '\201d' '\201d' '\2019' '\2019' } /* ” ” ’ ’ */
|
|
||||||
:root:lang(so), :not(:lang(so)) > :lang(so) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(sq), :not(:lang(sq)) > :lang(sq) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
|
|
||||||
:root:lang(sr), :not(:lang(sr)) > :lang(sr) { quotes: '\201e' '\201c' '\2018' '\2018' } /* „ “ ‘ ‘ */
|
|
||||||
:root:lang(sr-Latn), :not(:lang(sr-Latn)) > :lang(sr-Latn) { quotes: '\201e' '\201c' '\2018' '\2018' } /* „ “ ‘ ‘ */
|
|
||||||
:root:lang(sv), :not(:lang(sv)) > :lang(sv) { quotes: '\201d' '\201d' '\2019' '\2019' } /* ” ” ’ ’ */
|
|
||||||
:root:lang(sw), :not(:lang(sw)) > :lang(sw) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(swc), :not(:lang(swc)) > :lang(swc) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(ta), :not(:lang(ta)) > :lang(ta) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(te), :not(:lang(te)) > :lang(te) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(teo), :not(:lang(teo)) > :lang(teo) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(th), :not(:lang(th)) > :lang(th) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(ti-ER), :not(:lang(ti-ER)) > :lang(ti-ER) { quotes: '\2018' '\2019' '\201c' '\201d' } /* ‘ ’ “ ” */
|
|
||||||
:root:lang(to), :not(:lang(to)) > :lang(to) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(tr), :not(:lang(tr)) > :lang(tr) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(twq), :not(:lang(twq)) > :lang(twq) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(tzm), :not(:lang(tzm)) > :lang(tzm) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(uk), :not(:lang(uk)) > :lang(uk) { quotes: '\00ab' '\00bb' '\201e' '\201c' } /* « » „ “ */
|
|
||||||
:root:lang(ur), :not(:lang(ur)) > :lang(ur) { quotes: '\201d' '\201c' '\2019' '\2018' } /* ” “ ’ ‘ */
|
|
||||||
:root:lang(ur-IN), :not(:lang(ur-IN)) > :lang(ur-IN) { quotes: '\0022' '\0022' '\0027' '\0027' } /* " " ' ' */
|
|
||||||
:root:lang(uz), :not(:lang(uz)) > :lang(uz) { quotes: '\0022' '\0022' '\0027' '\0027' } /* " " ' ' */
|
|
||||||
:root:lang(uz-Cyrl), :not(:lang(uz-Cyrl)) > :lang(uz-Cyrl) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(vai), :not(:lang(vai)) > :lang(vai) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(vai-Latn), :not(:lang(vai-Latn)) > :lang(vai-Latn) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(vi), :not(:lang(vi)) > :lang(vi) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(vun), :not(:lang(vun)) > :lang(vun) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(xog), :not(:lang(xog)) > :lang(xog) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(yav), :not(:lang(yav)) > :lang(yav) { quotes: '\00ab' '\00bb' '\00ab' '\00bb' } /* « » « » */
|
|
||||||
:root:lang(yo), :not(:lang(yo)) > :lang(yo) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(zgh), :not(:lang(zgh)) > :lang(zgh) { quotes: '\00ab' '\00bb' '\201e' '\201d' } /* « » „ ” */
|
|
||||||
:root:lang(zh), :not(:lang(zh)) > :lang(zh) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
||||||
:root:lang(zh-Hant), :not(:lang(zh-Hant)) > :lang(zh-Hant) { quotes: '\300c' '\300d' '\300e' '\300f' } /* 「 」 『 』 */
|
|
||||||
:root:lang(zu), :not(:lang(zu)) > :lang(zu) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
|
|
|
@ -4,11 +4,6 @@ https://html.spec.whatwg.org/multipage/#form-controls
|
||||||
|
|
||||||
@namespace url(http://www.w3.org/1999/xhtml);
|
@namespace url(http://www.w3.org/1999/xhtml);
|
||||||
|
|
||||||
/*
|
|
||||||
FIXME: Uncomment this when :lang() is supported, or do something equivalent.
|
|
||||||
@import url(quotes.css);
|
|
||||||
*/
|
|
||||||
|
|
||||||
[hidden], area, base, basefont, datalist, head, link, menu[type=popup i], meta,
|
[hidden], area, base, basefont, datalist, head, link, menu[type=popup i], meta,
|
||||||
noembed, noframes, param, rp, script, source, style, template, track, title {
|
noembed, noframes, param, rp, script, source, style, template, track, title {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
19
tests/wpt/meta/MANIFEST.json
vendored
19
tests/wpt/meta/MANIFEST.json
vendored
|
@ -161519,6 +161519,19 @@
|
||||||
{}
|
{}
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
"quotes-lang-dynamic-001.html": [
|
||||||
|
"736627eeb0a8b9c44359659782df7212bd2a2256",
|
||||||
|
[
|
||||||
|
null,
|
||||||
|
[
|
||||||
|
[
|
||||||
|
"/css/css-content/reference/quotes-lang-dynamic-001-ref.html",
|
||||||
|
"=="
|
||||||
|
]
|
||||||
|
],
|
||||||
|
{}
|
||||||
|
]
|
||||||
|
],
|
||||||
"quotes-slot-scoping.html": [
|
"quotes-slot-scoping.html": [
|
||||||
"3caeabef4eccc76d8703825bf5db09e129186987",
|
"3caeabef4eccc76d8703825bf5db09e129186987",
|
||||||
[
|
[
|
||||||
|
@ -413698,7 +413711,7 @@
|
||||||
[]
|
[]
|
||||||
],
|
],
|
||||||
"quotes-slot-scoping-ref.html": [
|
"quotes-slot-scoping-ref.html": [
|
||||||
"e3e907cba589deb2e2c950a0a109cc639d0d16bd",
|
"a546fa96e56cb89cd081188b363ec8d530ed7f12",
|
||||||
[]
|
[]
|
||||||
],
|
],
|
||||||
"reference": {
|
"reference": {
|
||||||
|
@ -413845,6 +413858,10 @@
|
||||||
"quotes-first-letter-002-ref.html": [
|
"quotes-first-letter-002-ref.html": [
|
||||||
"094be48cd8c90b569b82ce26d9083daecca7ae44",
|
"094be48cd8c90b569b82ce26d9083daecca7ae44",
|
||||||
[]
|
[]
|
||||||
|
],
|
||||||
|
"quotes-lang-dynamic-001-ref.html": [
|
||||||
|
"14ef76596211d5b03f8474387c81821d8d8e628f",
|
||||||
|
[]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"resources": {
|
"resources": {
|
||||||
|
|
2
tests/wpt/meta/css/CSS2/generated-content/content-056.xht.ini
vendored
Normal file
2
tests/wpt/meta/css/CSS2/generated-content/content-056.xht.ini
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[content-056.xht]
|
||||||
|
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
||||||
[content-156.xht]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[content-157.xht]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[first-letter-dynamic-001.xht]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[first-letter-dynamic-002.xht]
|
|
||||||
expected: FAIL
|
|
|
@ -10,3 +10,4 @@
|
||||||
|
|
||||||
[Property bookmark-level does not inherit]
|
[Property bookmark-level does not inherit]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
[quotes-002.html]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[quotes-010.html]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[quotes-021.html]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[quotes-031.html]
|
|
||||||
expected: FAIL
|
|
2
tests/wpt/meta/css/css-content/quotes-slot-scoping.html.ini
vendored
Normal file
2
tests/wpt/meta/css/css-content/quotes-slot-scoping.html.ini
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[quotes-slot-scoping.html]
|
||||||
|
expected: FAIL
|
13
tests/wpt/tests/css/css-content/quotes-lang-dynamic-001.html
vendored
Normal file
13
tests/wpt/tests/css/css-content/quotes-lang-dynamic-001.html
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<!doctype html>
|
||||||
|
<meta charset=utf-8>
|
||||||
|
<title>CSS-content test: changing the lang attribute affects quotes</title>
|
||||||
|
<link rel="author" title="Xiaocheng Hu" href="mailto:xiaochengh.work@gmail.com">
|
||||||
|
<link rel="match" href="reference/quotes-lang-dynamic-001-ref.html">
|
||||||
|
<link rel=help href="https://drafts.csswg.org/css-content/#quotes">
|
||||||
|
|
||||||
|
<div id="root" lang="en"><q>First letter</q></div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.body.offsetTop;
|
||||||
|
root.setAttribute('lang', 'fr');
|
||||||
|
</script>
|
|
@ -4,15 +4,8 @@
|
||||||
<title>Quote scope Shadow DOM and SLOT</title>
|
<title>Quote scope Shadow DOM and SLOT</title>
|
||||||
<link rel="author" title="Martin Robinson" href="mailto:mrobinson@igalia.com">
|
<link rel="author" title="Martin Robinson" href="mailto:mrobinson@igalia.com">
|
||||||
<link rel="help" href="https://www.w3.org/TR/css-content-3/#quote-values">
|
<link rel="help" href="https://www.w3.org/TR/css-content-3/#quote-values">
|
||||||
<style>
|
|
||||||
q {
|
|
||||||
quotes: '1''1''2''2''3''3';
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<q>
|
1 2Quote2 1
|
||||||
<q>Quote</q>
|
|
||||||
</q>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
7
tests/wpt/tests/css/css-content/reference/quotes-lang-dynamic-001-ref.html
vendored
Normal file
7
tests/wpt/tests/css/css-content/reference/quotes-lang-dynamic-001-ref.html
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<!doctype html>
|
||||||
|
<meta charset=utf-8>
|
||||||
|
<title>CSS-content test: changing the lang attribute affects quotes</title>
|
||||||
|
<link rel="author" title="Xiaocheng Hu" href="mailto:xiaochengh.work@gmail.com">
|
||||||
|
<link rel=help href="https://drafts.csswg.org/css-content/#quotes">
|
||||||
|
|
||||||
|
<div>«First letter»</div>
|
Loading…
Add table
Add a link
Reference in a new issue