LibWeb: Make HTML parser "current node" APIs return nullable pointer

It's actually possible for there to be no adjusted current node, when
the stack of open elements is empty. This was covered by one of the WPT
parsing tests.
This commit is contained in:
Andreas Kling 2024-11-03 19:50:13 +01:00 committed by Andreas Kling
commit 64747c0397
Notes: github-actions[bot] 2024-11-03 19:33:21 +00:00
5 changed files with 117 additions and 78 deletions

View file

@ -148,9 +148,9 @@ private:
};
JS::NonnullGCPtr<DOM::Element> insert_foreign_element(HTMLToken const&, Optional<FlyString> const& namespace_, OnlyAddToElementStack);
JS::NonnullGCPtr<DOM::Element> insert_html_element(HTMLToken const&);
DOM::Element& current_node();
DOM::Element& adjusted_current_node();
DOM::Element& node_before_current_node();
[[nodiscard]] JS::GCPtr<DOM::Element> current_node();
[[nodiscard]] JS::GCPtr<DOM::Element> adjusted_current_node();
[[nodiscard]] JS::GCPtr<DOM::Element> node_before_current_node();
void insert_character(u32 data);
void insert_comment(HTMLToken&);
void reconstruct_the_active_formatting_elements();