diff options
author | Dmitry Kolupaev <dmitry.klpv@gmail.com> | 2020-02-22 13:28:22 +0300 |
---|---|---|
committer | Dmitry Kolupaev <dmitry.klpv@gmail.com> | 2020-02-25 01:18:21 +0300 |
commit | 25c5a4c045f8ea29119adfa07205535a2cb5785e (patch) | |
tree | 139aebbf177ab482b2a984f96182b9d747e08d50 | |
parent | ab2aeb6d97d18b64559220e2517a70d5dd22a1a3 (diff) | |
download | servo-25c5a4c045f8ea29119adfa07205535a2cb5785e.tar.gz servo-25c5a4c045f8ea29119adfa07205535a2cb5785e.zip |
Use map_or and fix manifest
-rw-r--r-- | components/script/dom/htmlelement.rs | 1 | ||||
-rw-r--r-- | components/script/dom/htmlformelement.rs | 15 | ||||
-rw-r--r-- | components/script/dom/webidls/HTMLElement.webidl | 2 | ||||
-rw-r--r-- | tests/wpt/metadata/MANIFEST.json | 16 |
4 files changed, 25 insertions, 9 deletions
diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index 3bf4307b826..00d7a64ed32 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -774,6 +774,7 @@ impl HTMLElement { .count() as u32 } + // https://html.spec.whatwg.org/multipage/#the-directionality. // returns Some if can infer direction by itself or from child nodes // returns None if requires to go up to parent pub fn directionality(&self) -> Option<String> { diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index 7003df0bd75..30d1857de9d 100644 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -985,19 +985,20 @@ impl HTMLFormElement { // An element can only have a dirname attribute if it is a textarea element // or an input element whose type attribute is in either the Text state or the Search state let child_element = child.downcast::<Element>().unwrap(); - let input_matches = child_element - .downcast::<HTMLInputElement>() - .map(|input| { - input.input_type() == InputType::Text || input.input_type() == InputType::Search - }) - .unwrap_or(false); + let input_matches = + child_element + .downcast::<HTMLInputElement>() + .map_or(false, |input| { + input.input_type() == InputType::Text || + input.input_type() == InputType::Search + }); let textarea_matches = child_element.is::<HTMLTextAreaElement>(); let dirname = child_element.get_string_attribute(&local_name!("dirname")); if (input_matches || textarea_matches) && !dirname.is_empty() { let dir = DOMString::from(child_element.directionality()); data_set.push(FormDatum { ty: DOMString::from("string"), - name: dirname.clone(), + name: dirname, value: FormDatumValue::String(dir), }); } diff --git a/components/script/dom/webidls/HTMLElement.webidl b/components/script/dom/webidls/HTMLElement.webidl index 5300ca8b2a0..c743c0a7129 100644 --- a/components/script/dom/webidls/HTMLElement.webidl +++ b/components/script/dom/webidls/HTMLElement.webidl @@ -14,7 +14,7 @@ interface HTMLElement : Element { attribute DOMString lang; [CEReactions] attribute boolean translate; - [CEReactions] + [CEReactions] attribute DOMString dir; readonly attribute DOMStringMap dataset; diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index fdffa8761db..ef63b8f10c9 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -438076,7 +438076,21 @@ "forms": { "attributes-common-to-form-controls": { "dirname-ltr.html": [ - "28d1c150b37258176a0d13f0ea47b85ef5ddba52", + "9d1c9eb77e9fdef844689bb71b44c8c2271e6ba4", + [ + null, + {} + ] + ], + "dirname-rtl-auto.html": [ + "6368a26fafd74105428969660fec3d29bbcb4dce", + [ + null, + {} + ] + ], + "dirname-rtl-inherited.html": [ + "1e6967d914a34de49033b1ea358b4093f11baf97", [ null, {} |