mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
merge from master
This commit is contained in:
commit
6e774ea6eb
1044 changed files with 46059 additions and 1506 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::Activatable;
|
||||
use dom::attr::AttrValue;
|
||||
use dom::bindings::codegen::Bindings::HTMLLabelElementBinding;
|
||||
use dom::bindings::codegen::Bindings::HTMLLabelElementBinding::HTMLLabelElementMethods;
|
||||
|
@ -9,6 +10,8 @@ use dom::bindings::inheritance::Castable;
|
|||
use dom::bindings::js::Root;
|
||||
use dom::document::Document;
|
||||
use dom::element::Element;
|
||||
use dom::event::Event;
|
||||
use dom::eventtarget::EventTarget;
|
||||
use dom::htmlelement::HTMLElement;
|
||||
use dom::htmlformelement::{FormControl, HTMLFormElement};
|
||||
use dom::node::{document_from_node, Node};
|
||||
|
@ -40,6 +43,40 @@ impl HTMLLabelElement {
|
|||
}
|
||||
}
|
||||
|
||||
impl Activatable for HTMLLabelElement {
|
||||
fn as_element(&self) -> &Element {
|
||||
self.upcast::<Element>()
|
||||
}
|
||||
|
||||
fn is_instance_activatable(&self) -> bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#run-pre-click-activation-steps
|
||||
// https://html.spec.whatwg.org/multipage/#the-button-element:activation-behavior
|
||||
fn pre_click_activation(&self) {
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#run-canceled-activation-steps
|
||||
fn canceled_activation(&self) {
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#run-post-click-activation-steps
|
||||
fn activation_behavior(&self, _event: &Event, _target: &EventTarget) {
|
||||
self.upcast::<Element>()
|
||||
.as_maybe_activatable()
|
||||
.map(|a| a.synthetic_click_activation(false, false, false, false));
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#implicit-submission
|
||||
fn implicit_submission(&self, _ctrlKey: bool, _shiftKey: bool, _altKey: bool, _metaKey: bool) {
|
||||
//FIXME: Investigate and implement implicit submission for label elements
|
||||
// Issue filed at https://github.com/servo/servo/issues/8263
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
impl HTMLLabelElementMethods for HTMLLabelElement {
|
||||
// https://html.spec.whatwg.org/multipage/#dom-fae-form
|
||||
fn GetForm(&self) -> Option<Root<HTMLFormElement>> {
|
||||
|
@ -86,7 +123,7 @@ impl VirtualMethods for HTMLLabelElement {
|
|||
}
|
||||
|
||||
impl HTMLLabelElement {
|
||||
fn first_labelable_descendant(&self) -> Option<Root<HTMLElement>> {
|
||||
pub fn first_labelable_descendant(&self) -> Option<Root<HTMLElement>> {
|
||||
self.upcast::<Node>()
|
||||
.traverse_preorder()
|
||||
.filter_map(Root::downcast::<HTMLElement>)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue