summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb/Loader
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-07-26 19:37:56 +0200
committerAndreas Kling <kling@serenityos.org>2020-07-26 20:05:15 +0200
commit11ff9d0f17bc0cd49a61b7c4cc66036584d6d30b (patch)
treeec880ff36492c94b7854e84226bf64c3611bb20a /Libraries/LibWeb/Loader
parent96d13f75cf2659cba8392db5469fdef1c831ceec (diff)
downloadserenity-11ff9d0f17bc0cd49a61b7c4cc66036584d6d30b.zip
LibWeb: Move DOM classes into the Web::DOM namespace
LibWeb keeps growing and the Web namespace is filling up fast. Let's put DOM stuff into Web::DOM, just like we already started doing with SVG stuff in Web::SVG.
Diffstat (limited to 'Libraries/LibWeb/Loader')
-rw-r--r--Libraries/LibWeb/Loader/FrameLoader.cpp16
-rw-r--r--Libraries/LibWeb/Loader/FrameLoader.h2
2 files changed, 9 insertions, 9 deletions
diff --git a/Libraries/LibWeb/Loader/FrameLoader.cpp b/Libraries/LibWeb/Loader/FrameLoader.cpp
index de63ba7ccb..cfc6b78bf5 100644
--- a/Libraries/LibWeb/Loader/FrameLoader.cpp
+++ b/Libraries/LibWeb/Loader/FrameLoader.cpp
@@ -48,7 +48,7 @@ FrameLoader::~FrameLoader()
{
}
-static RefPtr<Document> create_markdown_document(const ByteBuffer& data, const URL& url)
+static RefPtr<DOM::Document> create_markdown_document(const ByteBuffer& data, const URL& url)
{
auto markdown_document = Markdown::Document::parse(data);
if (!markdown_document)
@@ -57,9 +57,9 @@ static RefPtr<Document> create_markdown_document(const ByteBuffer& data, const U
return parse_html_document(markdown_document->render_to_html(), url, "utf-8");
}
-static RefPtr<Document> create_text_document(const ByteBuffer& data, const URL& url)
+static RefPtr<DOM::Document> create_text_document(const ByteBuffer& data, const URL& url)
{
- auto document = adopt(*new Document(url));
+ auto document = adopt(*new DOM::Document(url));
auto html_element = document->create_element("html");
document->append_child(html_element);
@@ -82,9 +82,9 @@ static RefPtr<Document> create_text_document(const ByteBuffer& data, const URL&
return document;
}
-static RefPtr<Document> create_image_document(const ByteBuffer& data, const URL& url)
+static RefPtr<DOM::Document> create_image_document(const ByteBuffer& data, const URL& url)
{
- auto document = adopt(*new Document(url));
+ auto document = adopt(*new DOM::Document(url));
auto image_decoder = Gfx::ImageDecoder::create(data.data(), data.size());
auto bitmap = image_decoder->bitmap();
@@ -99,7 +99,7 @@ static RefPtr<Document> create_image_document(const ByteBuffer& data, const URL&
head_element->append_child(title_element);
auto basename = LexicalPath(url.path()).basename();
- auto title_text = adopt(*new Text(document, String::format("%s [%dx%d]", basename.characters(), bitmap->width(), bitmap->height())));
+ auto title_text = adopt(*new DOM::Text(document, String::format("%s [%dx%d]", basename.characters(), bitmap->width(), bitmap->height())));
title_element->append_child(title_text);
auto body_element = create_element(document, "body");
@@ -112,14 +112,14 @@ static RefPtr<Document> create_image_document(const ByteBuffer& data, const URL&
return document;
}
-static RefPtr<Document> create_gemini_document(const ByteBuffer& data, const URL& url)
+static RefPtr<DOM::Document> create_gemini_document(const ByteBuffer& data, const URL& url)
{
auto markdown_document = Gemini::Document::parse({ (const char*)data.data(), data.size() }, url);
return parse_html_document(markdown_document->render_to_html(), url, "utf-8");
}
-RefPtr<Document> FrameLoader::create_document_from_mime_type(const ByteBuffer& data, const URL& url, const String& mime_type, const String& encoding)
+RefPtr<DOM::Document> FrameLoader::create_document_from_mime_type(const ByteBuffer& data, const URL& url, const String& mime_type, const String& encoding)
{
if (mime_type.starts_with("image/"))
return create_image_document(data, url);
diff --git a/Libraries/LibWeb/Loader/FrameLoader.h b/Libraries/LibWeb/Loader/FrameLoader.h
index d883626c45..3da7854b8c 100644
--- a/Libraries/LibWeb/Loader/FrameLoader.h
+++ b/Libraries/LibWeb/Loader/FrameLoader.h
@@ -55,7 +55,7 @@ private:
virtual void resource_did_fail() override;
void load_error_page(const URL& failed_url, const String& error_message);
- RefPtr<Document> create_document_from_mime_type(const ByteBuffer&, const URL&, const String& mime_type, const String& encoding);
+ RefPtr<DOM::Document> create_document_from_mime_type(const ByteBuffer&, const URL&, const String& mime_type, const String& encoding);
Frame& m_frame;
};