mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Simplify node#parent_directionality
This commit is contained in:
parent
7d6d1c09cb
commit
7e2107b1a5
3 changed files with 6 additions and 9 deletions
|
@ -788,7 +788,10 @@ impl HTMLElement {
|
|||
}
|
||||
|
||||
if element_direction == "auto" {
|
||||
if let Some(directionality) = self.downcast::<HTMLInputElement>().and_then(|input| input.auto_directionality()) {
|
||||
if let Some(directionality) = self
|
||||
.downcast::<HTMLInputElement>()
|
||||
.and_then(|input| input.auto_directionality())
|
||||
{
|
||||
return directionality;
|
||||
}
|
||||
|
||||
|
|
|
@ -434,19 +434,13 @@ impl Node {
|
|||
}
|
||||
|
||||
pub fn parent_directionality(&self) -> String {
|
||||
println!("Node#parent_directionality");
|
||||
match self.GetParentNode() {
|
||||
Some(parent) => {
|
||||
if parent.is::<Document>() {
|
||||
return "ltr".to_owned();
|
||||
}
|
||||
|
||||
println!("Node#parent_directionality Some(Parent)");
|
||||
return if let Some(parent_html) = parent.downcast::<Element>() {
|
||||
if let Some(parent_html) = parent.downcast::<Element>() {
|
||||
parent_html.directionality()
|
||||
} else {
|
||||
parent.parent_directionality()
|
||||
};
|
||||
}
|
||||
},
|
||||
None => "ltr".to_owned(),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue