mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-28 23:39:02 +00:00
LibWeb: Implement "select" portion of reset_the_insertion_mode_appropriately
Required by Dromaeo. With this, it no longer crashes.
This commit is contained in:
parent
a9fa3fb095
commit
d215578f55
Notes:
sideshowbarker
2024-07-18 20:40:18 +09:00
Author: https://github.com/Lubrsi
Commit: d215578f55
Pull-request: https://github.com/SerenityOS/serenity/pull/6164
1 changed files with 18 additions and 1 deletions
|
@ -38,6 +38,7 @@
|
|||
#include <LibWeb/HTML/HTMLFormElement.h>
|
||||
#include <LibWeb/HTML/HTMLHeadElement.h>
|
||||
#include <LibWeb/HTML/HTMLScriptElement.h>
|
||||
#include <LibWeb/HTML/HTMLTableElement.h>
|
||||
#include <LibWeb/HTML/HTMLTemplateElement.h>
|
||||
#include <LibWeb/HTML/Parser/HTMLDocumentParser.h>
|
||||
#include <LibWeb/HTML/Parser/HTMLToken.h>
|
||||
|
@ -2890,6 +2891,7 @@ void HTMLDocumentParser::process_using_the_rules_for_foreign_content(HTMLToken&
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/parsing.html#reset-the-insertion-mode-appropriately
|
||||
void HTMLDocumentParser::reset_the_insertion_mode_appropriately()
|
||||
{
|
||||
for (ssize_t i = m_stack_of_open_elements.elements().size() - 1; i >= 0; --i) {
|
||||
|
@ -2903,7 +2905,22 @@ void HTMLDocumentParser::reset_the_insertion_mode_appropriately()
|
|||
}
|
||||
|
||||
if (node->local_name() == HTML::TagNames::select) {
|
||||
TODO();
|
||||
if (!last) {
|
||||
for (ssize_t j = i; j > 0; --j) {
|
||||
auto& ancestor = m_stack_of_open_elements.elements().at(j - 1);
|
||||
|
||||
if (is<HTMLTemplateElement>(ancestor))
|
||||
break;
|
||||
|
||||
if (is<HTMLTableElement>(ancestor)) {
|
||||
m_insertion_mode = InsertionMode::InSelectInTable;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_insertion_mode = InsertionMode::InSelect;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!last && node->local_name().is_one_of(HTML::TagNames::td, HTML::TagNames::th)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue