mirror of
https://github.com/RGBCube/serenity
synced 2025-07-05 08:37:35 +00:00
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.
This commit is contained in:
parent
96d13f75cf
commit
11ff9d0f17
178 changed files with 516 additions and 523 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue