aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/element.rs
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-05-20 14:34:31 -0500
committerbors-servo <metajack+bors@gmail.com>2015-05-20 14:34:31 -0500
commitfada39164cbaba3a9885f08fad6f10a2353a4838 (patch)
treedcf483e3d1ac9ac86457daaaa35726c01111f62f /components/script/dom/element.rs
parentee147c164a8a13743dec2def60b13997145e7a55 (diff)
parent1c96eed54410b45e0d0401941d4d156c5c8c9c78 (diff)
downloadservo-fada39164cbaba3a9885f08fad6f10a2353a4838.tar.gz
servo-fada39164cbaba3a9885f08fad6f10a2353a4838.zip
Auto merge of #5858 - pgonda:tabindex-focus-flag, r=jdm
Added support for the tabindex field, also added its correct defaults (-2 TODOs for things not supported in Servo yet). Also added tabindex logic into Element::is_focusable_area. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5858) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/element.rs')
-rw-r--r--components/script/dom/element.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index a666a28e627..b586172816d 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -54,7 +54,7 @@ use dom::htmltablecellelement::{HTMLTableCellElement, HTMLTableCellElementHelper
use dom::htmltablerowelement::{HTMLTableRowElement, HTMLTableRowElementHelpers};
use dom::htmltablesectionelement::{HTMLTableSectionElement, HTMLTableSectionElementHelpers};
use dom::htmltextareaelement::{HTMLTextAreaElement, RawLayoutHTMLTextAreaElementHelpers};
-use dom::node::{CLICK_IN_PROGRESS, LayoutNodeHelpers, Node, NodeHelpers, NodeTypeId};
+use dom::node::{CLICK_IN_PROGRESS, LayoutNodeHelpers, Node, NodeHelpers, NodeTypeId, SEQUENTIALLY_FOCUSABLE};
use dom::node::{document_from_node, NodeDamage};
use dom::node::{window_from_node};
use dom::nodelist::NodeList;
@@ -757,9 +757,11 @@ impl<'a> FocusElementHelpers for JSRef<'a, Element> {
return false;
}
// TODO: Check whether the element is being rendered (i.e. not hidden).
- // TODO: Check the tabindex focus flag.
- // https://html.spec.whatwg.org/multipage/#specially-focusable
let node: JSRef<Node> = NodeCast::from_ref(self);
+ if node.get_flag(SEQUENTIALLY_FOCUSABLE) {
+ return true;
+ }
+ // https://html.spec.whatwg.org/multipage/#specially-focusable
match node.type_id() {
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAnchorElement)) |
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement)) |
@@ -979,6 +981,9 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> {
self.attrs.borrow_mut().remove(idx);
attr.r().set_owner(None);
+ if attr.r().namespace() == &ns!("") {
+ vtable_for(&NodeCast::from_ref(self)).after_remove_attr(attr.r().name());
+ }
let node: JSRef<Node> = NodeCast::from_ref(self);
if node.is_in_doc() {