diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-10-09 18:54:34 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-10-09 18:54:34 +0200 |
commit | 850955053f55a97f932976783db8e7b2f19ee5f1 (patch) | |
tree | e9dff75cbca19668265230da6f51d6f1344e4c34 /Libraries | |
parent | 59795aab41728b6ffda903781b9063f4dc907490 (diff) | |
download | serenity-850955053f55a97f932976783db8e7b2f19ee5f1.zip |
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.
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibHTML/DOM/Document.cpp | 2 | ||||
-rw-r--r-- | Libraries/LibHTML/DOM/Document.h | 2 | ||||
-rw-r--r-- | Libraries/LibHTML/HtmlView.cpp | 1 | ||||
-rw-r--r-- | Libraries/LibHTML/Parser/HTMLParser.cpp | 2 |
4 files changed, 4 insertions, 3 deletions
diff --git a/Libraries/LibHTML/DOM/Document.cpp b/Libraries/LibHTML/DOM/Document.cpp index 5d6d45a9d8..5181d2da9b 100644 --- a/Libraries/LibHTML/DOM/Document.cpp +++ b/Libraries/LibHTML/DOM/Document.cpp @@ -27,7 +27,7 @@ StyleResolver& Document::style_resolver() return *m_style_resolver; } -void Document::normalize() +void Document::fixup() { if (is<HTMLHtmlElement>(first_child())) return; diff --git a/Libraries/LibHTML/DOM/Document.h b/Libraries/LibHTML/DOM/Document.h index bfef5ec43b..485ed87cec 100644 --- a/Libraries/LibHTML/DOM/Document.h +++ b/Libraries/LibHTML/DOM/Document.h @@ -28,7 +28,7 @@ public: URL complete_url(const String&) const; - void normalize(); + void fixup(); StyleResolver& style_resolver(); diff --git a/Libraries/LibHTML/HtmlView.cpp b/Libraries/LibHTML/HtmlView.cpp index ec471c18f1..b909fbb2bd 100644 --- a/Libraries/LibHTML/HtmlView.cpp +++ b/Libraries/LibHTML/HtmlView.cpp @@ -182,7 +182,6 @@ void HtmlView::load(const URL& url) } auto document = parse_html(data, url); - document->normalize(); set_document(document); diff --git a/Libraries/LibHTML/Parser/HTMLParser.cpp b/Libraries/LibHTML/Parser/HTMLParser.cpp index d9fcde815e..981f182702 100644 --- a/Libraries/LibHTML/Parser/HTMLParser.cpp +++ b/Libraries/LibHTML/Parser/HTMLParser.cpp @@ -309,5 +309,7 @@ NonnullRefPtr<Document> parse_html(const StringView& html, const URL& url) fire_insertion_callbacks(*document); + document->fixup(); + return document; } |