From 61881160907bbca4c23ffa24b2e3872d53ccb382 Mon Sep 17 00:00:00 2001 From: Dmitry Kolupaev Date: Tue, 18 Feb 2020 18:23:40 +0300 Subject: [PATCH] Add special case directionality of phone input --- components/script/dom/htmlelement.rs | 6 ++++++ components/script/dom/htmlinputelement.rs | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index 9384fba14727..3bf4307b826e 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -787,6 +787,12 @@ impl HTMLElement { return Some("rtl".to_owned()); } + if let Some(input) = self.downcast::() { + if input.input_type() == InputType::Tel { + return Some("ltr".to_owned()); + } + } + if element_direction == "auto" { if let Some(directionality) = self .downcast::() diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index bc503fd1fda5..07e5059a6488 100755 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -330,7 +330,6 @@ impl HTMLInputElement { pub fn auto_directionality(&self) -> Option { match self.input_type() { - InputType::Tel => return Some("ltr".to_owned()), InputType::Text | InputType::Search | InputType::Url | InputType::Email => { let value: String = self.Value().to_string(); Some(HTMLInputElement::directionality_from_value(&value))