Simplify code for directionality

This commit is contained in:
Dmitry Kolupaev 2020-02-16 22:53:03 +03:00
parent edb940e613
commit 35d340daba
2 changed files with 9 additions and 14 deletions

View file

@ -438,21 +438,19 @@ impl Node {
loop {
match current {
Some(parent) => {
if let Some(directionality) = parent
Some(node) => {
if let Some(directionality) = node
.downcast::<HTMLElement>()
.and_then(|html_element| html_element.directionality())
{
return directionality;
} else {
current = parent.GetParentNode();
current = node.GetParentNode();
}
},
None => break,
None => return "ltr".to_owned(),
}
}
"ltr".to_owned()
}
}