mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
Auto merge of #9105 - jdm:buttoneventsintermittent, r=nox
Implement support for modifying the type attribute of <button> https://github.com/servo/servo/pull/9100 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9105) <!-- Reviewable:end -->
This commit is contained in:
commit
77b23d1bb9
5 changed files with 19 additions and 21 deletions
|
@ -27,7 +27,6 @@ use string_cache::Atom;
|
||||||
use util::str::DOMString;
|
use util::str::DOMString;
|
||||||
|
|
||||||
#[derive(JSTraceable, PartialEq, Copy, Clone)]
|
#[derive(JSTraceable, PartialEq, Copy, Clone)]
|
||||||
#[allow(dead_code)]
|
|
||||||
#[derive(HeapSizeOf)]
|
#[derive(HeapSizeOf)]
|
||||||
enum ButtonType {
|
enum ButtonType {
|
||||||
Submit,
|
Submit,
|
||||||
|
@ -50,7 +49,6 @@ impl HTMLButtonElement {
|
||||||
htmlelement:
|
htmlelement:
|
||||||
HTMLElement::new_inherited_with_state(IN_ENABLED_STATE,
|
HTMLElement::new_inherited_with_state(IN_ENABLED_STATE,
|
||||||
localName, prefix, document),
|
localName, prefix, document),
|
||||||
//TODO: implement button_type in attribute_mutated
|
|
||||||
button_type: Cell::new(ButtonType::Submit)
|
button_type: Cell::new(ButtonType::Submit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,6 +160,22 @@ impl VirtualMethods for HTMLButtonElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
&atom!("type") => {
|
||||||
|
match mutation {
|
||||||
|
AttributeMutation::Set(_) => {
|
||||||
|
let value = match &**attr.value() {
|
||||||
|
"reset" => ButtonType::Reset,
|
||||||
|
"button" => ButtonType::Button,
|
||||||
|
"menu" => ButtonType::Menu,
|
||||||
|
_ => ButtonType::Submit,
|
||||||
|
};
|
||||||
|
self.button_type.set(value);
|
||||||
|
}
|
||||||
|
AttributeMutation::Removed => {
|
||||||
|
self.button_type.set(ButtonType::Submit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
_ => {},
|
_ => {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -330,6 +330,7 @@ macro_rules! global_event_handlers(
|
||||||
event_handler!(keyup, GetOnkeyup, SetOnkeyup);
|
event_handler!(keyup, GetOnkeyup, SetOnkeyup);
|
||||||
event_handler!(input, GetOninput, SetOninput);
|
event_handler!(input, GetOninput, SetOninput);
|
||||||
event_handler!(change, GetOnchange, SetOnchange);
|
event_handler!(change, GetOnchange, SetOnchange);
|
||||||
|
event_handler!(reset, GetOnreset, SetOnreset);
|
||||||
event_handler!(submit, GetOnsubmit, SetOnsubmit);
|
event_handler!(submit, GetOnsubmit, SetOnsubmit);
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -31,6 +31,7 @@ interface GlobalEventHandlers {
|
||||||
attribute EventHandler onkeypress;
|
attribute EventHandler onkeypress;
|
||||||
attribute EventHandler onkeyup;
|
attribute EventHandler onkeyup;
|
||||||
attribute EventHandler onchange;
|
attribute EventHandler onchange;
|
||||||
|
attribute EventHandler onreset;
|
||||||
attribute EventHandler onsubmit;
|
attribute EventHandler onsubmit;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -186,9 +186,6 @@
|
||||||
[Document interface: attribute onratechange]
|
[Document interface: attribute onratechange]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[Document interface: attribute onreset]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Document interface: attribute onresize]
|
[Document interface: attribute onresize]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
@ -1764,9 +1761,6 @@
|
||||||
[HTMLElement interface: attribute onratechange]
|
[HTMLElement interface: attribute onratechange]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[HTMLElement interface: attribute onreset]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[HTMLElement interface: attribute onresize]
|
[HTMLElement interface: attribute onresize]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
@ -2001,9 +1995,6 @@
|
||||||
[HTMLElement interface: document.createElement("noscript") must inherit property "onratechange" with the proper type (79)]
|
[HTMLElement interface: document.createElement("noscript") must inherit property "onratechange" with the proper type (79)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[HTMLElement interface: document.createElement("noscript") must inherit property "onreset" with the proper type (80)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[HTMLElement interface: document.createElement("noscript") must inherit property "onresize" with the proper type (81)]
|
[HTMLElement interface: document.createElement("noscript") must inherit property "onresize" with the proper type (81)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
@ -9117,9 +9108,6 @@
|
||||||
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "onratechange" with the proper type (141)]
|
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "onratechange" with the proper type (141)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "onreset" with the proper type (142)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "onresize" with the proper type (143)]
|
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "onresize" with the proper type (143)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,6 @@
|
||||||
[button-events.html]
|
[button-events.html]
|
||||||
type: testharness
|
type: testharness
|
||||||
expected: CRASH
|
|
||||||
[The submit event must be fired when click a button in submit status]
|
|
||||||
expected: TIMEOUT
|
expected: TIMEOUT
|
||||||
|
|
||||||
[The reset event must be fired when click a button in reset status]
|
|
||||||
expected: TIMEOUT
|
|
||||||
|
|
||||||
[The show event must be fired when click a button in menu status]
|
[The show event must be fired when click a button in menu status]
|
||||||
expected: TIMEOUT
|
expected: TIMEOUT
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue