Auto merge of #10019 - rebstar6:htmllabelclick, r=jdm

Fix htmllabelelement click to activate correct element

Address https://github.com/servo/servo/issues/9928

Pass on label click to the label element's labeled control

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10019)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-03-30 05:41:00 +05:30
commit 80d903a897
5 changed files with 189 additions and 10 deletions

View file

@ -862,10 +862,6 @@ impl VirtualMethods for HTMLInputElement {
}
if event.type_() == atom!("click") && !event.DefaultPrevented() {
if let InputType::InputRadio = self.input_type.get() {
self.update_checked_state(true, true);
}
// TODO: Dispatch events for non activatable inputs
// https://html.spec.whatwg.org/multipage/#common-input-element-events

View file

@ -63,12 +63,15 @@ impl Activatable for HTMLLabelElement {
// https://html.spec.whatwg.org/multipage/#run-post-click-activation-steps
fn activation_behavior(&self, _event: &Event, _target: &EventTarget) {
synthetic_click_activation(self.upcast::<Element>(),
false,
false,
false,
false,
ActivationSource::NotFromClick);
if let Some(e) = self.GetControl() {
let elem = e.upcast::<Element>();
synthetic_click_activation(elem,
false,
false,
false,
false,
ActivationSource::NotFromClick);
}
}
// https://html.spec.whatwg.org/multipage/#implicit-submission