mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Translate attribute and its inheritance semantics
This commit is contained in:
parent
d0f64d9d56
commit
3f8a9f6382
11 changed files with 38 additions and 44 deletions
|
@ -514,6 +514,25 @@ impl Element {
|
|||
debug_assert!(false, "Trying to detach a non-attached shadow root");
|
||||
}
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#translation-mode
|
||||
pub fn is_translate_enabled(&self) -> bool {
|
||||
// TODO change this to local_name! when html5ever updates
|
||||
let name = &LocalName::from("translate");
|
||||
if self.has_attribute(name) {
|
||||
match &*self.get_string_attribute(name) {
|
||||
"yes" | "" => return true,
|
||||
"no" => return false,
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
if let Some(parent) = self.upcast::<Node>().GetParentNode() {
|
||||
if let Some(elem) = parent.downcast::<Element>() {
|
||||
return elem.is_translate_enabled();
|
||||
}
|
||||
}
|
||||
true // whatwg/html#5239
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue