mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
LibWeb: Add the search element
This commit is contained in:
parent
866609c682
commit
f09ed59351
Notes:
github-actions[bot]
2024-11-19 23:59:54 +00:00
Author: https://github.com/Psychpsyo Commit: https://github.com/LadybirdBrowser/ladybird/commit/f09ed593519 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2444 Reviewed-by: https://github.com/tcl3 ✅ Reviewed-by: https://github.com/trflynn89
6 changed files with 12 additions and 9 deletions
|
@ -405,7 +405,7 @@ nobr wbr {
|
|||
|
||||
address, blockquote, center, div, figure, figcaption, footer, form, header, hr,
|
||||
legend, listing, main, p, plaintext, pre, summary, xmp, article, aside, h1, h2,
|
||||
h3, h4, h5, h6, hgroup, nav, section, table, caption, colgroup, col, thead,
|
||||
h3, h4, h5, h6, hgroup, nav, search, section, table, caption, colgroup, col, thead,
|
||||
tbody, tfoot, tr, td, th, dir, dd, dl, dt, menu, ol, ul, li, bdi, output,
|
||||
[dir=ltr i], [dir=rtl i], [dir=auto i] {
|
||||
unicode-bidi: isolate;
|
||||
|
|
|
@ -244,7 +244,7 @@ ErrorOr<FixedArray<FlyString>> valid_local_names_for_given_html_element_interfac
|
|||
if (html_element_interface_name == "HTMLVideoElement"sv)
|
||||
return FixedArray<FlyString>::create({ HTML::TagNames::video });
|
||||
if (html_element_interface_name == "HTMLElement"sv)
|
||||
return FixedArray<FlyString>::create({ HTML::TagNames::article, HTML::TagNames::section, HTML::TagNames::nav, HTML::TagNames::aside, HTML::TagNames::hgroup, HTML::TagNames::header, HTML::TagNames::footer, HTML::TagNames::address, HTML::TagNames::dt, HTML::TagNames::dd, HTML::TagNames::figure, HTML::TagNames::figcaption, HTML::TagNames::main, HTML::TagNames::em, HTML::TagNames::strong, HTML::TagNames::small, HTML::TagNames::s, HTML::TagNames::cite, HTML::TagNames::dfn, HTML::TagNames::abbr, HTML::TagNames::ruby, HTML::TagNames::rt, HTML::TagNames::rp, HTML::TagNames::code, HTML::TagNames::var, HTML::TagNames::samp, HTML::TagNames::kbd, HTML::TagNames::sub, HTML::TagNames::sup, HTML::TagNames::i, HTML::TagNames::b, HTML::TagNames::u, HTML::TagNames::mark, HTML::TagNames::bdi, HTML::TagNames::bdo, HTML::TagNames::wbr, HTML::TagNames::summary, HTML::TagNames::noscript, HTML::TagNames::acronym, HTML::TagNames::basefont, HTML::TagNames::big, HTML::TagNames::center, HTML::TagNames::nobr, HTML::TagNames::noembed, HTML::TagNames::noframes, HTML::TagNames::plaintext, HTML::TagNames::rb, HTML::TagNames::rtc, HTML::TagNames::strike, HTML::TagNames::tt });
|
||||
return FixedArray<FlyString>::create({ HTML::TagNames::article, HTML::TagNames::search, HTML::TagNames::section, HTML::TagNames::nav, HTML::TagNames::aside, HTML::TagNames::hgroup, HTML::TagNames::header, HTML::TagNames::footer, HTML::TagNames::address, HTML::TagNames::dt, HTML::TagNames::dd, HTML::TagNames::figure, HTML::TagNames::figcaption, HTML::TagNames::main, HTML::TagNames::em, HTML::TagNames::strong, HTML::TagNames::small, HTML::TagNames::s, HTML::TagNames::cite, HTML::TagNames::dfn, HTML::TagNames::abbr, HTML::TagNames::ruby, HTML::TagNames::rt, HTML::TagNames::rp, HTML::TagNames::code, HTML::TagNames::var, HTML::TagNames::samp, HTML::TagNames::kbd, HTML::TagNames::sub, HTML::TagNames::sup, HTML::TagNames::i, HTML::TagNames::b, HTML::TagNames::u, HTML::TagNames::mark, HTML::TagNames::bdi, HTML::TagNames::bdo, HTML::TagNames::wbr, HTML::TagNames::summary, HTML::TagNames::noscript, HTML::TagNames::acronym, HTML::TagNames::basefont, HTML::TagNames::big, HTML::TagNames::center, HTML::TagNames::nobr, HTML::TagNames::noembed, HTML::TagNames::noframes, HTML::TagNames::plaintext, HTML::TagNames::rb, HTML::TagNames::rtc, HTML::TagNames::strike, HTML::TagNames::tt });
|
||||
return FixedArray<FlyString>::create({});
|
||||
}
|
||||
|
||||
|
@ -420,7 +420,7 @@ static GC::Ref<Element> create_html_element(JS::Realm& realm, Document& document
|
|||
if (tag_name == HTML::TagNames::video)
|
||||
return realm.create<HTML::HTMLVideoElement>(document, move(qualified_name));
|
||||
if (tag_name.is_one_of(
|
||||
HTML::TagNames::article, HTML::TagNames::section, HTML::TagNames::nav, HTML::TagNames::aside, HTML::TagNames::hgroup, HTML::TagNames::header, HTML::TagNames::footer, HTML::TagNames::address, HTML::TagNames::dt, HTML::TagNames::dd, HTML::TagNames::figure, HTML::TagNames::figcaption, HTML::TagNames::main, HTML::TagNames::em, HTML::TagNames::strong, HTML::TagNames::small, HTML::TagNames::s, HTML::TagNames::cite, HTML::TagNames::dfn, HTML::TagNames::abbr, HTML::TagNames::ruby, HTML::TagNames::rt, HTML::TagNames::rp, HTML::TagNames::code, HTML::TagNames::var, HTML::TagNames::samp, HTML::TagNames::kbd, HTML::TagNames::sub, HTML::TagNames::sup, HTML::TagNames::i, HTML::TagNames::b, HTML::TagNames::u, HTML::TagNames::mark, HTML::TagNames::bdi, HTML::TagNames::bdo, HTML::TagNames::wbr, HTML::TagNames::noscript,
|
||||
HTML::TagNames::article, HTML::TagNames::search, HTML::TagNames::section, HTML::TagNames::nav, HTML::TagNames::aside, HTML::TagNames::hgroup, HTML::TagNames::header, HTML::TagNames::footer, HTML::TagNames::address, HTML::TagNames::dt, HTML::TagNames::dd, HTML::TagNames::figure, HTML::TagNames::figcaption, HTML::TagNames::main, HTML::TagNames::em, HTML::TagNames::strong, HTML::TagNames::small, HTML::TagNames::s, HTML::TagNames::cite, HTML::TagNames::dfn, HTML::TagNames::abbr, HTML::TagNames::ruby, HTML::TagNames::rt, HTML::TagNames::rp, HTML::TagNames::code, HTML::TagNames::var, HTML::TagNames::samp, HTML::TagNames::kbd, HTML::TagNames::sub, HTML::TagNames::sup, HTML::TagNames::i, HTML::TagNames::b, HTML::TagNames::u, HTML::TagNames::mark, HTML::TagNames::bdi, HTML::TagNames::bdo, HTML::TagNames::wbr, HTML::TagNames::noscript,
|
||||
// Obsolete
|
||||
HTML::TagNames::acronym, HTML::TagNames::basefont, HTML::TagNames::big, HTML::TagNames::center, HTML::TagNames::nobr, HTML::TagNames::noembed, HTML::TagNames::noframes, HTML::TagNames::plaintext, HTML::TagNames::rb, HTML::TagNames::rtc, HTML::TagNames::strike, HTML::TagNames::tt))
|
||||
return realm.create<HTML::HTMLElement>(document, move(qualified_name));
|
||||
|
|
|
@ -775,6 +775,9 @@ Optional<ARIA::Role> HTMLElement::default_role() const
|
|||
// https://www.w3.org/TR/html-aria/#el-samp
|
||||
if (local_name() == TagNames::samp)
|
||||
return ARIA::Role::generic;
|
||||
// https://www.w3.org/TR/html-aria/#el-search
|
||||
if (local_name() == TagNames::search)
|
||||
return ARIA::Role::search;
|
||||
// https://www.w3.org/TR/html-aria/#el-section
|
||||
if (local_name() == TagNames::section) {
|
||||
// TODO: role=region if the section element has an accessible name
|
||||
|
|
|
@ -1932,7 +1932,7 @@ void HTMLParser::handle_in_body(HTMLToken& token)
|
|||
}
|
||||
|
||||
// -> A start tag whose tag name is one of: "address", "article", "aside", "blockquote", "center", "details", "dialog", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "main", "menu", "nav", "ol", "p", "search", "section", "summary", "ul"
|
||||
if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::address, HTML::TagNames::article, HTML::TagNames::aside, HTML::TagNames::blockquote, HTML::TagNames::center, HTML::TagNames::details, HTML::TagNames::dialog, HTML::TagNames::dir, HTML::TagNames::div, HTML::TagNames::dl, HTML::TagNames::fieldset, HTML::TagNames::figcaption, HTML::TagNames::figure, HTML::TagNames::footer, HTML::TagNames::header, HTML::TagNames::hgroup, HTML::TagNames::main, HTML::TagNames::menu, HTML::TagNames::nav, HTML::TagNames::ol, HTML::TagNames::p, HTML::TagNames::section, HTML::TagNames::summary, HTML::TagNames::ul)) {
|
||||
if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::address, HTML::TagNames::article, HTML::TagNames::aside, HTML::TagNames::blockquote, HTML::TagNames::center, HTML::TagNames::details, HTML::TagNames::dialog, HTML::TagNames::dir, HTML::TagNames::div, HTML::TagNames::dl, HTML::TagNames::fieldset, HTML::TagNames::figcaption, HTML::TagNames::figure, HTML::TagNames::footer, HTML::TagNames::header, HTML::TagNames::hgroup, HTML::TagNames::main, HTML::TagNames::menu, HTML::TagNames::nav, HTML::TagNames::ol, HTML::TagNames::p, HTML::TagNames::search, HTML::TagNames::section, HTML::TagNames::summary, HTML::TagNames::ul)) {
|
||||
// If the stack of open elements has a p element in button scope, then close a p element.
|
||||
if (m_stack_of_open_elements.has_in_button_scope(HTML::TagNames::p))
|
||||
close_a_p_element();
|
||||
|
@ -2139,7 +2139,7 @@ void HTMLParser::handle_in_body(HTMLToken& token)
|
|||
}
|
||||
|
||||
// -> An end tag whose tag name is one of: "address", "article", "aside", "blockquote", "button", "center", "details", "dialog", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "listing", "main", "menu", "nav", "ol", "pre", "search", "section", "summary", "ul"
|
||||
if (token.is_end_tag() && token.tag_name().is_one_of(HTML::TagNames::address, HTML::TagNames::article, HTML::TagNames::aside, HTML::TagNames::blockquote, HTML::TagNames::button, HTML::TagNames::center, HTML::TagNames::details, HTML::TagNames::dialog, HTML::TagNames::dir, HTML::TagNames::div, HTML::TagNames::dl, HTML::TagNames::fieldset, HTML::TagNames::figcaption, HTML::TagNames::figure, HTML::TagNames::footer, HTML::TagNames::header, HTML::TagNames::hgroup, HTML::TagNames::listing, HTML::TagNames::main, HTML::TagNames::menu, HTML::TagNames::nav, HTML::TagNames::ol, HTML::TagNames::pre, HTML::TagNames::section, HTML::TagNames::summary, HTML::TagNames::ul)) {
|
||||
if (token.is_end_tag() && token.tag_name().is_one_of(HTML::TagNames::address, HTML::TagNames::article, HTML::TagNames::aside, HTML::TagNames::blockquote, HTML::TagNames::button, HTML::TagNames::center, HTML::TagNames::details, HTML::TagNames::dialog, HTML::TagNames::dir, HTML::TagNames::div, HTML::TagNames::dl, HTML::TagNames::fieldset, HTML::TagNames::figcaption, HTML::TagNames::figure, HTML::TagNames::footer, HTML::TagNames::header, HTML::TagNames::hgroup, HTML::TagNames::listing, HTML::TagNames::main, HTML::TagNames::menu, HTML::TagNames::nav, HTML::TagNames::ol, HTML::TagNames::pre, HTML::TagNames::search, HTML::TagNames::section, HTML::TagNames::summary, HTML::TagNames::ul)) {
|
||||
// If the stack of open elements does not have an element in scope that is an HTML element with the same tag name as that of the token, then this is a parse error; ignore the token.
|
||||
if (!m_stack_of_open_elements.has_in_scope(token.tag_name())) {
|
||||
log_parse_error();
|
||||
|
|
|
@ -123,6 +123,7 @@ namespace Web::HTML::TagNames {
|
|||
__ENUMERATE_HTML_TAG(s) \
|
||||
__ENUMERATE_HTML_TAG(samp) \
|
||||
__ENUMERATE_HTML_TAG(script) \
|
||||
__ENUMERATE_HTML_TAG(search) \
|
||||
__ENUMERATE_HTML_TAG(section) \
|
||||
__ENUMERATE_HTML_TAG(select) \
|
||||
__ENUMERATE_HTML_TAG(slot) \
|
||||
|
|
|
@ -6,9 +6,8 @@ Rerun
|
|||
|
||||
Found 3 tests
|
||||
|
||||
1 Pass
|
||||
2 Fail
|
||||
3 Pass
|
||||
Details
|
||||
Result Test Name MessageFail html5lib_search-element.html 114b9f3c8147c0ed8ef3ed1811a9da3f10d74402
|
||||
Fail html5lib_search-element.html 2204afb9037ec886f428ab5dcead5ee9f87c65cb
|
||||
Result Test Name MessagePass html5lib_search-element.html 114b9f3c8147c0ed8ef3ed1811a9da3f10d74402
|
||||
Pass html5lib_search-element.html 2204afb9037ec886f428ab5dcead5ee9f87c65cb
|
||||
Pass html5lib_search-element.html 5153f797fbb63a23a40d19e298aca06d53d22f7f
|
Loading…
Reference in a new issue