mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Use map_or and fix manifest
This commit is contained in:
parent
ab2aeb6d97
commit
25c5a4c045
4 changed files with 25 additions and 9 deletions
|
@ -774,6 +774,7 @@ impl HTMLElement {
|
||||||
.count() as u32
|
.count() as u32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#the-directionality.
|
||||||
// returns Some if can infer direction by itself or from child nodes
|
// returns Some if can infer direction by itself or from child nodes
|
||||||
// returns None if requires to go up to parent
|
// returns None if requires to go up to parent
|
||||||
pub fn directionality(&self) -> Option<String> {
|
pub fn directionality(&self) -> Option<String> {
|
||||||
|
|
|
@ -985,19 +985,20 @@ impl HTMLFormElement {
|
||||||
// An element can only have a dirname attribute if it is a textarea element
|
// 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
|
// 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 child_element = child.downcast::<Element>().unwrap();
|
||||||
let input_matches = child_element
|
let input_matches =
|
||||||
.downcast::<HTMLInputElement>()
|
child_element
|
||||||
.map(|input| {
|
.downcast::<HTMLInputElement>()
|
||||||
input.input_type() == InputType::Text || input.input_type() == InputType::Search
|
.map_or(false, |input| {
|
||||||
})
|
input.input_type() == InputType::Text ||
|
||||||
.unwrap_or(false);
|
input.input_type() == InputType::Search
|
||||||
|
});
|
||||||
let textarea_matches = child_element.is::<HTMLTextAreaElement>();
|
let textarea_matches = child_element.is::<HTMLTextAreaElement>();
|
||||||
let dirname = child_element.get_string_attribute(&local_name!("dirname"));
|
let dirname = child_element.get_string_attribute(&local_name!("dirname"));
|
||||||
if (input_matches || textarea_matches) && !dirname.is_empty() {
|
if (input_matches || textarea_matches) && !dirname.is_empty() {
|
||||||
let dir = DOMString::from(child_element.directionality());
|
let dir = DOMString::from(child_element.directionality());
|
||||||
data_set.push(FormDatum {
|
data_set.push(FormDatum {
|
||||||
ty: DOMString::from("string"),
|
ty: DOMString::from("string"),
|
||||||
name: dirname.clone(),
|
name: dirname,
|
||||||
value: FormDatumValue::String(dir),
|
value: FormDatumValue::String(dir),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ interface HTMLElement : Element {
|
||||||
attribute DOMString lang;
|
attribute DOMString lang;
|
||||||
[CEReactions]
|
[CEReactions]
|
||||||
attribute boolean translate;
|
attribute boolean translate;
|
||||||
[CEReactions]
|
[CEReactions]
|
||||||
attribute DOMString dir;
|
attribute DOMString dir;
|
||||||
readonly attribute DOMStringMap dataset;
|
readonly attribute DOMStringMap dataset;
|
||||||
|
|
||||||
|
|
|
@ -438076,7 +438076,21 @@
|
||||||
"forms": {
|
"forms": {
|
||||||
"attributes-common-to-form-controls": {
|
"attributes-common-to-form-controls": {
|
||||||
"dirname-ltr.html": [
|
"dirname-ltr.html": [
|
||||||
"28d1c150b37258176a0d13f0ea47b85ef5ddba52",
|
"9d1c9eb77e9fdef844689bb71b44c8c2271e6ba4",
|
||||||
|
[
|
||||||
|
null,
|
||||||
|
{}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"dirname-rtl-auto.html": [
|
||||||
|
"6368a26fafd74105428969660fec3d29bbcb4dce",
|
||||||
|
[
|
||||||
|
null,
|
||||||
|
{}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"dirname-rtl-inherited.html": [
|
||||||
|
"1e6967d914a34de49033b1ea358b4093f11baf97",
|
||||||
[
|
[
|
||||||
null,
|
null,
|
||||||
{}
|
{}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue