mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +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 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;
|
return directionality;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -434,19 +434,13 @@ impl Node {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn parent_directionality(&self) -> String {
|
pub fn parent_directionality(&self) -> String {
|
||||||
println!("Node#parent_directionality");
|
|
||||||
match self.GetParentNode() {
|
match self.GetParentNode() {
|
||||||
Some(parent) => {
|
Some(parent) => {
|
||||||
if parent.is::<Document>() {
|
if let Some(parent_html) = parent.downcast::<Element>() {
|
||||||
return "ltr".to_owned();
|
|
||||||
}
|
|
||||||
|
|
||||||
println!("Node#parent_directionality Some(Parent)");
|
|
||||||
return if let Some(parent_html) = parent.downcast::<Element>() {
|
|
||||||
parent_html.directionality()
|
parent_html.directionality()
|
||||||
} else {
|
} else {
|
||||||
parent.parent_directionality()
|
parent.parent_directionality()
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
None => "ltr".to_owned(),
|
None => "ltr".to_owned(),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue