mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #9930 - rebstar6:htmlclick, r=jdm
Remove activatable element filter within HTMLElement#click() Address https://github.com/servo/servo/issues/6542 Ensure that click() calls are not limited to activatable elements. Also makes the isTrusted attribute false when synthetic click activation are called from a click() method (as per spec). <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9930) <!-- Reviewable:end -->
This commit is contained in:
commit
f2f6787189
9 changed files with 95 additions and 66 deletions
|
@ -2,6 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::activation::{ActivationSource, synthetic_click_activation};
|
||||
use dom::attr::Attr;
|
||||
use dom::attr::AttrValue;
|
||||
use dom::bindings::codegen::Bindings::ElementBinding::ElementMethods;
|
||||
|
@ -9,7 +10,6 @@ use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
|
|||
use dom::bindings::codegen::Bindings::EventHandlerBinding::OnErrorEventHandlerNonNull;
|
||||
use dom::bindings::codegen::Bindings::HTMLElementBinding;
|
||||
use dom::bindings::codegen::Bindings::HTMLElementBinding::HTMLElementMethods;
|
||||
use dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementMethods;
|
||||
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
|
||||
use dom::bindings::error::{Error, ErrorResult};
|
||||
use dom::bindings::inheritance::Castable;
|
||||
|
@ -200,15 +200,14 @@ impl HTMLElementMethods for HTMLElement {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-click
|
||||
fn Click(&self) {
|
||||
if let Some(i) = self.downcast::<HTMLInputElement>() {
|
||||
if i.Disabled() {
|
||||
return;
|
||||
}
|
||||
if !self.upcast::<Element>().get_disabled_state() {
|
||||
synthetic_click_activation(self.upcast::<Element>(),
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
ActivationSource::FromClick)
|
||||
}
|
||||
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=27430 ?
|
||||
self.upcast::<Element>()
|
||||
.as_maybe_activatable()
|
||||
.map(|a| a.synthetic_click_activation(false, false, false, false));
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-focus
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue