diff options
Diffstat (limited to 'components/script/dom/htmlelement.rs')
-rw-r--r-- | components/script/dom/htmlelement.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index a8043d27e18..68c097158dc 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -28,6 +28,7 @@ use dom::node::{Node, NodeHelpers, NodeTypeId, document_from_node, window_from_n use dom::virtualmethods::VirtualMethods; use dom::window::WindowHelpers; +use msg::constellation_msg::FocusType; use util::str::DOMString; use string_cache::Atom; @@ -123,7 +124,7 @@ impl<'a> HTMLElementMethods for JSRef<'a, HTMLElement> { } } - // https://html.spec.whatwg.org/multipage/interaction.html#dom-click + // https://html.spec.whatwg.org/multipage/#dom-click fn Click(self) { let maybe_input: Option<JSRef<HTMLInputElement>> = HTMLInputElementCast::to_ref(self); if let Some(i) = maybe_input { @@ -136,30 +137,30 @@ impl<'a> HTMLElementMethods for JSRef<'a, HTMLElement> { element.as_maybe_activatable().map(|a| a.synthetic_click_activation(false, false, false, false)); } - // https://html.spec.whatwg.org/multipage/interaction.html#dom-focus + // https://html.spec.whatwg.org/multipage/#dom-focus fn Focus(self) { // TODO: Mark the element as locked for focus and run the focusing steps. - // https://html.spec.whatwg.org/multipage/interaction.html#focusing-steps + // https://html.spec.whatwg.org/multipage/#focusing-steps let element: JSRef<Element> = ElementCast::from_ref(self); let document = document_from_node(self).root(); let document = document.r(); document.begin_focus_transaction(); document.request_focus(element); - document.commit_focus_transaction(); + document.commit_focus_transaction(FocusType::Element); } - // https://html.spec.whatwg.org/multipage/interaction.html#dom-blur + // https://html.spec.whatwg.org/multipage/#dom-blur fn Blur(self) { // TODO: Run the unfocusing steps. let node: JSRef<Node> = NodeCast::from_ref(self); if !node.get_focus_state() { return; } - // https://html.spec.whatwg.org/multipage/interaction.html#unfocusing-steps + // https://html.spec.whatwg.org/multipage/#unfocusing-steps let document = document_from_node(self).root(); document.r().begin_focus_transaction(); // If `request_focus` is not called, focus will be set to None. - document.r().commit_focus_transaction(); + document.r().commit_focus_transaction(FocusType::Element); } } |