summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML
diff options
context:
space:
mode:
authorLuke Wilde <lukew@serenityos.org>2022-11-05 03:58:14 +0000
committerAndreas Kling <kling@serenityos.org>2022-11-07 14:10:41 +0100
commit1473bc9169dd73d411eab17b0078abbfb451396b (patch)
tree09dcf4c9579ad6990cf4b43306d3d7239ef6821f /Userland/Libraries/LibWeb/HTML
parent6c21c72492b2601132a9ff28e658c4b0ffb8a370 (diff)
downloadserenity-1473bc9169dd73d411eab17b0078abbfb451396b.zip
LibWeb: Implement HTMLOrSVGElement.tabIndex
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML')
-rw-r--r--Userland/Libraries/LibWeb/HTML/AttributeNames.h2
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp7
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h1
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp7
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h1
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp7
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h3
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLElement.idl2
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp8
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLFrameElement.h2
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp7
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h2
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp7
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLInputElement.h3
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp7
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h3
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp7
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h3
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp7
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h3
20 files changed, 89 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/AttributeNames.h b/Userland/Libraries/LibWeb/HTML/AttributeNames.h
index e30d9ddb79..72949afe8a 100644
--- a/Userland/Libraries/LibWeb/HTML/AttributeNames.h
+++ b/Userland/Libraries/LibWeb/HTML/AttributeNames.h
@@ -24,6 +24,7 @@ namespace AttributeNames {
__ENUMERATE_HTML_ATTRIBUTE(alt) \
__ENUMERATE_HTML_ATTRIBUTE(archive) \
__ENUMERATE_HTML_ATTRIBUTE(async) \
+ __ENUMERATE_HTML_ATTRIBUTE(autofocus) \
__ENUMERATE_HTML_ATTRIBUTE(autoplay) \
__ENUMERATE_HTML_ATTRIBUTE(axis) \
__ENUMERATE_HTML_ATTRIBUTE(background) \
@@ -208,6 +209,7 @@ namespace AttributeNames {
__ENUMERATE_HTML_ATTRIBUTE(step) \
__ENUMERATE_HTML_ATTRIBUTE(style) \
__ENUMERATE_HTML_ATTRIBUTE(summary) \
+ __ENUMERATE_HTML_ATTRIBUTE(tabindex) \
__ENUMERATE_HTML_ATTRIBUTE(target) \
__ENUMERATE_HTML_ATTRIBUTE(text) \
__ENUMERATE_HTML_ATTRIBUTE(title) \
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp
index fb565e8042..28bf54d892 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp
@@ -77,4 +77,11 @@ void HTMLAnchorElement::run_activation_behavior(Web::DOM::Event const&)
follow_the_hyperlink(hyperlink_suffix);
}
+// https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex
+i32 HTMLAnchorElement::default_tab_index_value() const
+{
+ // See the base function for the spec comments.
+ return 0;
+}
+
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h
index 868153ec97..94d944da4e 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h
@@ -35,6 +35,7 @@ private:
// ^DOM::Element
virtual void parse_attribute(FlyString const& name, String const& value) override;
+ virtual i32 default_tab_index_value() const override;
// ^HTML::HTMLHyperlinkElementUtils
virtual DOM::Document& hyperlink_element_utils_document() override { return document(); }
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp
index c41d3c6ba2..50080b3c2e 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp
@@ -35,4 +35,11 @@ void HTMLAreaElement::set_hyperlink_element_utils_href(String href)
MUST(set_attribute(HTML::AttributeNames::href, move(href)));
}
+// https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex
+i32 HTMLAreaElement::default_tab_index_value() const
+{
+ // See the base function for the spec comments.
+ return 0;
+}
+
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h
index 234ec1eb9e..db277069ff 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h
@@ -25,6 +25,7 @@ private:
// ^DOM::Element
virtual void parse_attribute(FlyString const& name, String const& value) override;
+ virtual i32 default_tab_index_value() const override;
// ^HTML::HTMLHyperlinkElementUtils
virtual DOM::Document& hyperlink_element_utils_document() override { return document(); }
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp
index 6698264878..78ffb8a8e7 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp
@@ -86,4 +86,11 @@ void HTMLButtonElement::set_type(String const& type)
MUST(set_attribute(HTML::AttributeNames::type, type));
}
+// https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex
+i32 HTMLButtonElement::default_tab_index_value() const
+{
+ // See the base function for the spec comments.
+ return 0;
+}
+
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h
index b1045f18c2..e0f4f6eb9b 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h
@@ -55,6 +55,9 @@ public:
private:
HTMLButtonElement(DOM::Document&, DOM::QualifiedName);
+
+ // ^DOM::Element
+ virtual i32 default_tab_index_value() const override;
};
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLElement.idl
index 6cb9bbcc85..b7ce750515 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLElement.idl
+++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.idl
@@ -32,4 +32,6 @@ HTMLElement includes HTMLOrSVGElement;
interface mixin HTMLOrSVGElement {
[SameObject] readonly attribute DOMStringMap dataset;
+
+ [CEReactions] attribute long tabIndex;
};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp
index dd2af51347..75597fed8d 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp
@@ -16,4 +16,12 @@ HTMLFrameElement::HTMLFrameElement(DOM::Document& document, DOM::QualifiedName q
}
HTMLFrameElement::~HTMLFrameElement() = default;
+
+// https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex
+i32 HTMLFrameElement::default_tab_index_value() const
+{
+ // See the base function for the spec comments.
+ return 0;
+}
+
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.h
index 5b59d5445c..de3a5cc3a8 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.h
@@ -19,6 +19,8 @@ public:
private:
HTMLFrameElement(DOM::Document&, DOM::QualifiedName);
+ // ^DOM::Element
+ virtual i32 default_tab_index_value() const override;
};
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp
index c3d171b55d..adc687c5e3 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp
@@ -164,4 +164,11 @@ void run_iframe_load_event_steps(HTML::HTMLIFrameElement& element)
// FIXME: 6. Unset childDocument's iframe load in progress flag.
}
+// https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex
+i32 HTMLIFrameElement::default_tab_index_value() const
+{
+ // See the base function for the spec comments.
+ return 0;
+}
+
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h
index dd2aff3736..55a728ae94 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h
@@ -28,9 +28,11 @@ public:
private:
HTMLIFrameElement(DOM::Document&, DOM::QualifiedName);
+ // ^DOM::Element
virtual void inserted() override;
virtual void removed_from(Node*) override;
virtual void parse_attribute(FlyString const& name, String const& value) override;
+ virtual i32 default_tab_index_value() const override;
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#process-the-iframe-attributes
void process_the_iframe_attributes(bool initial_insertion = false);
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
index f71ecea17a..952d6450e9 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
@@ -555,4 +555,11 @@ void HTMLInputElement::legacy_cancelled_activation_behavior_was_not_called()
m_legacy_pre_activation_behavior_checked_element_in_group = nullptr;
}
+// https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex
+i32 HTMLInputElement::default_tab_index_value() const
+{
+ // See the base function for the spec comments.
+ return 0;
+}
+
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h
index b77c6cbc9e..3b942e0d10 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h
@@ -123,6 +123,9 @@ private:
virtual void legacy_cancelled_activation_behavior() override;
virtual void legacy_cancelled_activation_behavior_was_not_called() override;
+ // ^DOM::Element
+ virtual i32 default_tab_index_value() const override;
+
virtual void visit_edges(Cell::Visitor&) override;
static TypeAttributeState parse_type_attribute(StringView);
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp
index 7eecba0673..d93edc27b2 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp
@@ -316,4 +316,11 @@ void HTMLObjectElement::update_layout_and_child_objects(Representation represent
document().set_needs_layout();
}
+// https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex
+i32 HTMLObjectElement::default_tab_index_value() const
+{
+ // See the base function for the spec comments.
+ return 0;
+}
+
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h
index ad9a0b1fcb..a1ca6fab41 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h
@@ -62,6 +62,9 @@ private:
virtual void resource_did_load() override;
virtual void resource_did_fail() override;
+ // ^DOM::Element
+ virtual i32 default_tab_index_value() const override;
+
Representation m_representation { Representation::Unknown };
Optional<ImageLoader> m_image_loader;
};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp
index ad1180bc47..73dc93c6f3 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp
@@ -122,4 +122,11 @@ void HTMLSelectElement::set_selected_index(int index)
selected_option->m_dirty = true;
}
+// https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex
+i32 HTMLSelectElement::default_tab_index_value() const
+{
+ // See the base function for the spec comments.
+ return 0;
+}
+
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h
index 43209d5b7b..cde0d812e7 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h
@@ -61,6 +61,9 @@ private:
virtual void visit_edges(Cell::Visitor&) override;
+ // ^DOM::Element
+ virtual i32 default_tab_index_value() const override;
+
JS::GCPtr<HTMLOptionsCollection> m_options;
};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp
index f803bce044..fb31efe7b1 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp
@@ -17,4 +17,11 @@ HTMLTextAreaElement::HTMLTextAreaElement(DOM::Document& document, DOM::Qualified
HTMLTextAreaElement::~HTMLTextAreaElement() = default;
+// https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex
+i32 HTMLTextAreaElement::default_tab_index_value() const
+{
+ // See the base function for the spec comments.
+ return 0;
+}
+
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h
index 541dbc386e..9bce80306c 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h
@@ -50,6 +50,9 @@ public:
private:
HTMLTextAreaElement(DOM::Document&, DOM::QualifiedName);
+
+ // ^DOM::Element
+ virtual i32 default_tab_index_value() const override;
};
}