mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 09:49:15 +03:00
LibHTML: Rename Document::normalize() to fixup() and always do it
Node.normalize() is a standard DOM API that coalesces Text nodes. To avoid clashing with that, rename it to fixup(). This patch also makes it happen automagically as part of parsing.
This commit is contained in:
parent
59795aab41
commit
850955053f
Notes:
sideshowbarker
2024-07-19 11:44:45 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/850955053f5
@ -81,7 +81,6 @@ int main(int argc, char* argv[])
|
||||
|
||||
String html = md_document.render_to_html();
|
||||
auto html_document = parse_html(html);
|
||||
html_document->normalize();
|
||||
html_view->set_document(html_document);
|
||||
|
||||
String page_and_section = model->page_and_section(tree_view->selection().first());
|
||||
|
@ -27,7 +27,7 @@ StyleResolver& Document::style_resolver()
|
||||
return *m_style_resolver;
|
||||
}
|
||||
|
||||
void Document::normalize()
|
||||
void Document::fixup()
|
||||
{
|
||||
if (is<HTMLHtmlElement>(first_child()))
|
||||
return;
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
|
||||
URL complete_url(const String&) const;
|
||||
|
||||
void normalize();
|
||||
void fixup();
|
||||
|
||||
StyleResolver& style_resolver();
|
||||
|
||||
|
@ -182,7 +182,6 @@ void HtmlView::load(const URL& url)
|
||||
}
|
||||
|
||||
auto document = parse_html(data, url);
|
||||
document->normalize();
|
||||
|
||||
set_document(document);
|
||||
|
||||
|
@ -309,5 +309,7 @@ NonnullRefPtr<Document> parse_html(const StringView& html, const URL& url)
|
||||
|
||||
fire_insertion_callbacks(*document);
|
||||
|
||||
document->fixup();
|
||||
|
||||
return document;
|
||||
}
|
||||
|
@ -35,7 +35,6 @@ int main(int argc, char** argv)
|
||||
|
||||
String html = String::copy(f->read_all());
|
||||
auto document = parse_html(html);
|
||||
document->normalize();
|
||||
|
||||
auto window = GWindow::construct();
|
||||
auto widget = HtmlView::construct();
|
||||
|
Loading…
Reference in New Issue
Block a user