mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Simplify code for directionality
This commit is contained in:
parent
edb940e613
commit
35d340daba
2 changed files with 9 additions and 14 deletions
|
@ -543,15 +543,12 @@ impl Element {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#the-directionality
|
||||
pub fn directionality(&self) -> String {
|
||||
if let Some(directionality) = self
|
||||
.downcast::<HTMLElement>()
|
||||
self.downcast::<HTMLElement>()
|
||||
.and_then(|html_element| html_element.directionality())
|
||||
{
|
||||
directionality
|
||||
} else {
|
||||
let node = self.upcast::<Node>();
|
||||
node.parent_directionality()
|
||||
}
|
||||
.unwrap_or_else(|| {
|
||||
let node = self.upcast::<Node>();
|
||||
node.parent_directionality()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue