Auto merge of #27666 - ghostd:fix-checkbox-radio-activation, r=jdm

Allow mutating <input disabled type=checkbox/radio>

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #27586

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
bors-servo 2020-09-24 20:34:36 -04:00 committed by GitHub
commit 0baa1ea7bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 25 deletions

View file

@ -2728,21 +2728,14 @@ impl Activatable for HTMLInputElement {
// https://html.spec.whatwg.org/multipage/#reset-button-state-%28type=reset%29:activation-behaviour-2 // https://html.spec.whatwg.org/multipage/#reset-button-state-%28type=reset%29:activation-behaviour-2
// https://html.spec.whatwg.org/multipage/#checkbox-state-%28type=checkbox%29:activation-behaviour-2 // https://html.spec.whatwg.org/multipage/#checkbox-state-%28type=checkbox%29:activation-behaviour-2
// https://html.spec.whatwg.org/multipage/#radio-button-state-%28type=radio%29:activation-behaviour-2 // https://html.spec.whatwg.org/multipage/#radio-button-state-%28type=radio%29:activation-behaviour-2
InputType::Submit | InputType::Submit | InputType::Reset | InputType::File => self.is_mutable(),
InputType::Reset | InputType::Checkbox | InputType::Radio => true,
InputType::File |
InputType::Checkbox |
InputType::Radio => self.is_mutable(),
_ => false, _ => false,
} }
} }
// https://dom.spec.whatwg.org/#eventtarget-legacy-pre-activation-behavior // https://dom.spec.whatwg.org/#eventtarget-legacy-pre-activation-behavior
fn legacy_pre_activation_behavior(&self) -> Option<InputActivationState> { fn legacy_pre_activation_behavior(&self) -> Option<InputActivationState> {
if !self.is_mutable() {
return None;
}
let ty = self.input_type(); let ty = self.input_type();
match ty { match ty {
InputType::Checkbox => { InputType::Checkbox => {
@ -2777,9 +2770,6 @@ impl Activatable for HTMLInputElement {
// https://dom.spec.whatwg.org/#eventtarget-legacy-canceled-activation-behavior // https://dom.spec.whatwg.org/#eventtarget-legacy-canceled-activation-behavior
fn legacy_canceled_activation_behavior(&self, cache: Option<InputActivationState>) { fn legacy_canceled_activation_behavior(&self, cache: Option<InputActivationState>) {
// Step 1 // Step 1
if !self.is_mutable() {
return;
}
let ty = self.input_type(); let ty = self.input_type();
let cache = match cache { let cache = match cache {
Some(cache) => { Some(cache) => {

View file

@ -2,16 +2,3 @@
type: testharness type: testharness
[event state during post-click handling] [event state during post-click handling]
expected: FAIL expected: FAIL
[disabled radio should be checked from dispatchEvent(new MouseEvent("click"))]
expected: FAIL
[disabled checkbox should be checked from dispatchEvent(new MouseEvent("click"))]
expected: FAIL
[disabled radio should get legacy-canceled-activation behavior]
expected: FAIL
[disabled checkbox should get legacy-canceled-activation behavior]
expected: FAIL