mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 21:22:46 +00:00 
			
		
		
		
	LibWeb: Rename HTMLDocumentParser => HTMLParser
This commit is contained in:
		
							parent
							
								
									0ee457dfdf
								
							
						
					
					
						commit
						f67648f872
					
				
					 18 changed files with 106 additions and 106 deletions
				
			
		|  | @ -11,7 +11,7 @@ | |||
| #include <LibGUI/Window.h> | ||||
| #include <LibTest/JavaScriptTestRunner.h> | ||||
| #include <LibWeb/Bindings/MainThreadVM.h> | ||||
| #include <LibWeb/HTML/Parser/HTMLDocumentParser.h> | ||||
| #include <LibWeb/HTML/Parser/HTMLParser.h> | ||||
| #include <LibWeb/InProcessWebView.h> | ||||
| #include <LibWeb/Loader/ResourceLoader.h> | ||||
| 
 | ||||
|  | @ -103,7 +103,7 @@ TESTJS_GLOBAL_FUNCTION(wait_for_page_to_load, waitForPageToLoad) | |||
|     loader.load_sync( | ||||
|         request, | ||||
|         [&](auto data, auto&, auto) { | ||||
|             Web::HTML::HTMLDocumentParser parser(document, data, "utf-8"); | ||||
|             Web::HTML::HTMLParser parser(document, data, "utf-8"); | ||||
|             // Now parse the HTML page.
 | ||||
|             parser.run(next_page_to_load.value()); | ||||
|             g_page_view->set_document(&parser.document()); | ||||
|  |  | |||
|  | @ -156,8 +156,8 @@ set(SOURCES | |||
|     HTML/MessageChannel.cpp | ||||
|     HTML/MessagePort.cpp | ||||
|     HTML/Parser/Entities.cpp | ||||
|     HTML/Parser/HTMLDocumentParser.cpp | ||||
|     HTML/Parser/HTMLEncodingDetection.cpp | ||||
|     HTML/Parser/HTMLParser.cpp | ||||
|     HTML/Parser/HTMLToken.cpp | ||||
|     HTML/Parser/HTMLTokenizer.cpp | ||||
|     HTML/Parser/ListOfActiveFormattingElements.cpp | ||||
|  |  | |||
|  | @ -782,7 +782,7 @@ void Document::set_pending_parsing_blocking_script(Badge<HTML::HTMLScriptElement | |||
|     m_pending_parsing_blocking_script = script; | ||||
| } | ||||
| 
 | ||||
| NonnullRefPtr<HTML::HTMLScriptElement> Document::take_pending_parsing_blocking_script(Badge<HTML::HTMLDocumentParser>) | ||||
| NonnullRefPtr<HTML::HTMLScriptElement> Document::take_pending_parsing_blocking_script(Badge<HTML::HTMLParser>) | ||||
| { | ||||
|     return m_pending_parsing_blocking_script.release_nonnull(); | ||||
| } | ||||
|  | @ -792,7 +792,7 @@ void Document::add_script_to_execute_when_parsing_has_finished(Badge<HTML::HTMLS | |||
|     m_scripts_to_execute_when_parsing_has_finished.append(script); | ||||
| } | ||||
| 
 | ||||
| NonnullRefPtrVector<HTML::HTMLScriptElement> Document::take_scripts_to_execute_when_parsing_has_finished(Badge<HTML::HTMLDocumentParser>) | ||||
| NonnullRefPtrVector<HTML::HTMLScriptElement> Document::take_scripts_to_execute_when_parsing_has_finished(Badge<HTML::HTMLParser>) | ||||
| { | ||||
|     return move(m_scripts_to_execute_when_parsing_has_finished); | ||||
| } | ||||
|  | @ -802,7 +802,7 @@ void Document::add_script_to_execute_as_soon_as_possible(Badge<HTML::HTMLScriptE | |||
|     m_scripts_to_execute_as_soon_as_possible.append(script); | ||||
| } | ||||
| 
 | ||||
| NonnullRefPtrVector<HTML::HTMLScriptElement> Document::take_scripts_to_execute_as_soon_as_possible(Badge<HTML::HTMLDocumentParser>) | ||||
| NonnullRefPtrVector<HTML::HTMLScriptElement> Document::take_scripts_to_execute_as_soon_as_possible(Badge<HTML::HTMLParser>) | ||||
| { | ||||
|     return move(m_scripts_to_execute_as_soon_as_possible); | ||||
| } | ||||
|  |  | |||
|  | @ -187,13 +187,13 @@ public: | |||
| 
 | ||||
|     void set_pending_parsing_blocking_script(Badge<HTML::HTMLScriptElement>, HTML::HTMLScriptElement*); | ||||
|     HTML::HTMLScriptElement* pending_parsing_blocking_script() { return m_pending_parsing_blocking_script; } | ||||
|     NonnullRefPtr<HTML::HTMLScriptElement> take_pending_parsing_blocking_script(Badge<HTML::HTMLDocumentParser>); | ||||
|     NonnullRefPtr<HTML::HTMLScriptElement> take_pending_parsing_blocking_script(Badge<HTML::HTMLParser>); | ||||
| 
 | ||||
|     void add_script_to_execute_when_parsing_has_finished(Badge<HTML::HTMLScriptElement>, HTML::HTMLScriptElement&); | ||||
|     NonnullRefPtrVector<HTML::HTMLScriptElement> take_scripts_to_execute_when_parsing_has_finished(Badge<HTML::HTMLDocumentParser>); | ||||
|     NonnullRefPtrVector<HTML::HTMLScriptElement> take_scripts_to_execute_when_parsing_has_finished(Badge<HTML::HTMLParser>); | ||||
| 
 | ||||
|     void add_script_to_execute_as_soon_as_possible(Badge<HTML::HTMLScriptElement>, HTML::HTMLScriptElement&); | ||||
|     NonnullRefPtrVector<HTML::HTMLScriptElement> take_scripts_to_execute_as_soon_as_possible(Badge<HTML::HTMLDocumentParser>); | ||||
|     NonnullRefPtrVector<HTML::HTMLScriptElement> take_scripts_to_execute_as_soon_as_possible(Badge<HTML::HTMLParser>); | ||||
|     NonnullRefPtrVector<HTML::HTMLScriptElement>& scripts_to_execute_as_soon_as_possible() { return m_scripts_to_execute_as_soon_as_possible; } | ||||
| 
 | ||||
|     QuirksMode mode() const { return m_quirks_mode; } | ||||
|  |  | |||
|  | @ -19,7 +19,7 @@ | |||
| #include <LibWeb/DOM/Text.h> | ||||
| #include <LibWeb/DOMParsing/InnerHTML.h> | ||||
| #include <LibWeb/HTML/EventLoop/EventLoop.h> | ||||
| #include <LibWeb/HTML/Parser/HTMLDocumentParser.h> | ||||
| #include <LibWeb/HTML/Parser/HTMLParser.h> | ||||
| #include <LibWeb/Layout/BlockBox.h> | ||||
| #include <LibWeb/Layout/InlineNode.h> | ||||
| #include <LibWeb/Layout/ListItemBox.h> | ||||
|  |  | |||
|  | @ -24,7 +24,7 @@ | |||
| #include <LibWeb/DOM/ProcessingInstruction.h> | ||||
| #include <LibWeb/DOM/ShadowRoot.h> | ||||
| #include <LibWeb/HTML/HTMLAnchorElement.h> | ||||
| #include <LibWeb/HTML/Parser/HTMLDocumentParser.h> | ||||
| #include <LibWeb/HTML/Parser/HTMLParser.h> | ||||
| #include <LibWeb/Layout/InitialContainingBlock.h> | ||||
| #include <LibWeb/Layout/Node.h> | ||||
| #include <LibWeb/Layout/TextNode.h> | ||||
|  | @ -771,7 +771,7 @@ String Node::serialize_fragment(/* FIXME: Requires well-formed flag */) const | |||
| 
 | ||||
|     // FIXME: If context document is an HTML document, return an HTML serialization of node.
 | ||||
|     //        (We currently always do this)
 | ||||
|     return HTML::HTMLDocumentParser::serialize_html_fragment(*this); | ||||
|     return HTML::HTMLParser::serialize_html_fragment(*this); | ||||
| 
 | ||||
|     // FIXME: Otherwise, context document is an XML document; return an XML serialization of node passing the flag require well-formed.
 | ||||
| } | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ | |||
| 
 | ||||
| #include <LibWeb/DOM/DocumentFragment.h> | ||||
| #include <LibWeb/DOM/ExceptionOr.h> | ||||
| #include <LibWeb/HTML/Parser/HTMLDocumentParser.h> | ||||
| #include <LibWeb/HTML/Parser/HTMLParser.h> | ||||
| 
 | ||||
| namespace Web::DOMParsing { | ||||
| 
 | ||||
|  | @ -17,7 +17,7 @@ static DOM::ExceptionOr<NonnullRefPtr<DOM::DocumentFragment>> parse_fragment(Str | |||
| { | ||||
|     // FIXME: Handle XML documents.
 | ||||
| 
 | ||||
|     auto new_children = HTML::HTMLDocumentParser::parse_html_fragment(context_element, markup); | ||||
|     auto new_children = HTML::HTMLParser::parse_html_fragment(context_element, markup); | ||||
|     auto fragment = make_ref_counted<DOM::DocumentFragment>(context_element.document()); | ||||
| 
 | ||||
|     for (auto& child : new_children) { | ||||
|  |  | |||
|  | @ -111,7 +111,7 @@ class HTMLDialogElement; | |||
| class HTMLDirectoryElement; | ||||
| class HTMLDivElement; | ||||
| class HTMLDListElement; | ||||
| class HTMLDocumentParser; | ||||
| class HTMLParser; | ||||
| class HTMLElement; | ||||
| class HTMLEmbedElement; | ||||
| class HTMLFieldSetElement; | ||||
|  |  | |||
|  | @ -5,7 +5,7 @@ | |||
|  */ | ||||
| 
 | ||||
| #include <LibWeb/HTML/DOMParser.h> | ||||
| #include <LibWeb/HTML/Parser/HTMLDocumentParser.h> | ||||
| #include <LibWeb/HTML/Parser/HTMLParser.h> | ||||
| 
 | ||||
| namespace Web::HTML { | ||||
| 
 | ||||
|  | @ -27,7 +27,7 @@ NonnullRefPtr<DOM::Document> DOMParser::parse_from_string(String const& string, | |||
|     // NOTE: This isn't a case insensitive match since the DOMParserSupportedType enum enforces an all lowercase type.
 | ||||
|     if (type == "text/html") { | ||||
|         // FIXME: Set document's type to "html".
 | ||||
|         HTMLDocumentParser parser(document, string, "UTF-8"); | ||||
|         HTMLParser parser(document, string, "UTF-8"); | ||||
|         // FIXME: This is to match the default URL. Instead, pass in this's relevant global object's associated Document's URL.
 | ||||
|         parser.run("about:blank"); | ||||
|     } else { | ||||
|  |  | |||
|  | @ -31,12 +31,12 @@ HTMLScriptElement::~HTMLScriptElement() | |||
| { | ||||
| } | ||||
| 
 | ||||
| void HTMLScriptElement::set_parser_document(Badge<HTMLDocumentParser>, DOM::Document& document) | ||||
| void HTMLScriptElement::set_parser_document(Badge<HTMLParser>, DOM::Document& document) | ||||
| { | ||||
|     m_parser_document = document; | ||||
| } | ||||
| 
 | ||||
| void HTMLScriptElement::set_non_blocking(Badge<HTMLDocumentParser>, bool non_blocking) | ||||
| void HTMLScriptElement::set_non_blocking(Badge<HTMLParser>, bool non_blocking) | ||||
| { | ||||
|     m_non_blocking = non_blocking; | ||||
| } | ||||
|  |  | |||
|  | @ -23,10 +23,10 @@ public: | |||
|     bool is_ready_to_be_parser_executed() const { return m_ready_to_be_parser_executed; } | ||||
|     bool failed_to_load() const { return m_failed_to_load; } | ||||
| 
 | ||||
|     void set_parser_document(Badge<HTMLDocumentParser>, DOM::Document&); | ||||
|     void set_non_blocking(Badge<HTMLDocumentParser>, bool); | ||||
|     void set_already_started(Badge<HTMLDocumentParser>, bool b) { m_already_started = b; } | ||||
|     void prepare_script(Badge<HTMLDocumentParser>) { prepare_script(); } | ||||
|     void set_parser_document(Badge<HTMLParser>, DOM::Document&); | ||||
|     void set_non_blocking(Badge<HTMLParser>, bool); | ||||
|     void set_already_started(Badge<HTMLParser>, bool b) { m_already_started = b; } | ||||
|     void prepare_script(Badge<HTMLParser>) { prepare_script(); } | ||||
|     void execute_script(); | ||||
| 
 | ||||
|     bool is_parser_inserted() const { return !!m_parser_document; } | ||||
|  |  | |||
|  | @ -24,8 +24,8 @@ | |||
| #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/HTMLEncodingDetection.h> | ||||
| #include <LibWeb/HTML/Parser/HTMLParser.h> | ||||
| #include <LibWeb/HTML/Parser/HTMLToken.h> | ||||
| #include <LibWeb/Namespace.h> | ||||
| #include <LibWeb/SVG/TagNames.h> | ||||
|  | @ -121,12 +121,12 @@ static bool is_html_integration_point(DOM::Element const& element) | |||
| RefPtr<DOM::Document> parse_html_document(const StringView& data, const AK::URL& url, const String& encoding) | ||||
| { | ||||
|     auto document = DOM::Document::create(url); | ||||
|     HTMLDocumentParser parser(document, data, encoding); | ||||
|     HTMLParser parser(document, data, encoding); | ||||
|     parser.run(url); | ||||
|     return document; | ||||
| } | ||||
| 
 | ||||
| HTMLDocumentParser::HTMLDocumentParser(DOM::Document& document, const StringView& input, const String& encoding) | ||||
| HTMLParser::HTMLParser(DOM::Document& document, const StringView& input, const String& encoding) | ||||
|     : m_tokenizer(input, encoding) | ||||
|     , m_document(document) | ||||
| { | ||||
|  | @ -136,12 +136,12 @@ HTMLDocumentParser::HTMLDocumentParser(DOM::Document& document, const StringView | |||
|     m_document->set_encoding(standardized_encoding.value()); | ||||
| } | ||||
| 
 | ||||
| HTMLDocumentParser::~HTMLDocumentParser() | ||||
| HTMLParser::~HTMLParser() | ||||
| { | ||||
|     m_document->set_should_invalidate_styles_on_attribute_changes(true); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::run(const AK::URL& url) | ||||
| void HTMLParser::run(const AK::URL& url) | ||||
| { | ||||
|     m_document->set_url(url); | ||||
|     m_document->set_source(m_tokenizer.source()); | ||||
|  | @ -210,7 +210,7 @@ void HTMLDocumentParser::run(const AK::URL& url) | |||
|     m_document->completely_finish_loading(); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::process_using_the_rules_for(InsertionMode mode, HTMLToken& token) | ||||
| void HTMLParser::process_using_the_rules_for(InsertionMode mode, HTMLToken& token) | ||||
| { | ||||
|     switch (mode) { | ||||
|     case InsertionMode::Initial: | ||||
|  | @ -287,7 +287,7 @@ void HTMLDocumentParser::process_using_the_rules_for(InsertionMode mode, HTMLTok | |||
|     } | ||||
| } | ||||
| 
 | ||||
| DOM::QuirksMode HTMLDocumentParser::which_quirks_mode(const HTMLToken& doctype_token) const | ||||
| DOM::QuirksMode HTMLParser::which_quirks_mode(const HTMLToken& doctype_token) const | ||||
| { | ||||
|     if (doctype_token.doctype_data().force_quirks) | ||||
|         return DOM::QuirksMode::Yes; | ||||
|  | @ -341,7 +341,7 @@ DOM::QuirksMode HTMLDocumentParser::which_quirks_mode(const HTMLToken& doctype_t | |||
|     return DOM::QuirksMode::No; | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::handle_initial(HTMLToken& token) | ||||
| void HTMLParser::handle_initial(HTMLToken& token) | ||||
| { | ||||
|     if (token.is_character() && token.is_parser_whitespace()) { | ||||
|         return; | ||||
|  | @ -370,7 +370,7 @@ void HTMLDocumentParser::handle_initial(HTMLToken& token) | |||
|     process_using_the_rules_for(InsertionMode::BeforeHTML, token); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::handle_before_html(HTMLToken& token) | ||||
| void HTMLParser::handle_before_html(HTMLToken& token) | ||||
| { | ||||
|     if (token.is_doctype()) { | ||||
|         log_parse_error(); | ||||
|  | @ -414,12 +414,12 @@ AnythingElse: | |||
|     return; | ||||
| } | ||||
| 
 | ||||
| DOM::Element& HTMLDocumentParser::current_node() | ||||
| DOM::Element& HTMLParser::current_node() | ||||
| { | ||||
|     return m_stack_of_open_elements.current_node(); | ||||
| } | ||||
| 
 | ||||
| DOM::Element& HTMLDocumentParser::adjusted_current_node() | ||||
| DOM::Element& HTMLParser::adjusted_current_node() | ||||
| { | ||||
|     if (m_parsing_fragment && m_stack_of_open_elements.elements().size() == 1) | ||||
|         return *m_context_element; | ||||
|  | @ -427,15 +427,15 @@ DOM::Element& HTMLDocumentParser::adjusted_current_node() | |||
|     return current_node(); | ||||
| } | ||||
| 
 | ||||
| DOM::Element& HTMLDocumentParser::node_before_current_node() | ||||
| DOM::Element& HTMLParser::node_before_current_node() | ||||
| { | ||||
|     return m_stack_of_open_elements.elements().at(m_stack_of_open_elements.elements().size() - 2); | ||||
| } | ||||
| 
 | ||||
| HTMLDocumentParser::AdjustedInsertionLocation HTMLDocumentParser::find_appropriate_place_for_inserting_node() | ||||
| HTMLParser::AdjustedInsertionLocation HTMLParser::find_appropriate_place_for_inserting_node() | ||||
| { | ||||
|     auto& target = current_node(); | ||||
|     HTMLDocumentParser::AdjustedInsertionLocation adjusted_insertion_location; | ||||
|     HTMLParser::AdjustedInsertionLocation adjusted_insertion_location; | ||||
| 
 | ||||
|     if (m_foster_parenting && target.local_name().is_one_of(HTML::TagNames::table, HTML::TagNames::tbody, HTML::TagNames::tfoot, HTML::TagNames::thead, HTML::TagNames::tr)) { | ||||
|         auto last_template = m_stack_of_open_elements.last_element_with_tag_name(HTML::TagNames::template_); | ||||
|  | @ -464,7 +464,7 @@ HTMLDocumentParser::AdjustedInsertionLocation HTMLDocumentParser::find_appropria | |||
|     return adjusted_insertion_location; | ||||
| } | ||||
| 
 | ||||
| NonnullRefPtr<DOM::Element> HTMLDocumentParser::create_element_for(const HTMLToken& token, const FlyString& namespace_) | ||||
| NonnullRefPtr<DOM::Element> HTMLParser::create_element_for(const HTMLToken& token, const FlyString& namespace_) | ||||
| { | ||||
|     auto element = create_element(document(), token.tag_name(), namespace_); | ||||
|     token.for_each_attribute([&](auto& attribute) { | ||||
|  | @ -475,7 +475,7 @@ NonnullRefPtr<DOM::Element> HTMLDocumentParser::create_element_for(const HTMLTok | |||
| } | ||||
| 
 | ||||
| // https://html.spec.whatwg.org/multipage/parsing.html#insert-a-foreign-element
 | ||||
| NonnullRefPtr<DOM::Element> HTMLDocumentParser::insert_foreign_element(const HTMLToken& token, const FlyString& namespace_) | ||||
| NonnullRefPtr<DOM::Element> HTMLParser::insert_foreign_element(const HTMLToken& token, const FlyString& namespace_) | ||||
| { | ||||
|     auto adjusted_insertion_location = find_appropriate_place_for_inserting_node(); | ||||
| 
 | ||||
|  | @ -501,12 +501,12 @@ NonnullRefPtr<DOM::Element> HTMLDocumentParser::insert_foreign_element(const HTM | |||
|     return element; | ||||
| } | ||||
| 
 | ||||
| NonnullRefPtr<DOM::Element> HTMLDocumentParser::insert_html_element(const HTMLToken& token) | ||||
| NonnullRefPtr<DOM::Element> HTMLParser::insert_html_element(const HTMLToken& token) | ||||
| { | ||||
|     return insert_foreign_element(token, Namespace::HTML); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::handle_before_head(HTMLToken& token) | ||||
| void HTMLParser::handle_before_head(HTMLToken& token) | ||||
| { | ||||
|     if (token.is_character() && token.is_parser_whitespace()) { | ||||
|         return; | ||||
|  | @ -550,13 +550,13 @@ AnythingElse: | |||
|     return; | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::insert_comment(HTMLToken& token) | ||||
| void HTMLParser::insert_comment(HTMLToken& token) | ||||
| { | ||||
|     auto adjusted_insertion_location = find_appropriate_place_for_inserting_node(); | ||||
|     adjusted_insertion_location.parent->insert_before(adopt_ref(*new DOM::Comment(document(), token.comment())), adjusted_insertion_location.insert_before_sibling); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::handle_in_head(HTMLToken& token) | ||||
| void HTMLParser::handle_in_head(HTMLToken& token) | ||||
| { | ||||
|     if (token.is_parser_whitespace()) { | ||||
|         insert_character(token.code_point()); | ||||
|  | @ -681,7 +681,7 @@ AnythingElse: | |||
|     process_using_the_rules_for(m_insertion_mode, token); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::handle_in_head_noscript(HTMLToken& token) | ||||
| void HTMLParser::handle_in_head_noscript(HTMLToken& token) | ||||
| { | ||||
|     if (token.is_doctype()) { | ||||
|         log_parse_error(); | ||||
|  | @ -720,7 +720,7 @@ AnythingElse: | |||
|     process_using_the_rules_for(m_insertion_mode, token); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::parse_generic_raw_text_element(HTMLToken& token) | ||||
| void HTMLParser::parse_generic_raw_text_element(HTMLToken& token) | ||||
| { | ||||
|     insert_html_element(token); | ||||
|     m_tokenizer.switch_to({}, HTMLTokenizer::State::RAWTEXT); | ||||
|  | @ -728,7 +728,7 @@ void HTMLDocumentParser::parse_generic_raw_text_element(HTMLToken& token) | |||
|     m_insertion_mode = InsertionMode::Text; | ||||
| } | ||||
| 
 | ||||
| DOM::Text* HTMLDocumentParser::find_character_insertion_node() | ||||
| DOM::Text* HTMLParser::find_character_insertion_node() | ||||
| { | ||||
|     auto adjusted_insertion_location = find_appropriate_place_for_inserting_node(); | ||||
|     if (adjusted_insertion_location.insert_before_sibling) { | ||||
|  | @ -743,7 +743,7 @@ DOM::Text* HTMLDocumentParser::find_character_insertion_node() | |||
|     return new_text_node; | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::flush_character_insertions() | ||||
| void HTMLParser::flush_character_insertions() | ||||
| { | ||||
|     if (m_character_insertion_builder.is_empty()) | ||||
|         return; | ||||
|  | @ -752,7 +752,7 @@ void HTMLDocumentParser::flush_character_insertions() | |||
|     m_character_insertion_builder.clear(); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::insert_character(u32 data) | ||||
| void HTMLParser::insert_character(u32 data) | ||||
| { | ||||
|     auto node = find_character_insertion_node(); | ||||
|     if (node == m_character_insertion_node) { | ||||
|  | @ -769,7 +769,7 @@ void HTMLDocumentParser::insert_character(u32 data) | |||
|     m_character_insertion_builder.append(Utf32View { &data, 1 }); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::handle_after_head(HTMLToken& token) | ||||
| void HTMLParser::handle_after_head(HTMLToken& token) | ||||
| { | ||||
|     if (token.is_character() && token.is_parser_whitespace()) { | ||||
|         insert_character(token.code_point()); | ||||
|  | @ -834,19 +834,19 @@ AnythingElse: | |||
|     process_using_the_rules_for(m_insertion_mode, token); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::generate_implied_end_tags(const FlyString& exception) | ||||
| void HTMLParser::generate_implied_end_tags(const FlyString& exception) | ||||
| { | ||||
|     while (current_node().local_name() != exception && current_node().local_name().is_one_of(HTML::TagNames::dd, HTML::TagNames::dt, HTML::TagNames::li, HTML::TagNames::optgroup, HTML::TagNames::option, HTML::TagNames::p, HTML::TagNames::rb, HTML::TagNames::rp, HTML::TagNames::rt, HTML::TagNames::rtc)) | ||||
|         m_stack_of_open_elements.pop(); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::generate_all_implied_end_tags_thoroughly() | ||||
| void HTMLParser::generate_all_implied_end_tags_thoroughly() | ||||
| { | ||||
|     while (current_node().local_name().is_one_of(HTML::TagNames::caption, HTML::TagNames::colgroup, HTML::TagNames::dd, HTML::TagNames::dt, HTML::TagNames::li, HTML::TagNames::optgroup, HTML::TagNames::option, HTML::TagNames::p, HTML::TagNames::rb, HTML::TagNames::rp, HTML::TagNames::rt, HTML::TagNames::rtc, HTML::TagNames::tbody, HTML::TagNames::td, HTML::TagNames::tfoot, HTML::TagNames::th, HTML::TagNames::thead, HTML::TagNames::tr)) | ||||
|         m_stack_of_open_elements.pop(); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::close_a_p_element() | ||||
| void HTMLParser::close_a_p_element() | ||||
| { | ||||
|     generate_implied_end_tags(HTML::TagNames::p); | ||||
|     if (current_node().local_name() != HTML::TagNames::p) { | ||||
|  | @ -855,7 +855,7 @@ void HTMLDocumentParser::close_a_p_element() | |||
|     m_stack_of_open_elements.pop_until_an_element_with_tag_name_has_been_popped(HTML::TagNames::p); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::handle_after_body(HTMLToken& token) | ||||
| void HTMLParser::handle_after_body(HTMLToken& token) | ||||
| { | ||||
|     if (token.is_character() && token.is_parser_whitespace()) { | ||||
|         process_using_the_rules_for(InsertionMode::InBody, token); | ||||
|  | @ -897,7 +897,7 @@ void HTMLDocumentParser::handle_after_body(HTMLToken& token) | |||
|     process_using_the_rules_for(InsertionMode::InBody, token); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::handle_after_after_body(HTMLToken& token) | ||||
| void HTMLParser::handle_after_after_body(HTMLToken& token) | ||||
| { | ||||
|     if (token.is_comment()) { | ||||
|         auto comment = adopt_ref(*new DOM::Comment(document(), token.comment())); | ||||
|  | @ -920,7 +920,7 @@ void HTMLDocumentParser::handle_after_after_body(HTMLToken& token) | |||
|     process_using_the_rules_for(m_insertion_mode, token); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::reconstruct_the_active_formatting_elements() | ||||
| void HTMLParser::reconstruct_the_active_formatting_elements() | ||||
| { | ||||
|     // FIXME: This needs to care about "markers"
 | ||||
| 
 | ||||
|  | @ -964,7 +964,7 @@ Create: | |||
|         goto Advance; | ||||
| } | ||||
| 
 | ||||
| HTMLDocumentParser::AdoptionAgencyAlgorithmOutcome HTMLDocumentParser::run_the_adoption_agency_algorithm(HTMLToken& token) | ||||
| HTMLParser::AdoptionAgencyAlgorithmOutcome HTMLParser::run_the_adoption_agency_algorithm(HTMLToken& token) | ||||
| { | ||||
|     auto subject = token.tag_name(); | ||||
| 
 | ||||
|  | @ -1019,7 +1019,7 @@ HTMLDocumentParser::AdoptionAgencyAlgorithmOutcome HTMLDocumentParser::run_the_a | |||
|     TODO(); | ||||
| } | ||||
| 
 | ||||
| bool HTMLDocumentParser::is_special_tag(const FlyString& tag_name, const FlyString& namespace_) | ||||
| bool HTMLParser::is_special_tag(const FlyString& tag_name, const FlyString& namespace_) | ||||
| { | ||||
|     if (namespace_ == Namespace::HTML) { | ||||
|         return tag_name.is_one_of( | ||||
|  | @ -1117,7 +1117,7 @@ bool HTMLDocumentParser::is_special_tag(const FlyString& tag_name, const FlyStri | |||
|     return false; | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::handle_in_body(HTMLToken& token) | ||||
| void HTMLParser::handle_in_body(HTMLToken& token) | ||||
| { | ||||
|     if (token.is_character()) { | ||||
|         if (token.code_point() == 0) { | ||||
|  | @ -1764,12 +1764,12 @@ void HTMLDocumentParser::handle_in_body(HTMLToken& token) | |||
|     } | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::adjust_mathml_attributes(HTMLToken& token) | ||||
| void HTMLParser::adjust_mathml_attributes(HTMLToken& token) | ||||
| { | ||||
|     token.adjust_attribute_name("definitionurl", "definitionURL"); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::adjust_svg_tag_names(HTMLToken& token) | ||||
| void HTMLParser::adjust_svg_tag_names(HTMLToken& token) | ||||
| { | ||||
|     token.adjust_tag_name("altglyph", "altGlyph"); | ||||
|     token.adjust_tag_name("altglyphdef", "altGlyphDef"); | ||||
|  | @ -1807,7 +1807,7 @@ void HTMLDocumentParser::adjust_svg_tag_names(HTMLToken& token) | |||
|     token.adjust_tag_name("textpath", "textPath"); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::adjust_svg_attributes(HTMLToken& token) | ||||
| void HTMLParser::adjust_svg_attributes(HTMLToken& token) | ||||
| { | ||||
|     token.adjust_attribute_name("attributename", "attributeName"); | ||||
|     token.adjust_attribute_name("attributetype", "attributeType"); | ||||
|  | @ -1869,7 +1869,7 @@ void HTMLDocumentParser::adjust_svg_attributes(HTMLToken& token) | |||
|     token.adjust_attribute_name("zoomandpan", "zoomAndPan"); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::adjust_foreign_attributes(HTMLToken& token) | ||||
| void HTMLParser::adjust_foreign_attributes(HTMLToken& token) | ||||
| { | ||||
|     token.adjust_foreign_attribute("xlink:actuate", "xlink", "actuate", Namespace::XLink); | ||||
|     token.adjust_foreign_attribute("xlink:arcrole", "xlink", "arcrole", Namespace::XLink); | ||||
|  | @ -1886,18 +1886,18 @@ void HTMLDocumentParser::adjust_foreign_attributes(HTMLToken& token) | |||
|     token.adjust_foreign_attribute("xmlns:xlink", "xmlns", "xlink", Namespace::XMLNS); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::increment_script_nesting_level() | ||||
| void HTMLParser::increment_script_nesting_level() | ||||
| { | ||||
|     ++m_script_nesting_level; | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::decrement_script_nesting_level() | ||||
| void HTMLParser::decrement_script_nesting_level() | ||||
| { | ||||
|     VERIFY(m_script_nesting_level); | ||||
|     --m_script_nesting_level; | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::handle_text(HTMLToken& token) | ||||
| void HTMLParser::handle_text(HTMLToken& token) | ||||
| { | ||||
|     if (token.is_character()) { | ||||
|         insert_character(token.code_point()); | ||||
|  | @ -1984,7 +1984,7 @@ void HTMLDocumentParser::handle_text(HTMLToken& token) | |||
|     TODO(); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::clear_the_stack_back_to_a_table_context() | ||||
| void HTMLParser::clear_the_stack_back_to_a_table_context() | ||||
| { | ||||
|     while (!current_node().local_name().is_one_of(HTML::TagNames::table, HTML::TagNames::template_, HTML::TagNames::html)) | ||||
|         m_stack_of_open_elements.pop(); | ||||
|  | @ -1993,7 +1993,7 @@ void HTMLDocumentParser::clear_the_stack_back_to_a_table_context() | |||
|         VERIFY(m_parsing_fragment); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::clear_the_stack_back_to_a_table_row_context() | ||||
| void HTMLParser::clear_the_stack_back_to_a_table_row_context() | ||||
| { | ||||
|     while (!current_node().local_name().is_one_of(HTML::TagNames::tr, HTML::TagNames::template_, HTML::TagNames::html)) | ||||
|         m_stack_of_open_elements.pop(); | ||||
|  | @ -2002,7 +2002,7 @@ void HTMLDocumentParser::clear_the_stack_back_to_a_table_row_context() | |||
|         VERIFY(m_parsing_fragment); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::clear_the_stack_back_to_a_table_body_context() | ||||
| void HTMLParser::clear_the_stack_back_to_a_table_body_context() | ||||
| { | ||||
|     while (!current_node().local_name().is_one_of(HTML::TagNames::tbody, HTML::TagNames::tfoot, HTML::TagNames::thead, HTML::TagNames::template_, HTML::TagNames::html)) | ||||
|         m_stack_of_open_elements.pop(); | ||||
|  | @ -2011,7 +2011,7 @@ void HTMLDocumentParser::clear_the_stack_back_to_a_table_body_context() | |||
|         VERIFY(m_parsing_fragment); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::handle_in_row(HTMLToken& token) | ||||
| void HTMLParser::handle_in_row(HTMLToken& token) | ||||
| { | ||||
|     if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::th, HTML::TagNames::td)) { | ||||
|         clear_the_stack_back_to_a_table_row_context(); | ||||
|  | @ -2068,7 +2068,7 @@ void HTMLDocumentParser::handle_in_row(HTMLToken& token) | |||
|     process_using_the_rules_for(InsertionMode::InTable, token); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::close_the_cell() | ||||
| void HTMLParser::close_the_cell() | ||||
| { | ||||
|     generate_implied_end_tags(); | ||||
|     if (!current_node().local_name().is_one_of(HTML::TagNames::td, HTML::TagNames::th)) { | ||||
|  | @ -2081,7 +2081,7 @@ void HTMLDocumentParser::close_the_cell() | |||
|     m_insertion_mode = InsertionMode::InRow; | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::handle_in_cell(HTMLToken& token) | ||||
| void HTMLParser::handle_in_cell(HTMLToken& token) | ||||
| { | ||||
|     if (token.is_end_tag() && token.tag_name().is_one_of(HTML::TagNames::td, HTML::TagNames::th)) { | ||||
|         if (!m_stack_of_open_elements.has_in_table_scope(token.tag_name())) { | ||||
|  | @ -2131,7 +2131,7 @@ void HTMLDocumentParser::handle_in_cell(HTMLToken& token) | |||
|     process_using_the_rules_for(InsertionMode::InBody, token); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::handle_in_table_text(HTMLToken& token) | ||||
| void HTMLParser::handle_in_table_text(HTMLToken& token) | ||||
| { | ||||
|     if (token.is_character()) { | ||||
|         if (token.code_point() == 0) { | ||||
|  | @ -2166,7 +2166,7 @@ void HTMLDocumentParser::handle_in_table_text(HTMLToken& token) | |||
|     process_using_the_rules_for(m_insertion_mode, token); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::handle_in_table_body(HTMLToken& token) | ||||
| void HTMLParser::handle_in_table_body(HTMLToken& token) | ||||
| { | ||||
|     if (token.is_start_tag() && token.tag_name() == HTML::TagNames::tr) { | ||||
|         clear_the_stack_back_to_a_table_body_context(); | ||||
|  | @ -2220,7 +2220,7 @@ void HTMLDocumentParser::handle_in_table_body(HTMLToken& token) | |||
|     process_using_the_rules_for(InsertionMode::InTable, token); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::handle_in_table(HTMLToken& token) | ||||
| void HTMLParser::handle_in_table(HTMLToken& token) | ||||
| { | ||||
|     if (token.is_character() && current_node().local_name().is_one_of(HTML::TagNames::table, HTML::TagNames::tbody, HTML::TagNames::tfoot, HTML::TagNames::thead, HTML::TagNames::tr)) { | ||||
|         m_pending_table_character_tokens.clear(); | ||||
|  | @ -2341,7 +2341,7 @@ AnythingElse: | |||
|     m_foster_parenting = false; | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::handle_in_select_in_table(HTMLToken& token) | ||||
| void HTMLParser::handle_in_select_in_table(HTMLToken& token) | ||||
| { | ||||
|     if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::caption, HTML::TagNames::table, HTML::TagNames::tbody, HTML::TagNames::tfoot, HTML::TagNames::thead, HTML::TagNames::tr, HTML::TagNames::td, HTML::TagNames::th)) { | ||||
|         log_parse_error(); | ||||
|  | @ -2366,7 +2366,7 @@ void HTMLDocumentParser::handle_in_select_in_table(HTMLToken& token) | |||
|     process_using_the_rules_for(InsertionMode::InSelect, token); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::handle_in_select(HTMLToken& token) | ||||
| void HTMLParser::handle_in_select(HTMLToken& token) | ||||
| { | ||||
|     if (token.is_character()) { | ||||
|         if (token.code_point() == 0) { | ||||
|  | @ -2490,7 +2490,7 @@ void HTMLDocumentParser::handle_in_select(HTMLToken& token) | |||
|     log_parse_error(); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::handle_in_caption(HTMLToken& token) | ||||
| void HTMLParser::handle_in_caption(HTMLToken& token) | ||||
| { | ||||
|     if (token.is_end_tag() && token.tag_name() == HTML::TagNames::caption) { | ||||
|         if (!m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::caption)) { | ||||
|  | @ -2540,7 +2540,7 @@ void HTMLDocumentParser::handle_in_caption(HTMLToken& token) | |||
|     process_using_the_rules_for(InsertionMode::InBody, token); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::handle_in_column_group(HTMLToken& token) | ||||
| void HTMLParser::handle_in_column_group(HTMLToken& token) | ||||
| { | ||||
|     if (token.is_character() && token.is_parser_whitespace()) { | ||||
|         insert_character(token.code_point()); | ||||
|  | @ -2605,7 +2605,7 @@ void HTMLDocumentParser::handle_in_column_group(HTMLToken& token) | |||
|     process_using_the_rules_for(m_insertion_mode, token); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::handle_in_template(HTMLToken& token) | ||||
| void HTMLParser::handle_in_template(HTMLToken& token) | ||||
| { | ||||
|     if (token.is_character() || token.is_comment() || token.is_doctype()) { | ||||
|         process_using_the_rules_for(InsertionMode::InBody, token); | ||||
|  | @ -2683,7 +2683,7 @@ void HTMLDocumentParser::handle_in_template(HTMLToken& token) | |||
|     } | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::handle_in_frameset(HTMLToken& token) | ||||
| void HTMLParser::handle_in_frameset(HTMLToken& token) | ||||
| { | ||||
|     if (token.is_character() && token.is_parser_whitespace()) { | ||||
|         insert_character(token.code_point()); | ||||
|  | @ -2743,7 +2743,7 @@ void HTMLDocumentParser::handle_in_frameset(HTMLToken& token) | |||
|     log_parse_error(); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::handle_after_frameset(HTMLToken& token) | ||||
| void HTMLParser::handle_after_frameset(HTMLToken& token) | ||||
| { | ||||
|     if (token.is_character() && token.is_parser_whitespace()) { | ||||
|         insert_character(token.code_point()); | ||||
|  | @ -2783,7 +2783,7 @@ void HTMLDocumentParser::handle_after_frameset(HTMLToken& token) | |||
|     log_parse_error(); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::handle_after_after_frameset(HTMLToken& token) | ||||
| void HTMLParser::handle_after_after_frameset(HTMLToken& token) | ||||
| { | ||||
|     if (token.is_comment()) { | ||||
|         auto comment = adopt_ref(*new DOM::Comment(document(), token.comment())); | ||||
|  | @ -2809,7 +2809,7 @@ void HTMLDocumentParser::handle_after_after_frameset(HTMLToken& token) | |||
|     log_parse_error(); | ||||
| } | ||||
| 
 | ||||
| void HTMLDocumentParser::process_using_the_rules_for_foreign_content(HTMLToken& token) | ||||
| void HTMLParser::process_using_the_rules_for_foreign_content(HTMLToken& token) | ||||
| { | ||||
|     if (token.is_character()) { | ||||
|         if (token.code_point() == 0) { | ||||
|  | @ -2916,7 +2916,7 @@ void HTMLDocumentParser::process_using_the_rules_for_foreign_content(HTMLToken& | |||
| } | ||||
| 
 | ||||
| // https://html.spec.whatwg.org/multipage/parsing.html#reset-the-insertion-mode-appropriately
 | ||||
| void HTMLDocumentParser::reset_the_insertion_mode_appropriately() | ||||
| void HTMLParser::reset_the_insertion_mode_appropriately() | ||||
| { | ||||
|     for (ssize_t i = m_stack_of_open_elements.elements().size() - 1; i >= 0; --i) { | ||||
|         bool last = i == 0; | ||||
|  | @ -3014,7 +3014,7 @@ void HTMLDocumentParser::reset_the_insertion_mode_appropriately() | |||
|     m_insertion_mode = InsertionMode::InBody; | ||||
| } | ||||
| 
 | ||||
| const char* HTMLDocumentParser::insertion_mode_name() const | ||||
| const char* HTMLParser::insertion_mode_name() const | ||||
| { | ||||
|     switch (m_insertion_mode) { | ||||
| #define __ENUMERATE_INSERTION_MODE(mode) \ | ||||
|  | @ -3026,15 +3026,15 @@ const char* HTMLDocumentParser::insertion_mode_name() const | |||
|     VERIFY_NOT_REACHED(); | ||||
| } | ||||
| 
 | ||||
| DOM::Document& HTMLDocumentParser::document() | ||||
| DOM::Document& HTMLParser::document() | ||||
| { | ||||
|     return *m_document; | ||||
| } | ||||
| 
 | ||||
| NonnullRefPtrVector<DOM::Node> HTMLDocumentParser::parse_html_fragment(DOM::Element& context_element, const StringView& markup) | ||||
| NonnullRefPtrVector<DOM::Node> HTMLParser::parse_html_fragment(DOM::Element& context_element, const StringView& markup) | ||||
| { | ||||
|     auto temp_document = DOM::Document::create(); | ||||
|     HTMLDocumentParser parser(*temp_document, markup, "utf-8"); | ||||
|     HTMLParser parser(*temp_document, markup, "utf-8"); | ||||
|     parser.m_context_element = context_element; | ||||
|     parser.m_parsing_fragment = true; | ||||
|     parser.document().set_quirks_mode(context_element.document().mode()); | ||||
|  | @ -3082,17 +3082,17 @@ NonnullRefPtrVector<DOM::Node> HTMLDocumentParser::parse_html_fragment(DOM::Elem | |||
|     return children; | ||||
| } | ||||
| 
 | ||||
| NonnullOwnPtr<HTMLDocumentParser> HTMLDocumentParser::create_with_uncertain_encoding(DOM::Document& document, const ByteBuffer& input) | ||||
| NonnullOwnPtr<HTMLParser> HTMLParser::create_with_uncertain_encoding(DOM::Document& document, const ByteBuffer& input) | ||||
| { | ||||
|     if (document.has_encoding()) | ||||
|         return make<HTMLDocumentParser>(document, input, document.encoding().value()); | ||||
|         return make<HTMLParser>(document, input, document.encoding().value()); | ||||
|     auto encoding = run_encoding_sniffing_algorithm(input); | ||||
|     dbgln("The encoding sniffing algorithm returned encoding '{}'", encoding); | ||||
|     return make<HTMLDocumentParser>(document, input, encoding); | ||||
|     return make<HTMLParser>(document, input, encoding); | ||||
| } | ||||
| 
 | ||||
| // https://html.spec.whatwg.org/multipage/parsing.html#html-fragment-serialisation-algorithm
 | ||||
| String HTMLDocumentParser::serialize_html_fragment(DOM::Node const& node) | ||||
| String HTMLParser::serialize_html_fragment(DOM::Node const& node) | ||||
| { | ||||
|     // The algorithm takes as input a DOM Element, Document, or DocumentFragment referred to as the node.
 | ||||
|     VERIFY(node.is_element() || node.is_document() || node.is_document_fragment()); | ||||
|  | @ -41,12 +41,12 @@ namespace Web::HTML { | |||
| 
 | ||||
| RefPtr<DOM::Document> parse_html_document(const StringView&, const AK::URL&, const String& encoding); | ||||
| 
 | ||||
| class HTMLDocumentParser { | ||||
| class HTMLParser { | ||||
| public: | ||||
|     HTMLDocumentParser(DOM::Document&, const StringView& input, const String& encoding); | ||||
|     ~HTMLDocumentParser(); | ||||
|     HTMLParser(DOM::Document&, const StringView& input, const String& encoding); | ||||
|     ~HTMLParser(); | ||||
| 
 | ||||
|     static NonnullOwnPtr<HTMLDocumentParser> create_with_uncertain_encoding(DOM::Document&, const ByteBuffer& input); | ||||
|     static NonnullOwnPtr<HTMLParser> create_with_uncertain_encoding(DOM::Document&, const ByteBuffer& input); | ||||
| 
 | ||||
|     void run(const AK::URL&); | ||||
| 
 | ||||
|  | @ -2698,7 +2698,7 @@ void HTMLTokenizer::will_reconsume_in([[maybe_unused]] State new_state) | |||
|     dbgln_if(TOKENIZER_TRACE_DEBUG, "[{}] Reconsume in {}", state_name(m_state), state_name(new_state)); | ||||
| } | ||||
| 
 | ||||
| void HTMLTokenizer::switch_to(Badge<HTMLDocumentParser>, State new_state) | ||||
| void HTMLTokenizer::switch_to(Badge<HTMLParser>, State new_state) | ||||
| { | ||||
|     dbgln_if(TOKENIZER_TRACE_DEBUG, "[{}] Parser switches tokenizer state to {}", state_name(m_state), state_name(new_state)); | ||||
|     m_state = new_state; | ||||
|  |  | |||
|  | @ -110,7 +110,7 @@ public: | |||
| 
 | ||||
|     Optional<HTMLToken> next_token(); | ||||
| 
 | ||||
|     void switch_to(Badge<HTMLDocumentParser>, State new_state); | ||||
|     void switch_to(Badge<HTMLParser>, State new_state); | ||||
|     void switch_to(State new_state) | ||||
|     { | ||||
|         m_state = new_state; | ||||
|  |  | |||
|  | @ -5,7 +5,7 @@ | |||
|  */ | ||||
| 
 | ||||
| #include <LibWeb/DOM/Element.h> | ||||
| #include <LibWeb/HTML/Parser/HTMLDocumentParser.h> | ||||
| #include <LibWeb/HTML/Parser/HTMLParser.h> | ||||
| #include <LibWeb/HTML/Parser/StackOfOpenElements.h> | ||||
| 
 | ||||
| namespace Web::HTML { | ||||
|  | @ -107,7 +107,7 @@ DOM::Element* StackOfOpenElements::topmost_special_node_below(const DOM::Element | |||
|         auto& element = m_elements[i]; | ||||
|         if (&element == &formatting_element) | ||||
|             break; | ||||
|         if (HTMLDocumentParser::is_special_tag(element.local_name(), element.namespace_())) | ||||
|         if (HTMLParser::is_special_tag(element.local_name(), element.namespace_())) | ||||
|             found_element = &element; | ||||
|     } | ||||
|     return found_element; | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ | |||
| #include <LibGUI/Window.h> | ||||
| #include <LibGfx/ShareableBitmap.h> | ||||
| #include <LibWeb/HTML/HTMLAnchorElement.h> | ||||
| #include <LibWeb/HTML/Parser/HTMLDocumentParser.h> | ||||
| #include <LibWeb/HTML/Parser/HTMLParser.h> | ||||
| #include <LibWeb/InProcessWebView.h> | ||||
| #include <LibWeb/Layout/InitialContainingBlock.h> | ||||
| #include <LibWeb/Layout/TextNode.h> | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ | |||
| #include <LibWeb/DOM/ElementFactory.h> | ||||
| #include <LibWeb/DOM/Text.h> | ||||
| #include <LibWeb/HTML/HTMLIFrameElement.h> | ||||
| #include <LibWeb/HTML/Parser/HTMLDocumentParser.h> | ||||
| #include <LibWeb/HTML/Parser/HTMLParser.h> | ||||
| #include <LibWeb/Loader/FrameLoader.h> | ||||
| #include <LibWeb/Loader/ResourceLoader.h> | ||||
| #include <LibWeb/Page/BrowsingContext.h> | ||||
|  | @ -43,7 +43,7 @@ static bool build_markdown_document(DOM::Document& document, const ByteBuffer& d | |||
|     if (!markdown_document) | ||||
|         return false; | ||||
| 
 | ||||
|     HTML::HTMLDocumentParser parser(document, markdown_document->render_to_html(), "utf-8"); | ||||
|     HTML::HTMLParser parser(document, markdown_document->render_to_html(), "utf-8"); | ||||
|     parser.run(document.url()); | ||||
|     return true; | ||||
| } | ||||
|  | @ -112,7 +112,7 @@ static bool build_gemini_document(DOM::Document& document, const ByteBuffer& dat | |||
|     dbgln_if(GEMINI_DEBUG, "Gemini data:\n\"\"\"{}\"\"\"", gemini_data); | ||||
|     dbgln_if(GEMINI_DEBUG, "Converted to HTML:\n\"\"\"{}\"\"\"", html_data); | ||||
| 
 | ||||
|     HTML::HTMLDocumentParser parser(document, html_data, "utf-8"); | ||||
|     HTML::HTMLParser parser(document, html_data, "utf-8"); | ||||
|     parser.run(document.url()); | ||||
|     return true; | ||||
| } | ||||
|  | @ -121,7 +121,7 @@ bool FrameLoader::parse_document(DOM::Document& document, const ByteBuffer& data | |||
| { | ||||
|     auto& mime_type = document.content_type(); | ||||
|     if (mime_type == "text/html" || mime_type == "image/svg+xml") { | ||||
|         auto parser = HTML::HTMLDocumentParser::create_with_uncertain_encoding(document, data); | ||||
|         auto parser = HTML::HTMLParser::create_with_uncertain_encoding(document, data); | ||||
|         parser->run(document.url()); | ||||
|         return true; | ||||
|     } | ||||
|  | @ -213,7 +213,7 @@ bool FrameLoader::load(const AK::URL& url, Type type) | |||
| void FrameLoader::load_html(const StringView& html, const AK::URL& url) | ||||
| { | ||||
|     auto document = DOM::Document::create(url); | ||||
|     HTML::HTMLDocumentParser parser(document, html, "utf-8"); | ||||
|     HTML::HTMLParser parser(document, html, "utf-8"); | ||||
|     parser.run(url); | ||||
|     browsing_context().set_active_document(&parser.document()); | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling