mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 05:39:11 +00:00
LibWeb/SVG: Implement default_tab_index_value for a element
Another FIXME bites the dust :^)
This commit is contained in:
parent
9c13644cde
commit
9c4e80a3ec
Notes:
github-actions[bot]
2024-08-14 19:40:26 +00:00
Author: https://github.com/jamierocks
Commit: 9c4e80a3ec
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1077
Reviewed-by: https://github.com/AtkinsSJ ✅
Reviewed-by: https://github.com/tcl3 ✅
5 changed files with 61 additions and 1 deletions
12
Tests/LibWeb/Text/expected/HTML/tabIndex-attribute.txt
Normal file
12
Tests/LibWeb/Text/expected/HTML/tabIndex-attribute.txt
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
p.tabIndex initial value: -1
|
||||||
|
h1.tabIndex initial value: -1
|
||||||
|
a.tabIndex initial value: 0
|
||||||
|
area.tabIndex initial value: 0
|
||||||
|
button.tabIndex initial value: 0
|
||||||
|
frame.tabIndex initial value: 0
|
||||||
|
iframe.tabIndex initial value: 0
|
||||||
|
input.tabIndex initial value: 0
|
||||||
|
object.tabIndex initial value: 0
|
||||||
|
select.tabIndex initial value: 0
|
||||||
|
textarea.tabIndex initial value: 0
|
||||||
|
svg.a.tabIndex initial value: 0
|
41
Tests/LibWeb/Text/input/HTML/tabIndex-attribute.html
Normal file
41
Tests/LibWeb/Text/input/HTML/tabIndex-attribute.html
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<script src="../include.js"></script>
|
||||||
|
<script>
|
||||||
|
function tabIndexTest(tagName, element) {
|
||||||
|
println(`${tagName}.tabIndex initial value: ${element.tabIndex}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
test(() => {
|
||||||
|
const controlTagNamesToTest = [
|
||||||
|
"p",
|
||||||
|
"h1",
|
||||||
|
];
|
||||||
|
const tagNamesToTest = [
|
||||||
|
"a",
|
||||||
|
"area",
|
||||||
|
"button",
|
||||||
|
"frame",
|
||||||
|
"iframe",
|
||||||
|
"input",
|
||||||
|
"object",
|
||||||
|
"select",
|
||||||
|
"textarea",
|
||||||
|
];
|
||||||
|
const svgTagNamesToTest = [
|
||||||
|
"a",
|
||||||
|
];
|
||||||
|
|
||||||
|
for (const tagName of controlTagNamesToTest) {
|
||||||
|
const element = document.createElement(tagName);
|
||||||
|
tabIndexTest(tagName, element);
|
||||||
|
}
|
||||||
|
for (const tagName of tagNamesToTest) {
|
||||||
|
const element = document.createElement(tagName);
|
||||||
|
tabIndexTest(tagName, element);
|
||||||
|
}
|
||||||
|
for (const tagName of svgTagNamesToTest) {
|
||||||
|
const element = document.createElementNS("http://www.w3.org/2000/svg", tagName);
|
||||||
|
tabIndexTest(`svg.${tagName}`, element);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -1184,7 +1184,6 @@ i32 Element::default_tab_index_value() const
|
||||||
// The default value is 0 if the element is an a, area, button, frame, iframe, input, object, select, textarea, or SVG a element, or is a summary element that is a summary for its parent details.
|
// The default value is 0 if the element is an a, area, button, frame, iframe, input, object, select, textarea, or SVG a element, or is a summary element that is a summary for its parent details.
|
||||||
// The default value is −1 otherwise.
|
// The default value is −1 otherwise.
|
||||||
// Note: The varying default value based on element type is a historical artifact.
|
// Note: The varying default value based on element type is a historical artifact.
|
||||||
// FIXME: We currently do not have the SVG a element.
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,13 @@ void SVGAElement::attribute_changed(FlyString const& name, Optional<String> cons
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex
|
||||||
|
i32 SVGAElement::default_tab_index_value() const
|
||||||
|
{
|
||||||
|
// See the base function for the spec comments.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// https://svgwg.org/svg2-draft/linking.html#__svg__SVGAElement__relList
|
// https://svgwg.org/svg2-draft/linking.html#__svg__SVGAElement__relList
|
||||||
JS::NonnullGCPtr<DOM::DOMTokenList> SVGAElement::rel_list()
|
JS::NonnullGCPtr<DOM::DOMTokenList> SVGAElement::rel_list()
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,6 +33,7 @@ private:
|
||||||
|
|
||||||
// ^DOM::Element
|
// ^DOM::Element
|
||||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||||
|
virtual i32 default_tab_index_value() const override;
|
||||||
|
|
||||||
JS::GCPtr<DOM::DOMTokenList> m_rel_list;
|
JS::GCPtr<DOM::DOMTokenList> m_rel_list;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue