mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:57:45 +00:00
LibWeb: Move everything into the Web namespace
This commit is contained in:
parent
6a3b12664a
commit
7a6c4a72d5
143 changed files with 593 additions and 45 deletions
|
@ -41,13 +41,13 @@ InspectorWidget::InspectorWidget()
|
|||
auto& splitter = add<GUI::VerticalSplitter>();
|
||||
m_dom_tree_view = splitter.add<GUI::TreeView>();
|
||||
m_dom_tree_view->on_selection = [this](auto& index) {
|
||||
auto* node = static_cast<Node*>(index.internal_data());
|
||||
auto* node = static_cast<Web::Node*>(index.internal_data());
|
||||
node->document().set_inspected_node(node);
|
||||
if (node->is_element()) {
|
||||
auto element = to<Element>(*node);
|
||||
auto element = Web::to<Web::Element>(*node);
|
||||
if (element.resolved_style()) {
|
||||
m_style_table_view->set_model(StylePropertiesModel::create(*element.resolved_style()));
|
||||
m_computed_style_table_view->set_model(StylePropertiesModel::create(*element.computed_style()));
|
||||
m_style_table_view->set_model(Web::StylePropertiesModel::create(*element.resolved_style()));
|
||||
m_computed_style_table_view->set_model(Web::StylePropertiesModel::create(*element.computed_style()));
|
||||
}
|
||||
} else {
|
||||
m_style_table_view->set_model(nullptr);
|
||||
|
@ -68,10 +68,10 @@ InspectorWidget::~InspectorWidget()
|
|||
{
|
||||
}
|
||||
|
||||
void InspectorWidget::set_document(Document* document)
|
||||
void InspectorWidget::set_document(Web::Document* document)
|
||||
{
|
||||
if (m_document == document)
|
||||
return;
|
||||
m_document = document;
|
||||
m_dom_tree_view->set_model(DOMTreeModel::create(*document));
|
||||
m_dom_tree_view->set_model(Web::DOMTreeModel::create(*document));
|
||||
}
|
||||
|
|
|
@ -25,15 +25,14 @@
|
|||
*/
|
||||
|
||||
#include <LibGUI/Widget.h>
|
||||
|
||||
class Document;
|
||||
#include <LibHTML/Forward.h>
|
||||
|
||||
class InspectorWidget final : public GUI::Widget {
|
||||
C_OBJECT(InspectorWidget)
|
||||
public:
|
||||
virtual ~InspectorWidget();
|
||||
|
||||
void set_document(Document*);
|
||||
void set_document(Web::Document*);
|
||||
|
||||
private:
|
||||
InspectorWidget();
|
||||
|
@ -41,5 +40,5 @@ private:
|
|||
RefPtr<GUI::TreeView> m_dom_tree_view;
|
||||
RefPtr<GUI::TableView> m_style_table_view;
|
||||
RefPtr<GUI::TableView> m_computed_style_table_view;
|
||||
RefPtr<Document> m_document;
|
||||
RefPtr<Web::Document> m_document;
|
||||
};
|
||||
|
|
|
@ -64,7 +64,7 @@ int main(int argc, char** argv)
|
|||
GUI::Application app(argc, argv);
|
||||
|
||||
// Connect to the ProtocolServer immediately so we can drop the "unix" pledge.
|
||||
ResourceLoader::the();
|
||||
Web::ResourceLoader::the();
|
||||
|
||||
if (pledge("stdio shared_buffer accept rpath", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
|
@ -81,7 +81,7 @@ int main(int argc, char** argv)
|
|||
widget.layout()->set_spacing(0);
|
||||
|
||||
auto& toolbar = widget.add<GUI::ToolBar>();
|
||||
auto& html_widget = widget.add<HtmlView>();
|
||||
auto& html_widget = widget.add<Web::HtmlView>();
|
||||
|
||||
History<URL> history;
|
||||
|
||||
|
@ -157,12 +157,12 @@ int main(int argc, char** argv)
|
|||
statusbar.set_text(href);
|
||||
};
|
||||
|
||||
ResourceLoader::the().on_load_counter_change = [&] {
|
||||
if (ResourceLoader::the().pending_loads() == 0) {
|
||||
Web::ResourceLoader::the().on_load_counter_change = [&] {
|
||||
if (Web::ResourceLoader::the().pending_loads() == 0) {
|
||||
statusbar.set_text("");
|
||||
return;
|
||||
}
|
||||
statusbar.set_text(String::format("Loading (%d pending resources...)", ResourceLoader::the().pending_loads()));
|
||||
statusbar.set_text(String::format("Loading (%d pending resources...)", Web::ResourceLoader::the().pending_loads()));
|
||||
};
|
||||
|
||||
auto menubar = make<GUI::MenuBar>();
|
||||
|
|
|
@ -93,7 +93,7 @@ int main(int argc, char* argv[])
|
|||
tree_view.set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fill);
|
||||
tree_view.set_preferred_size(200, 500);
|
||||
|
||||
auto& html_view = splitter.add<HtmlView>();
|
||||
auto& html_view = splitter.add<Web::HtmlView>();
|
||||
|
||||
History history;
|
||||
|
||||
|
@ -129,7 +129,7 @@ int main(int argc, char* argv[])
|
|||
ASSERT(success);
|
||||
|
||||
String html = md_document.render_to_html();
|
||||
auto html_document = parse_html_document(html);
|
||||
auto html_document = Web::parse_html_document(html);
|
||||
html_view.set_document(html_document);
|
||||
|
||||
String page_and_section = model->page_and_section(tree_view.selection().first());
|
||||
|
|
|
@ -43,14 +43,14 @@ NonnullRefPtr<IRCLogBuffer> IRCLogBuffer::create()
|
|||
|
||||
IRCLogBuffer::IRCLogBuffer()
|
||||
{
|
||||
m_document = adopt(*new Document);
|
||||
m_document->append_child(adopt(*new DocumentType(document())));
|
||||
m_document = adopt(*new Web::Document);
|
||||
m_document->append_child(adopt(*new Web::DocumentType(document())));
|
||||
auto html_element = create_element(document(), "html");
|
||||
m_document->append_child(html_element);
|
||||
auto head_element = create_element(document(), "head");
|
||||
html_element->append_child(head_element);
|
||||
auto style_element = create_element(document(), "style");
|
||||
style_element->append_child(adopt(*new Text(document(), "div { font-family: Csilla; font-weight: lighter; }")));
|
||||
style_element->append_child(adopt(*new Web::Text(document(), "div { font-family: Csilla; font-weight: lighter; }")));
|
||||
head_element->append_child(style_element);
|
||||
auto body_element = create_element(document(), "body");
|
||||
html_element->append_child(body_element);
|
||||
|
|
|
@ -49,11 +49,11 @@ public:
|
|||
void add_message(const String& text, Color = Color::Black);
|
||||
void dump() const;
|
||||
|
||||
const Document& document() const { return *m_document; }
|
||||
Document& document() { return *m_document; }
|
||||
const Web::Document& document() const { return *m_document; }
|
||||
Web::Document& document() { return *m_document; }
|
||||
|
||||
private:
|
||||
IRCLogBuffer();
|
||||
RefPtr<Document> m_document;
|
||||
RefPtr<Element> m_container_element;
|
||||
RefPtr<Web::Document> m_document;
|
||||
RefPtr<Web::Element> m_container_element;
|
||||
};
|
||||
|
|
|
@ -46,7 +46,7 @@ IRCWindow::IRCWindow(IRCClient& client, void* owner, Type type, const String& na
|
|||
// Make a container for the log buffer view + (optional) member list.
|
||||
auto& container = add<GUI::HorizontalSplitter>();
|
||||
|
||||
m_html_view = container.add<HtmlView>();
|
||||
m_html_view = container.add<Web::HtmlView>();
|
||||
|
||||
if (m_type == Channel) {
|
||||
auto& member_view = container.add<GUI::TableView>();
|
||||
|
@ -82,7 +82,7 @@ IRCWindow::~IRCWindow()
|
|||
void IRCWindow::set_log_buffer(const IRCLogBuffer& log_buffer)
|
||||
{
|
||||
m_log_buffer = &log_buffer;
|
||||
m_html_view->set_document(const_cast<Document*>(&log_buffer.document()));
|
||||
m_html_view->set_document(const_cast<Web::Document*>(&log_buffer.document()));
|
||||
}
|
||||
|
||||
bool IRCWindow::is_active() const
|
||||
|
|
|
@ -27,12 +27,12 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibHTML/Forward.h>
|
||||
|
||||
class IRCChannel;
|
||||
class IRCClient;
|
||||
class IRCQuery;
|
||||
class IRCLogBuffer;
|
||||
class HtmlView;
|
||||
|
||||
class IRCWindow : public GUI::Widget {
|
||||
C_OBJECT(IRCWindow)
|
||||
|
@ -72,7 +72,7 @@ private:
|
|||
void* m_owner { nullptr };
|
||||
Type m_type;
|
||||
String m_name;
|
||||
RefPtr<HtmlView> m_html_view;
|
||||
RefPtr<Web::HtmlView> m_html_view;
|
||||
RefPtr<GUI::TextEditor> m_text_editor;
|
||||
RefPtr<IRCLogBuffer> m_log_buffer;
|
||||
int m_unread_count { 0 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue