diff --git a/Applications/Browser/InspectorWidget.cpp b/Applications/Browser/InspectorWidget.cpp index 914e43571c..024d192f4f 100644 --- a/Applications/Browser/InspectorWidget.cpp +++ b/Applications/Browser/InspectorWidget.cpp @@ -41,13 +41,13 @@ InspectorWidget::InspectorWidget() auto& splitter = add(); m_dom_tree_view = splitter.add(); m_dom_tree_view->on_selection = [this](auto& index) { - auto* node = static_cast(index.internal_data()); + auto* node = static_cast(index.internal_data()); node->document().set_inspected_node(node); if (node->is_element()) { - auto element = to(*node); + auto element = Web::to(*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)); } diff --git a/Applications/Browser/InspectorWidget.h b/Applications/Browser/InspectorWidget.h index 571b3acab1..de03e007a6 100644 --- a/Applications/Browser/InspectorWidget.h +++ b/Applications/Browser/InspectorWidget.h @@ -25,15 +25,14 @@ */ #include - -class Document; +#include 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 m_dom_tree_view; RefPtr m_style_table_view; RefPtr m_computed_style_table_view; - RefPtr m_document; + RefPtr m_document; }; diff --git a/Applications/Browser/main.cpp b/Applications/Browser/main.cpp index ecbaa154cf..92c3ceac7e 100644 --- a/Applications/Browser/main.cpp +++ b/Applications/Browser/main.cpp @@ -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(); - auto& html_widget = widget.add(); + auto& html_widget = widget.add(); History 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(); diff --git a/Applications/Help/main.cpp b/Applications/Help/main.cpp index c058ecdd25..cb640633ff 100644 --- a/Applications/Help/main.cpp +++ b/Applications/Help/main.cpp @@ -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(); + auto& html_view = splitter.add(); 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()); diff --git a/Applications/IRCClient/IRCLogBuffer.cpp b/Applications/IRCClient/IRCLogBuffer.cpp index 81abb98376..aefc0db836 100644 --- a/Applications/IRCClient/IRCLogBuffer.cpp +++ b/Applications/IRCClient/IRCLogBuffer.cpp @@ -43,14 +43,14 @@ NonnullRefPtr 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); diff --git a/Applications/IRCClient/IRCLogBuffer.h b/Applications/IRCClient/IRCLogBuffer.h index d1c7c54041..4cef97a77d 100644 --- a/Applications/IRCClient/IRCLogBuffer.h +++ b/Applications/IRCClient/IRCLogBuffer.h @@ -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 m_document; - RefPtr m_container_element; + RefPtr m_document; + RefPtr m_container_element; }; diff --git a/Applications/IRCClient/IRCWindow.cpp b/Applications/IRCClient/IRCWindow.cpp index a47525da8e..1994f1e059 100644 --- a/Applications/IRCClient/IRCWindow.cpp +++ b/Applications/IRCClient/IRCWindow.cpp @@ -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(); - m_html_view = container.add(); + m_html_view = container.add(); if (m_type == Channel) { auto& member_view = container.add(); @@ -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(&log_buffer.document())); + m_html_view->set_document(const_cast(&log_buffer.document())); } bool IRCWindow::is_active() const diff --git a/Applications/IRCClient/IRCWindow.h b/Applications/IRCClient/IRCWindow.h index 319184dd85..c8189fee63 100644 --- a/Applications/IRCClient/IRCWindow.h +++ b/Applications/IRCClient/IRCWindow.h @@ -27,12 +27,12 @@ #pragma once #include +#include 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 m_html_view; + RefPtr m_html_view; RefPtr m_text_editor; RefPtr m_log_buffer; int m_unread_count { 0 }; diff --git a/DevTools/HackStudio/Editor.cpp b/DevTools/HackStudio/Editor.cpp index d43d0e5ede..b2a725c5ec 100644 --- a/DevTools/HackStudio/Editor.cpp +++ b/DevTools/HackStudio/Editor.cpp @@ -48,7 +48,7 @@ Editor::Editor() m_documentation_tooltip_window = GUI::Window::construct(); m_documentation_tooltip_window->set_rect(0, 0, 500, 400); m_documentation_tooltip_window->set_window_type(GUI::WindowType::Tooltip); - m_documentation_html_view = m_documentation_tooltip_window->set_main_widget(); + m_documentation_html_view = m_documentation_tooltip_window->set_main_widget(); } Editor::~Editor() @@ -145,7 +145,7 @@ void Editor::show_documentation_tooltip_if_available(const String& hovered_token auto html_text = man_document.render_to_html(); - auto html_document = parse_html_document(html_text); + auto html_document = Web::parse_html_document(html_text); if (!html_document) { dbg() << "failed to parse HTML"; return; @@ -153,10 +153,10 @@ void Editor::show_documentation_tooltip_if_available(const String& hovered_token // FIXME: LibHTML needs a friendlier DOM manipulation API. Something like innerHTML :^) auto style_element = create_element(*html_document, "style"); - style_element->append_child(adopt(*new Text(*html_document, "body { background-color: #dac7b5; }"))); + style_element->append_child(adopt(*new Web::Text(*html_document, "body { background-color: #dac7b5; }"))); // FIXME: This const_cast should not be necessary. - auto* head_element = const_cast(html_document->head()); + auto* head_element = const_cast(html_document->head()); ASSERT(head_element); head_element->append_child(style_element); diff --git a/DevTools/HackStudio/Editor.h b/DevTools/HackStudio/Editor.h index cd1fa0693e..3df2f8816f 100644 --- a/DevTools/HackStudio/Editor.h +++ b/DevTools/HackStudio/Editor.h @@ -27,9 +27,9 @@ #pragma once #include +#include class EditorWrapper; -class HtmlView; class Editor final : public GUI::TextEditor { C_OBJECT(Editor) @@ -52,6 +52,6 @@ private: explicit Editor(); RefPtr m_documentation_tooltip_window; - RefPtr m_documentation_html_view; + RefPtr m_documentation_html_view; String m_last_parsed_token; }; diff --git a/Kernel/VM/Region.cpp b/Kernel/VM/Region.cpp index be4597803d..de81f750bb 100644 --- a/Kernel/VM/Region.cpp +++ b/Kernel/VM/Region.cpp @@ -309,7 +309,8 @@ PageFaultResponse Region::handle_fault(const PageFault& fault) } return handle_zero_fault(page_index_in_region); #else - ASSERT_NOT_REACHED(); + dbg() << "BUG! Unexpected NP fault at " << fault.vaddr(); + return PageFaultResponse::ShouldCrash; #endif } ASSERT(fault.type() == PageFault::Type::ProtectionViolation); diff --git a/Libraries/LibC/libcinit.cpp b/Libraries/LibC/libcinit.cpp index a206fc5c18..8aba7a62b5 100644 --- a/Libraries/LibC/libcinit.cpp +++ b/Libraries/LibC/libcinit.cpp @@ -50,7 +50,7 @@ void __libc_init() } extern u32 __stack_chk_guard; -u32 __stack_chk_guard = (u32)0xc0000c13; +u32 __stack_chk_guard = (u32)0xc6c7c8c9; [[noreturn]] void __stack_chk_fail() { diff --git a/Libraries/LibHTML/CSS/Length.h b/Libraries/LibHTML/CSS/Length.h index 219d8b69b0..612c1cf49f 100644 --- a/Libraries/LibHTML/CSS/Length.h +++ b/Libraries/LibHTML/CSS/Length.h @@ -28,6 +28,8 @@ #include +namespace Web { + class Length { public: enum class Type { @@ -76,3 +78,5 @@ inline const LogStream& operator<<(const LogStream& stream, const Length& value) { return stream << value.to_string(); } + +} diff --git a/Libraries/LibHTML/CSS/LengthBox.h b/Libraries/LibHTML/CSS/LengthBox.h index a87b128ec6..1ab356ff50 100644 --- a/Libraries/LibHTML/CSS/LengthBox.h +++ b/Libraries/LibHTML/CSS/LengthBox.h @@ -28,9 +28,13 @@ #include +namespace Web { + struct LengthBox { Length top; Length right; Length bottom; Length left; }; + +} diff --git a/Libraries/LibHTML/CSS/Selector.cpp b/Libraries/LibHTML/CSS/Selector.cpp index dc4a0d1ea8..064fe15984 100644 --- a/Libraries/LibHTML/CSS/Selector.cpp +++ b/Libraries/LibHTML/CSS/Selector.cpp @@ -26,6 +26,8 @@ #include +namespace Web { + Selector::Selector(Vector&& component_lists) : m_complex_selectors(move(component_lists)) { @@ -61,3 +63,5 @@ Specificity Selector::specificity() const return { ids, classes, tag_names }; } + +} diff --git a/Libraries/LibHTML/CSS/Selector.h b/Libraries/LibHTML/CSS/Selector.h index 3ae949615d..979080a187 100644 --- a/Libraries/LibHTML/CSS/Selector.h +++ b/Libraries/LibHTML/CSS/Selector.h @@ -30,6 +30,8 @@ #include #include +namespace Web { + class Selector { public: struct SimpleSelector { @@ -90,3 +92,5 @@ public: private: Vector m_complex_selectors; }; + +} diff --git a/Libraries/LibHTML/CSS/SelectorEngine.cpp b/Libraries/LibHTML/CSS/SelectorEngine.cpp index b541985850..e9f46a3fee 100644 --- a/Libraries/LibHTML/CSS/SelectorEngine.cpp +++ b/Libraries/LibHTML/CSS/SelectorEngine.cpp @@ -29,6 +29,8 @@ #include #include +namespace Web { + namespace SelectorEngine { static bool matches_hover_pseudo_class(const Element& element) @@ -146,3 +148,5 @@ bool matches(const Selector& selector, const Element& element) } } + +} diff --git a/Libraries/LibHTML/CSS/SelectorEngine.h b/Libraries/LibHTML/CSS/SelectorEngine.h index e625b8a418..8017697ad1 100644 --- a/Libraries/LibHTML/CSS/SelectorEngine.h +++ b/Libraries/LibHTML/CSS/SelectorEngine.h @@ -28,6 +28,8 @@ #include +namespace Web { + class Element; namespace SelectorEngine { @@ -35,3 +37,5 @@ namespace SelectorEngine { bool matches(const Selector&, const Element&); } + +} diff --git a/Libraries/LibHTML/CSS/Specificity.h b/Libraries/LibHTML/CSS/Specificity.h index 7a6887eb20..360a7f852b 100644 --- a/Libraries/LibHTML/CSS/Specificity.h +++ b/Libraries/LibHTML/CSS/Specificity.h @@ -26,6 +26,8 @@ #pragma once +namespace Web { + class Specificity { public: Specificity(unsigned ids, unsigned classes, unsigned tag_names) @@ -58,3 +60,5 @@ private: unsigned m_classes { 0 }; unsigned m_tag_names { 0 }; }; + +} diff --git a/Libraries/LibHTML/CSS/StyleDeclaration.cpp b/Libraries/LibHTML/CSS/StyleDeclaration.cpp index 259d674d8c..0ffd87beee 100644 --- a/Libraries/LibHTML/CSS/StyleDeclaration.cpp +++ b/Libraries/LibHTML/CSS/StyleDeclaration.cpp @@ -26,6 +26,8 @@ #include +namespace Web { + StyleDeclaration::StyleDeclaration(Vector&& properties) : m_properties(move(properties)) { @@ -34,3 +36,5 @@ StyleDeclaration::StyleDeclaration(Vector&& properties) StyleDeclaration::~StyleDeclaration() { } + +} diff --git a/Libraries/LibHTML/CSS/StyleDeclaration.h b/Libraries/LibHTML/CSS/StyleDeclaration.h index ebe8a6d3ca..9ef3db3372 100644 --- a/Libraries/LibHTML/CSS/StyleDeclaration.h +++ b/Libraries/LibHTML/CSS/StyleDeclaration.h @@ -30,6 +30,8 @@ #include #include +namespace Web { + struct StyleProperty { CSS::PropertyID property_id; NonnullRefPtr value; @@ -52,3 +54,5 @@ public: Vector m_properties; }; + +} diff --git a/Libraries/LibHTML/CSS/StyleProperties.cpp b/Libraries/LibHTML/CSS/StyleProperties.cpp index 4b6835d03d..645f180d22 100644 --- a/Libraries/LibHTML/CSS/StyleProperties.cpp +++ b/Libraries/LibHTML/CSS/StyleProperties.cpp @@ -29,6 +29,8 @@ #include #include +namespace Web { + StyleProperties::StyleProperties() { } @@ -177,3 +179,5 @@ bool StyleProperties::operator==(const StyleProperties& other) const return true; } + +} diff --git a/Libraries/LibHTML/CSS/StyleProperties.h b/Libraries/LibHTML/CSS/StyleProperties.h index 0ab63fd2c5..9540eba3da 100644 --- a/Libraries/LibHTML/CSS/StyleProperties.h +++ b/Libraries/LibHTML/CSS/StyleProperties.h @@ -32,6 +32,8 @@ #include #include +namespace Web { + class StyleProperties : public RefCounted { public: StyleProperties(); @@ -75,3 +77,5 @@ private: mutable RefPtr m_font; }; + +} diff --git a/Libraries/LibHTML/CSS/StyleResolver.cpp b/Libraries/LibHTML/CSS/StyleResolver.cpp index 958e7cb6b3..347cd6cefc 100644 --- a/Libraries/LibHTML/CSS/StyleResolver.cpp +++ b/Libraries/LibHTML/CSS/StyleResolver.cpp @@ -34,6 +34,8 @@ #include #include +namespace Web { + StyleResolver::StyleResolver(Document& document) : m_document(document) { @@ -294,3 +296,5 @@ NonnullRefPtr StyleResolver::resolve_style(const Element& eleme return style; } + +} diff --git a/Libraries/LibHTML/CSS/StyleResolver.h b/Libraries/LibHTML/CSS/StyleResolver.h index b1ab5d689b..325fef496d 100644 --- a/Libraries/LibHTML/CSS/StyleResolver.h +++ b/Libraries/LibHTML/CSS/StyleResolver.h @@ -30,6 +30,8 @@ #include #include +namespace Web { + class Document; class Element; class ParentNode; @@ -56,3 +58,5 @@ private: Document& m_document; }; + +} diff --git a/Libraries/LibHTML/CSS/StyleRule.cpp b/Libraries/LibHTML/CSS/StyleRule.cpp index f34a0c91d5..5fddcb5d2c 100644 --- a/Libraries/LibHTML/CSS/StyleRule.cpp +++ b/Libraries/LibHTML/CSS/StyleRule.cpp @@ -26,6 +26,8 @@ #include +namespace Web { + StyleRule::StyleRule(Vector&& selectors, NonnullRefPtr&& declaration) : m_selectors(move(selectors)) , m_declaration(move(declaration)) @@ -35,3 +37,5 @@ StyleRule::StyleRule(Vector&& selectors, NonnullRefPtr #include +namespace Web { + class StyleRule : public RefCounted { public: static NonnullRefPtr create(Vector&& selectors, NonnullRefPtr&& declaration) @@ -48,3 +50,5 @@ private: Vector m_selectors; NonnullRefPtr m_declaration; }; + +} diff --git a/Libraries/LibHTML/CSS/StyleSheet.cpp b/Libraries/LibHTML/CSS/StyleSheet.cpp index c9d4dc1f79..092abf7e10 100644 --- a/Libraries/LibHTML/CSS/StyleSheet.cpp +++ b/Libraries/LibHTML/CSS/StyleSheet.cpp @@ -26,6 +26,8 @@ #include +namespace Web { + StyleSheet::StyleSheet(NonnullRefPtrVector&& rules) : m_rules(move(rules)) { @@ -34,3 +36,5 @@ StyleSheet::StyleSheet(NonnullRefPtrVector&& rules) StyleSheet::~StyleSheet() { } + +} diff --git a/Libraries/LibHTML/CSS/StyleSheet.h b/Libraries/LibHTML/CSS/StyleSheet.h index 0f415804cb..0646c25e24 100644 --- a/Libraries/LibHTML/CSS/StyleSheet.h +++ b/Libraries/LibHTML/CSS/StyleSheet.h @@ -29,6 +29,8 @@ #include #include +namespace Web { + class StyleSheet : public RefCounted { public: static NonnullRefPtr create(NonnullRefPtrVector&& rules) @@ -45,3 +47,5 @@ private: NonnullRefPtrVector m_rules; }; + +} diff --git a/Libraries/LibHTML/CSS/StyleValue.cpp b/Libraries/LibHTML/CSS/StyleValue.cpp index 0a19807c81..6cc4f087d0 100644 --- a/Libraries/LibHTML/CSS/StyleValue.cpp +++ b/Libraries/LibHTML/CSS/StyleValue.cpp @@ -32,6 +32,8 @@ #include #include +namespace Web { + StyleValue::StyleValue(Type type) : m_type(type) { @@ -76,3 +78,5 @@ ImageStyleValue::ImageStyleValue(const URL& url, Document& document) m_document->frame()->set_needs_display({}); }); } + +} diff --git a/Libraries/LibHTML/CSS/StyleValue.h b/Libraries/LibHTML/CSS/StyleValue.h index b65677af0a..6dd1a3463d 100644 --- a/Libraries/LibHTML/CSS/StyleValue.h +++ b/Libraries/LibHTML/CSS/StyleValue.h @@ -37,6 +37,8 @@ #include #include +namespace Web { + class Document; namespace CSS { @@ -222,3 +224,5 @@ private: WeakPtr m_document; RefPtr m_bitmap; }; + +} diff --git a/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_cpp/Generate_CSS_PropertyID_cpp.cpp b/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_cpp/Generate_CSS_PropertyID_cpp.cpp index c8370ce700..c3491bbd32 100644 --- a/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_cpp/Generate_CSS_PropertyID_cpp.cpp +++ b/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_cpp/Generate_CSS_PropertyID_cpp.cpp @@ -60,6 +60,7 @@ int main(int argc, char** argv) dbg() << "#include "; dbg() << "#include "; + dbg() << "namespace Web {"; dbg() << "namespace CSS {"; dbg() << "PropertyID property_id_from_string(const StringView& string) {"; @@ -86,6 +87,7 @@ int main(int argc, char** argv) dbg() << " }"; dbg() << "}"; dbg() << "}"; + dbg() << "}"; return 0; } diff --git a/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_h/Generate_CSS_PropertyID_h.cpp b/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_h/Generate_CSS_PropertyID_h.cpp index 4b0973fe0a..8ebe39deee 100644 --- a/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_h/Generate_CSS_PropertyID_h.cpp +++ b/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_h/Generate_CSS_PropertyID_h.cpp @@ -62,6 +62,7 @@ int main(int argc, char** argv) dbg() << "#include "; dbg() << "#include "; + dbg() << "namespace Web {"; dbg() << "namespace CSS {"; dbg() << "enum class PropertyID {"; dbg() << " Invalid,"; @@ -75,11 +76,12 @@ int main(int argc, char** argv) PropertyID property_id_from_string(const StringView&);\n\ const char* string_from_property_id(PropertyID);\n\ }\n\ +}\n\ \n\ namespace AK {\n\ template<>\n\ -struct Traits : public GenericTraits {\n\ - static unsigned hash(CSS::PropertyID property_id) { return int_hash((unsigned)property_id); }\n\ +struct Traits : public GenericTraits {\n\ + static unsigned hash(Web::CSS::PropertyID property_id) { return int_hash((unsigned)property_id); }\n\ };\n\ }\n"; diff --git a/Libraries/LibHTML/DOM/CharacterData.cpp b/Libraries/LibHTML/DOM/CharacterData.cpp index 5af2d39fb0..83b14fb54a 100644 --- a/Libraries/LibHTML/DOM/CharacterData.cpp +++ b/Libraries/LibHTML/DOM/CharacterData.cpp @@ -26,6 +26,8 @@ #include +namespace Web { + CharacterData::CharacterData(Document& document, NodeType type, const String& data) : Node(document, type) , m_data(data) @@ -35,3 +37,5 @@ CharacterData::CharacterData(Document& document, NodeType type, const String& da CharacterData::~CharacterData() { } + +} diff --git a/Libraries/LibHTML/DOM/CharacterData.h b/Libraries/LibHTML/DOM/CharacterData.h index 39a8efea56..81533bfaad 100644 --- a/Libraries/LibHTML/DOM/CharacterData.h +++ b/Libraries/LibHTML/DOM/CharacterData.h @@ -29,6 +29,8 @@ #include #include +namespace Web { + class CharacterData : public Node { public: virtual ~CharacterData() override; @@ -49,3 +51,5 @@ inline bool is(const Node& node) { return node.is_character_data(); } + +} diff --git a/Libraries/LibHTML/DOM/Comment.cpp b/Libraries/LibHTML/DOM/Comment.cpp index 8a2906b03f..18c581a427 100644 --- a/Libraries/LibHTML/DOM/Comment.cpp +++ b/Libraries/LibHTML/DOM/Comment.cpp @@ -27,6 +27,8 @@ #include #include +namespace Web { + Comment::Comment(Document& document, const String& data) : CharacterData(document, NodeType::COMMENT_NODE, data) { @@ -35,3 +37,5 @@ Comment::Comment(Document& document, const String& data) Comment::~Comment() { } + +} diff --git a/Libraries/LibHTML/DOM/Comment.h b/Libraries/LibHTML/DOM/Comment.h index 7e925b8bf3..75bfd215c0 100644 --- a/Libraries/LibHTML/DOM/Comment.h +++ b/Libraries/LibHTML/DOM/Comment.h @@ -29,6 +29,8 @@ #include #include +namespace Web { + class Comment final : public CharacterData { public: explicit Comment(Document&, const String&); @@ -42,3 +44,5 @@ inline bool is(const Node& node) { return node.is_comment(); } + +} diff --git a/Libraries/LibHTML/DOM/Document.cpp b/Libraries/LibHTML/DOM/Document.cpp index 5243bf9a5d..ae24ec4dde 100644 --- a/Libraries/LibHTML/DOM/Document.cpp +++ b/Libraries/LibHTML/DOM/Document.cpp @@ -43,6 +43,8 @@ #include #include +namespace Web { + Document::Document() : ParentNode(*this, NodeType::DOCUMENT_NODE) , m_style_resolver(make(*this)) @@ -329,3 +331,5 @@ Color Document::visited_link_color() const return Color::Magenta; return frame()->html_view()->palette().visited_link(); } + +} diff --git a/Libraries/LibHTML/DOM/Document.h b/Libraries/LibHTML/DOM/Document.h index df43e48830..6f7ab80cc0 100644 --- a/Libraries/LibHTML/DOM/Document.h +++ b/Libraries/LibHTML/DOM/Document.h @@ -37,6 +37,8 @@ #include #include +namespace Web { + class Frame; class HTMLBodyElement; class HTMLHtmlElement; @@ -144,3 +146,5 @@ inline bool is(const Node& node) { return node.is_document(); } + +} diff --git a/Libraries/LibHTML/DOM/DocumentFragment.h b/Libraries/LibHTML/DOM/DocumentFragment.h index 0852d0ee19..6034819d55 100644 --- a/Libraries/LibHTML/DOM/DocumentFragment.h +++ b/Libraries/LibHTML/DOM/DocumentFragment.h @@ -28,6 +28,8 @@ #include +namespace Web { + class DocumentFragment : public ParentNode { public: DocumentFragment(Document& document) @@ -43,3 +45,5 @@ inline bool is(const Node& node) { return node.is_document_fragment(); } + +} diff --git a/Libraries/LibHTML/DOM/DocumentType.cpp b/Libraries/LibHTML/DOM/DocumentType.cpp index bd7af2019b..43e95e153a 100644 --- a/Libraries/LibHTML/DOM/DocumentType.cpp +++ b/Libraries/LibHTML/DOM/DocumentType.cpp @@ -26,6 +26,8 @@ #include +namespace Web { + DocumentType::DocumentType(Document& document) : Node(document, NodeType::DOCUMENT_TYPE_NODE) { @@ -34,3 +36,5 @@ DocumentType::DocumentType(Document& document) DocumentType::~DocumentType() { } + +} diff --git a/Libraries/LibHTML/DOM/DocumentType.h b/Libraries/LibHTML/DOM/DocumentType.h index 8ec070b3d3..60b9871768 100644 --- a/Libraries/LibHTML/DOM/DocumentType.h +++ b/Libraries/LibHTML/DOM/DocumentType.h @@ -28,6 +28,8 @@ #include +namespace Web { + class DocumentType final : public Node { public: explicit DocumentType(Document&); @@ -41,3 +43,5 @@ inline bool is(const Node& node) { return node.type() == NodeType::DOCUMENT_TYPE_NODE; } + +} diff --git a/Libraries/LibHTML/DOM/Element.cpp b/Libraries/LibHTML/DOM/Element.cpp index 5e19268593..ea35b90d60 100644 --- a/Libraries/LibHTML/DOM/Element.cpp +++ b/Libraries/LibHTML/DOM/Element.cpp @@ -37,6 +37,8 @@ #include #include +namespace Web { + Element::Element(Document& document, const String& tag_name) : ParentNode(document, NodeType::ELEMENT_NODE) , m_tag_name(tag_name) @@ -215,3 +217,5 @@ NonnullRefPtr Element::computed_style() } return properties; } + +} diff --git a/Libraries/LibHTML/DOM/Element.h b/Libraries/LibHTML/DOM/Element.h index f13da5153a..6039807e06 100644 --- a/Libraries/LibHTML/DOM/Element.h +++ b/Libraries/LibHTML/DOM/Element.h @@ -30,6 +30,8 @@ #include #include +namespace Web { + class LayoutNodeWithStyle; class Attribute { @@ -102,3 +104,5 @@ inline bool is(const Node& node) { return node.is_element(); } + +} diff --git a/Libraries/LibHTML/DOM/ElementFactory.cpp b/Libraries/LibHTML/DOM/ElementFactory.cpp index 88e01530a2..5055fcc658 100644 --- a/Libraries/LibHTML/DOM/ElementFactory.cpp +++ b/Libraries/LibHTML/DOM/ElementFactory.cpp @@ -41,6 +41,8 @@ #include #include +namespace Web { + NonnullRefPtr create_element(Document& document, const String& tag_name) { auto lowercase_tag_name = tag_name.to_lowercase(); @@ -82,3 +84,5 @@ NonnullRefPtr create_element(Document& document, const String& tag_name } return adopt(*new Element(document, lowercase_tag_name)); } + +} diff --git a/Libraries/LibHTML/DOM/ElementFactory.h b/Libraries/LibHTML/DOM/ElementFactory.h index 91b3244392..0a87c672d1 100644 --- a/Libraries/LibHTML/DOM/ElementFactory.h +++ b/Libraries/LibHTML/DOM/ElementFactory.h @@ -28,4 +28,8 @@ #include +namespace Web { + NonnullRefPtr create_element(Document&, const String& tag_name); + +} diff --git a/Libraries/LibHTML/DOM/HTMLAnchorElement.cpp b/Libraries/LibHTML/DOM/HTMLAnchorElement.cpp index 9e8d3fbc33..b763512d8b 100644 --- a/Libraries/LibHTML/DOM/HTMLAnchorElement.cpp +++ b/Libraries/LibHTML/DOM/HTMLAnchorElement.cpp @@ -26,6 +26,8 @@ #include +namespace Web { + HTMLAnchorElement::HTMLAnchorElement(Document& document, const String& tag_name) : HTMLElement(document, tag_name) { @@ -34,3 +36,5 @@ HTMLAnchorElement::HTMLAnchorElement(Document& document, const String& tag_name) HTMLAnchorElement::~HTMLAnchorElement() { } + +} diff --git a/Libraries/LibHTML/DOM/HTMLAnchorElement.h b/Libraries/LibHTML/DOM/HTMLAnchorElement.h index 21b699099c..8f91354f91 100644 --- a/Libraries/LibHTML/DOM/HTMLAnchorElement.h +++ b/Libraries/LibHTML/DOM/HTMLAnchorElement.h @@ -28,6 +28,8 @@ #include +namespace Web { + class HTMLAnchorElement : public HTMLElement { public: HTMLAnchorElement(Document&, const String& tag_name); @@ -41,3 +43,5 @@ inline bool is(const Node& node) { return is(node) && to(node).tag_name().to_lowercase() == "a"; } + +} diff --git a/Libraries/LibHTML/DOM/HTMLBRElement.cpp b/Libraries/LibHTML/DOM/HTMLBRElement.cpp index 28e294cad0..7eb7eb1e90 100644 --- a/Libraries/LibHTML/DOM/HTMLBRElement.cpp +++ b/Libraries/LibHTML/DOM/HTMLBRElement.cpp @@ -27,6 +27,8 @@ #include #include +namespace Web { + HTMLBRElement::HTMLBRElement(Document& document, const String& tag_name) : HTMLElement(document, tag_name) { @@ -40,3 +42,5 @@ RefPtr HTMLBRElement::create_layout_node(const StyleProperties*) con { return adopt(*new LayoutBreak(*this)); } + +} diff --git a/Libraries/LibHTML/DOM/HTMLBRElement.h b/Libraries/LibHTML/DOM/HTMLBRElement.h index 3304fea8fd..21181b9c89 100644 --- a/Libraries/LibHTML/DOM/HTMLBRElement.h +++ b/Libraries/LibHTML/DOM/HTMLBRElement.h @@ -28,6 +28,8 @@ #include +namespace Web { + class HTMLBRElement final : public HTMLElement { public: HTMLBRElement(Document&, const String& tag_name); @@ -41,3 +43,5 @@ inline bool is(const Node& node) { return is(node) && to(node).tag_name().to_lowercase() == "br"; } + +} diff --git a/Libraries/LibHTML/DOM/HTMLBlinkElement.cpp b/Libraries/LibHTML/DOM/HTMLBlinkElement.cpp index 38bdc15cb1..940989c459 100644 --- a/Libraries/LibHTML/DOM/HTMLBlinkElement.cpp +++ b/Libraries/LibHTML/DOM/HTMLBlinkElement.cpp @@ -30,6 +30,8 @@ #include #include +namespace Web { + HTMLBlinkElement::HTMLBlinkElement(Document& document, const String& tag_name) : HTMLElement(document, tag_name) , m_timer(Core::Timer::construct()) @@ -51,3 +53,5 @@ void HTMLBlinkElement::blink() layout_node()->set_visible(!layout_node()->is_visible()); layout_node()->set_needs_display(); } + +} diff --git a/Libraries/LibHTML/DOM/HTMLBlinkElement.h b/Libraries/LibHTML/DOM/HTMLBlinkElement.h index 3cb5b350d4..cb093ce5d5 100644 --- a/Libraries/LibHTML/DOM/HTMLBlinkElement.h +++ b/Libraries/LibHTML/DOM/HTMLBlinkElement.h @@ -29,6 +29,8 @@ #include #include +namespace Web { + class HTMLBlinkElement : public HTMLElement { public: HTMLBlinkElement(Document&, const String& tag_name); @@ -39,3 +41,5 @@ private: NonnullRefPtr m_timer; }; + +} diff --git a/Libraries/LibHTML/DOM/HTMLBodyElement.cpp b/Libraries/LibHTML/DOM/HTMLBodyElement.cpp index 0068c3846a..62abfd188d 100644 --- a/Libraries/LibHTML/DOM/HTMLBodyElement.cpp +++ b/Libraries/LibHTML/DOM/HTMLBodyElement.cpp @@ -29,6 +29,8 @@ #include #include +namespace Web { + HTMLBodyElement::HTMLBodyElement(Document& document, const String& tag_name) : HTMLElement(document, tag_name) { @@ -71,3 +73,5 @@ void HTMLBodyElement::parse_attribute(const String& name, const String& value) document().set_visited_link_color(color.value()); } } + +} diff --git a/Libraries/LibHTML/DOM/HTMLBodyElement.h b/Libraries/LibHTML/DOM/HTMLBodyElement.h index fc0b8f8c01..1f757cb324 100644 --- a/Libraries/LibHTML/DOM/HTMLBodyElement.h +++ b/Libraries/LibHTML/DOM/HTMLBodyElement.h @@ -28,6 +28,8 @@ #include +namespace Web { + class HTMLBodyElement : public HTMLElement { public: HTMLBodyElement(Document&, const String& tag_name); @@ -42,3 +44,5 @@ inline bool is(const Node& node) { return is(node) && to(node).tag_name().to_lowercase() == "body"; } + +} diff --git a/Libraries/LibHTML/DOM/HTMLElement.cpp b/Libraries/LibHTML/DOM/HTMLElement.cpp index 058b32ae35..0f1214278c 100644 --- a/Libraries/LibHTML/DOM/HTMLElement.cpp +++ b/Libraries/LibHTML/DOM/HTMLElement.cpp @@ -26,6 +26,8 @@ #include +namespace Web { + HTMLElement::HTMLElement(Document& document, const String& tag_name) : Element(document, tag_name) { @@ -34,3 +36,5 @@ HTMLElement::HTMLElement(Document& document, const String& tag_name) HTMLElement::~HTMLElement() { } + +} diff --git a/Libraries/LibHTML/DOM/HTMLElement.h b/Libraries/LibHTML/DOM/HTMLElement.h index 813b185ada..912ac898d9 100644 --- a/Libraries/LibHTML/DOM/HTMLElement.h +++ b/Libraries/LibHTML/DOM/HTMLElement.h @@ -28,6 +28,8 @@ #include +namespace Web { + class HTMLElement : public Element { public: HTMLElement(Document&, const String& tag_name); @@ -44,3 +46,5 @@ inline bool is(const Node& node) { return node.is_html_element(); } + +} diff --git a/Libraries/LibHTML/DOM/HTMLFontElement.cpp b/Libraries/LibHTML/DOM/HTMLFontElement.cpp index 276cd0db69..9e5ac54558 100644 --- a/Libraries/LibHTML/DOM/HTMLFontElement.cpp +++ b/Libraries/LibHTML/DOM/HTMLFontElement.cpp @@ -28,6 +28,8 @@ #include #include +namespace Web { + HTMLFontElement::HTMLFontElement(Document& document, const String& tag_name) : HTMLElement(document, tag_name) { @@ -47,3 +49,5 @@ void HTMLFontElement::apply_presentational_hints(StyleProperties& style) const } }); } + +} diff --git a/Libraries/LibHTML/DOM/HTMLFontElement.h b/Libraries/LibHTML/DOM/HTMLFontElement.h index 74cfe8d1c7..96503115e7 100644 --- a/Libraries/LibHTML/DOM/HTMLFontElement.h +++ b/Libraries/LibHTML/DOM/HTMLFontElement.h @@ -28,6 +28,8 @@ #include +namespace Web { + class HTMLFontElement : public HTMLElement { public: HTMLFontElement(Document&, const String& tag_name); @@ -35,3 +37,5 @@ public: virtual void apply_presentational_hints(StyleProperties&) const override; }; + +} diff --git a/Libraries/LibHTML/DOM/HTMLFormElement.cpp b/Libraries/LibHTML/DOM/HTMLFormElement.cpp index 20bcf4ec8a..a0f2df04e0 100644 --- a/Libraries/LibHTML/DOM/HTMLFormElement.cpp +++ b/Libraries/LibHTML/DOM/HTMLFormElement.cpp @@ -30,6 +30,8 @@ #include #include +namespace Web { + HTMLFormElement::HTMLFormElement(Document& document, const String& tag_name) : HTMLElement(document, tag_name) { @@ -80,3 +82,5 @@ void HTMLFormElement::submit() // FIXME: We shouldn't let the form just do this willy-nilly. document().frame()->html_view()->load(url); } + +} diff --git a/Libraries/LibHTML/DOM/HTMLFormElement.h b/Libraries/LibHTML/DOM/HTMLFormElement.h index 00a3d41683..51cbf13bbd 100644 --- a/Libraries/LibHTML/DOM/HTMLFormElement.h +++ b/Libraries/LibHTML/DOM/HTMLFormElement.h @@ -28,6 +28,8 @@ #include +namespace Web { + class HTMLFormElement : public HTMLElement { public: HTMLFormElement(Document&, const String& tag_name); @@ -44,3 +46,5 @@ inline bool is(const Node& node) { return is(node) && to(node).tag_name().to_lowercase() == "form"; } + +} diff --git a/Libraries/LibHTML/DOM/HTMLHRElement.cpp b/Libraries/LibHTML/DOM/HTMLHRElement.cpp index 12d695896b..b4436e6966 100644 --- a/Libraries/LibHTML/DOM/HTMLHRElement.cpp +++ b/Libraries/LibHTML/DOM/HTMLHRElement.cpp @@ -26,6 +26,8 @@ #include +namespace Web { + HTMLHRElement::HTMLHRElement(Document& document, const String& tag_name) : HTMLElement(document, tag_name) { @@ -34,3 +36,5 @@ HTMLHRElement::HTMLHRElement(Document& document, const String& tag_name) HTMLHRElement::~HTMLHRElement() { } + +} diff --git a/Libraries/LibHTML/DOM/HTMLHRElement.h b/Libraries/LibHTML/DOM/HTMLHRElement.h index bcf0b5a830..0b141d32a0 100644 --- a/Libraries/LibHTML/DOM/HTMLHRElement.h +++ b/Libraries/LibHTML/DOM/HTMLHRElement.h @@ -28,8 +28,12 @@ #include +namespace Web { + class HTMLHRElement : public HTMLElement { public: HTMLHRElement(Document&, const String& tag_name); virtual ~HTMLHRElement() override; }; + +} diff --git a/Libraries/LibHTML/DOM/HTMLHeadElement.cpp b/Libraries/LibHTML/DOM/HTMLHeadElement.cpp index a6470ceace..7191d3b3c9 100644 --- a/Libraries/LibHTML/DOM/HTMLHeadElement.cpp +++ b/Libraries/LibHTML/DOM/HTMLHeadElement.cpp @@ -26,6 +26,8 @@ #include +namespace Web { + HTMLHeadElement::HTMLHeadElement(Document& document, const String& tag_name) : HTMLElement(document, tag_name) { @@ -34,3 +36,5 @@ HTMLHeadElement::HTMLHeadElement(Document& document, const String& tag_name) HTMLHeadElement::~HTMLHeadElement() { } + +} diff --git a/Libraries/LibHTML/DOM/HTMLHeadElement.h b/Libraries/LibHTML/DOM/HTMLHeadElement.h index aada9a4676..e769346987 100644 --- a/Libraries/LibHTML/DOM/HTMLHeadElement.h +++ b/Libraries/LibHTML/DOM/HTMLHeadElement.h @@ -28,6 +28,8 @@ #include +namespace Web { + class HTMLHeadElement : public HTMLElement { public: HTMLHeadElement(Document&, const String& tag_name); @@ -39,3 +41,5 @@ inline bool is(const Node& node) { return is(node) && to(node).tag_name().to_lowercase() == "head"; } + +} diff --git a/Libraries/LibHTML/DOM/HTMLHeadingElement.cpp b/Libraries/LibHTML/DOM/HTMLHeadingElement.cpp index 7e498fec3c..aad30884f3 100644 --- a/Libraries/LibHTML/DOM/HTMLHeadingElement.cpp +++ b/Libraries/LibHTML/DOM/HTMLHeadingElement.cpp @@ -26,6 +26,8 @@ #include +namespace Web { + HTMLHeadingElement::HTMLHeadingElement(Document& document, const String& tag_name) : HTMLElement(document, tag_name) { @@ -34,3 +36,5 @@ HTMLHeadingElement::HTMLHeadingElement(Document& document, const String& tag_nam HTMLHeadingElement::~HTMLHeadingElement() { } + +} diff --git a/Libraries/LibHTML/DOM/HTMLHeadingElement.h b/Libraries/LibHTML/DOM/HTMLHeadingElement.h index d38b3b4c57..54089ebc2e 100644 --- a/Libraries/LibHTML/DOM/HTMLHeadingElement.h +++ b/Libraries/LibHTML/DOM/HTMLHeadingElement.h @@ -28,8 +28,12 @@ #include +namespace Web { + class HTMLHeadingElement : public HTMLElement { public: HTMLHeadingElement(Document&, const String& tag_name); virtual ~HTMLHeadingElement() override; }; + +} diff --git a/Libraries/LibHTML/DOM/HTMLHtmlElement.cpp b/Libraries/LibHTML/DOM/HTMLHtmlElement.cpp index 5ae74c148f..576a50c765 100644 --- a/Libraries/LibHTML/DOM/HTMLHtmlElement.cpp +++ b/Libraries/LibHTML/DOM/HTMLHtmlElement.cpp @@ -26,6 +26,8 @@ #include +namespace Web { + HTMLHtmlElement::HTMLHtmlElement(Document& document, const String& tag_name) : HTMLElement(document, tag_name) { @@ -34,3 +36,5 @@ HTMLHtmlElement::HTMLHtmlElement(Document& document, const String& tag_name) HTMLHtmlElement::~HTMLHtmlElement() { } + +} diff --git a/Libraries/LibHTML/DOM/HTMLHtmlElement.h b/Libraries/LibHTML/DOM/HTMLHtmlElement.h index 168def22d7..673c80bc94 100644 --- a/Libraries/LibHTML/DOM/HTMLHtmlElement.h +++ b/Libraries/LibHTML/DOM/HTMLHtmlElement.h @@ -28,6 +28,8 @@ #include +namespace Web { + class HTMLHtmlElement : public HTMLElement { public: HTMLHtmlElement(Document&, const String& tag_name); @@ -39,3 +41,5 @@ inline bool is(const Node& node) { return is(node) && to(node).tag_name().to_lowercase() == "html"; } + +} diff --git a/Libraries/LibHTML/DOM/HTMLImageElement.cpp b/Libraries/LibHTML/DOM/HTMLImageElement.cpp index 0fcb61267f..316b6c0ce2 100644 --- a/Libraries/LibHTML/DOM/HTMLImageElement.cpp +++ b/Libraries/LibHTML/DOM/HTMLImageElement.cpp @@ -32,6 +32,8 @@ #include #include +namespace Web { + HTMLImageElement::HTMLImageElement(Document& document, const String& tag_name) : HTMLElement(document, tag_name) { @@ -121,3 +123,5 @@ void HTMLImageElement::set_volatile(Badge, bool v) return; m_image_decoder = Gfx::ImageDecoder::create(m_encoded_data.data(), m_encoded_data.size()); } + +} diff --git a/Libraries/LibHTML/DOM/HTMLImageElement.h b/Libraries/LibHTML/DOM/HTMLImageElement.h index d1c32b8efc..d4b412c12f 100644 --- a/Libraries/LibHTML/DOM/HTMLImageElement.h +++ b/Libraries/LibHTML/DOM/HTMLImageElement.h @@ -30,6 +30,8 @@ #include #include +namespace Web { + class LayoutDocument; class HTMLImageElement : public HTMLElement { @@ -57,3 +59,5 @@ private: RefPtr m_image_decoder; ByteBuffer m_encoded_data; }; + +} diff --git a/Libraries/LibHTML/DOM/HTMLInputElement.cpp b/Libraries/LibHTML/DOM/HTMLInputElement.cpp index 67753e3aea..0924c123c9 100644 --- a/Libraries/LibHTML/DOM/HTMLInputElement.cpp +++ b/Libraries/LibHTML/DOM/HTMLInputElement.cpp @@ -34,6 +34,8 @@ #include #include +namespace Web { + HTMLInputElement::HTMLInputElement(Document& document, const String& tag_name) : HTMLElement(document, tag_name) { @@ -76,3 +78,5 @@ RefPtr HTMLInputElement::create_layout_node(const StyleProperties*) return adopt(*new LayoutWidget(*this, *widget)); } + +} diff --git a/Libraries/LibHTML/DOM/HTMLInputElement.h b/Libraries/LibHTML/DOM/HTMLInputElement.h index 264a03b847..c4100d4526 100644 --- a/Libraries/LibHTML/DOM/HTMLInputElement.h +++ b/Libraries/LibHTML/DOM/HTMLInputElement.h @@ -28,6 +28,8 @@ #include +namespace Web { + class HTMLInputElement : public HTMLElement { public: HTMLInputElement(Document&, const String& tag_name); @@ -45,3 +47,5 @@ inline bool is(const Node& node) { return is(node) && to(node).tag_name().to_lowercase() == "input"; } + +} diff --git a/Libraries/LibHTML/DOM/HTMLLinkElement.cpp b/Libraries/LibHTML/DOM/HTMLLinkElement.cpp index bf9e79ff68..71083c88dd 100644 --- a/Libraries/LibHTML/DOM/HTMLLinkElement.cpp +++ b/Libraries/LibHTML/DOM/HTMLLinkElement.cpp @@ -32,6 +32,8 @@ #include #include +namespace Web { + HTMLLinkElement::HTMLLinkElement(Document& document, const String& tag_name) : HTMLElement(document, tag_name) { @@ -60,3 +62,5 @@ void HTMLLinkElement::inserted_into(Node&) }); } } + +} diff --git a/Libraries/LibHTML/DOM/HTMLLinkElement.h b/Libraries/LibHTML/DOM/HTMLLinkElement.h index 6a46f4b9ec..1e9176e148 100644 --- a/Libraries/LibHTML/DOM/HTMLLinkElement.h +++ b/Libraries/LibHTML/DOM/HTMLLinkElement.h @@ -28,6 +28,8 @@ #include +namespace Web { + class HTMLLinkElement final : public HTMLElement { public: HTMLLinkElement(Document&, const String& tag_name); @@ -45,3 +47,5 @@ inline bool is(const Node& node) { return is(node) && to(node).tag_name().to_lowercase() == "link"; } + +} diff --git a/Libraries/LibHTML/DOM/HTMLStyleElement.cpp b/Libraries/LibHTML/DOM/HTMLStyleElement.cpp index 7a6bf17125..865d0b264a 100644 --- a/Libraries/LibHTML/DOM/HTMLStyleElement.cpp +++ b/Libraries/LibHTML/DOM/HTMLStyleElement.cpp @@ -30,6 +30,8 @@ #include #include +namespace Web { + HTMLStyleElement::HTMLStyleElement(Document& document, const String& tag_name) : HTMLElement(document, tag_name) { @@ -59,3 +61,5 @@ void HTMLStyleElement::removed_from(Node& old_parent) } return HTMLElement::removed_from(old_parent); } + +} diff --git a/Libraries/LibHTML/DOM/HTMLStyleElement.h b/Libraries/LibHTML/DOM/HTMLStyleElement.h index 89735e526e..deb54387c3 100644 --- a/Libraries/LibHTML/DOM/HTMLStyleElement.h +++ b/Libraries/LibHTML/DOM/HTMLStyleElement.h @@ -28,6 +28,8 @@ #include +namespace Web { + class StyleSheet; class HTMLStyleElement : public HTMLElement { @@ -41,3 +43,5 @@ public: private: RefPtr m_stylesheet; }; + +} diff --git a/Libraries/LibHTML/DOM/HTMLTitleElement.cpp b/Libraries/LibHTML/DOM/HTMLTitleElement.cpp index 1ef15bf8c3..6aa5b699db 100644 --- a/Libraries/LibHTML/DOM/HTMLTitleElement.cpp +++ b/Libraries/LibHTML/DOM/HTMLTitleElement.cpp @@ -26,6 +26,8 @@ #include +namespace Web { + HTMLTitleElement::HTMLTitleElement(Document& document, const String& tag_name) : HTMLElement(document, tag_name) { @@ -34,3 +36,5 @@ HTMLTitleElement::HTMLTitleElement(Document& document, const String& tag_name) HTMLTitleElement::~HTMLTitleElement() { } + +} diff --git a/Libraries/LibHTML/DOM/HTMLTitleElement.h b/Libraries/LibHTML/DOM/HTMLTitleElement.h index 4343fbb2f2..c5731d5f46 100644 --- a/Libraries/LibHTML/DOM/HTMLTitleElement.h +++ b/Libraries/LibHTML/DOM/HTMLTitleElement.h @@ -28,6 +28,8 @@ #include +namespace Web { + class HTMLTitleElement : public HTMLElement { public: HTMLTitleElement(Document&, const String& tag_name); @@ -39,3 +41,5 @@ inline bool is(const Node& node) { return is(node) && to(node).tag_name().to_lowercase() == "title"; } + +} diff --git a/Libraries/LibHTML/DOM/Node.cpp b/Libraries/LibHTML/DOM/Node.cpp index 7e02a861f2..7f46574414 100644 --- a/Libraries/LibHTML/DOM/Node.cpp +++ b/Libraries/LibHTML/DOM/Node.cpp @@ -35,6 +35,8 @@ #include #include +namespace Web { + Node::Node(Document& document, NodeType type) : m_document(document) , m_type(type) @@ -114,3 +116,5 @@ bool Node::is_link() const return false; return enclosing_link->has_attribute("href"); } + +} diff --git a/Libraries/LibHTML/DOM/Node.h b/Libraries/LibHTML/DOM/Node.h index ebe23c028c..5d83911479 100644 --- a/Libraries/LibHTML/DOM/Node.h +++ b/Libraries/LibHTML/DOM/Node.h @@ -32,6 +32,8 @@ #include #include +namespace Web { + enum class NodeType : unsigned { INVALID = 0, ELEMENT_NODE = 1, @@ -185,3 +187,5 @@ inline const T* Node::first_ancestor_of_type() const } return nullptr; } + +} diff --git a/Libraries/LibHTML/DOM/ParentNode.h b/Libraries/LibHTML/DOM/ParentNode.h index 277db60daa..48c6bd5e2a 100644 --- a/Libraries/LibHTML/DOM/ParentNode.h +++ b/Libraries/LibHTML/DOM/ParentNode.h @@ -28,6 +28,8 @@ #include +namespace Web { + class ParentNode : public Node { public: template void for_each_child(F) const; @@ -53,3 +55,5 @@ inline void ParentNode::for_each_child(Callback callback) for (auto* node = first_child(); node; node = node->next_sibling()) callback(*node); } + +} diff --git a/Libraries/LibHTML/DOM/Text.cpp b/Libraries/LibHTML/DOM/Text.cpp index cd30c72609..c107b22bb9 100644 --- a/Libraries/LibHTML/DOM/Text.cpp +++ b/Libraries/LibHTML/DOM/Text.cpp @@ -27,6 +27,8 @@ #include #include +namespace Web { + Text::Text(Document& document, const String& data) : CharacterData(document, NodeType::TEXT_NODE, data) { @@ -40,3 +42,5 @@ RefPtr Text::create_layout_node(const StyleProperties*) const { return adopt(*new LayoutText(*this)); } + +} diff --git a/Libraries/LibHTML/DOM/Text.h b/Libraries/LibHTML/DOM/Text.h index d8bfd59141..e886b6d12f 100644 --- a/Libraries/LibHTML/DOM/Text.h +++ b/Libraries/LibHTML/DOM/Text.h @@ -29,6 +29,8 @@ #include #include +namespace Web { + class Text final : public CharacterData { public: explicit Text(Document&, const String&); @@ -45,3 +47,5 @@ inline bool is(const Node& node) { return node.is_text(); } + +} diff --git a/Libraries/LibHTML/DOMTreeModel.cpp b/Libraries/LibHTML/DOMTreeModel.cpp index bafb006e73..8535e3bd6f 100644 --- a/Libraries/LibHTML/DOMTreeModel.cpp +++ b/Libraries/LibHTML/DOMTreeModel.cpp @@ -32,6 +32,8 @@ #include #include +namespace Web { + DOMTreeModel::DOMTreeModel(Document& document) : m_document(document) { @@ -151,3 +153,5 @@ void DOMTreeModel::update() { did_update(); } + +} diff --git a/Libraries/LibHTML/DOMTreeModel.h b/Libraries/LibHTML/DOMTreeModel.h index c25fce7e43..9e498ca4ed 100644 --- a/Libraries/LibHTML/DOMTreeModel.h +++ b/Libraries/LibHTML/DOMTreeModel.h @@ -28,6 +28,8 @@ #include +namespace Web { + class Document; class DOMTreeModel final : public GUI::Model { @@ -55,3 +57,5 @@ private: GUI::Icon m_element_icon; GUI::Icon m_text_icon; }; + +} diff --git a/Libraries/LibHTML/Dump.cpp b/Libraries/LibHTML/Dump.cpp index fcdfe16360..b85105eb06 100644 --- a/Libraries/LibHTML/Dump.cpp +++ b/Libraries/LibHTML/Dump.cpp @@ -38,6 +38,8 @@ #include #include +namespace Web { + void dump_tree(const Node& node) { static int indent = 0; @@ -252,3 +254,5 @@ void dump_sheet(const StyleSheet& sheet) dump_rule(rule); } } + +} diff --git a/Libraries/LibHTML/Dump.h b/Libraries/LibHTML/Dump.h index fac96e7844..07b5a7e17c 100644 --- a/Libraries/LibHTML/Dump.h +++ b/Libraries/LibHTML/Dump.h @@ -26,6 +26,8 @@ #pragma once +namespace Web { + class Node; class LayoutNode; class StyleRule; @@ -37,3 +39,5 @@ void dump_sheet(const StyleSheet&); void dump_rule(const StyleRule&); #undef HTML_DEBUG + +} diff --git a/Libraries/LibHTML/Forward.h b/Libraries/LibHTML/Forward.h new file mode 100644 index 0000000000..d700b317c3 --- /dev/null +++ b/Libraries/LibHTML/Forward.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2020, Andreas Kling + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +namespace Web { + +class Document; +class Element; +class Frame; +class HtmlView; +class Node; + +} diff --git a/Libraries/LibHTML/Frame.cpp b/Libraries/LibHTML/Frame.cpp index 235adf2207..5559ce769b 100644 --- a/Libraries/LibHTML/Frame.cpp +++ b/Libraries/LibHTML/Frame.cpp @@ -29,6 +29,8 @@ #include #include +namespace Web { + Frame::Frame(HtmlView& html_view) : m_html_view(html_view.make_weak_ptr()) { @@ -78,3 +80,5 @@ void Frame::set_needs_display(const Gfx::Rect& rect) return; on_set_needs_display(rect); } + +} diff --git a/Libraries/LibHTML/Frame.h b/Libraries/LibHTML/Frame.h index 830653b45e..97a72b9d4f 100644 --- a/Libraries/LibHTML/Frame.h +++ b/Libraries/LibHTML/Frame.h @@ -34,6 +34,8 @@ #include #include +namespace Web { + class Document; class HtmlView; @@ -67,3 +69,5 @@ private: Gfx::Size m_size; Gfx::Rect m_viewport_rect; }; + +} diff --git a/Libraries/LibHTML/HtmlView.cpp b/Libraries/LibHTML/HtmlView.cpp index ea2178aab0..85c23c4700 100644 --- a/Libraries/LibHTML/HtmlView.cpp +++ b/Libraries/LibHTML/HtmlView.cpp @@ -25,6 +25,7 @@ */ #include +#include #include #include #include @@ -46,8 +47,10 @@ #include #include +namespace Web { + HtmlView::HtmlView() - : m_main_frame(::Frame::create(*this)) + : m_main_frame(Web::Frame::create(*this)) { main_frame().on_set_needs_display = [this](auto& content_rect) { if (content_rect.is_empty()) { @@ -320,7 +323,7 @@ static RefPtr create_image_document(const ByteBuffer& data, const URL& void HtmlView::load(const URL& url) { - dbg() << "HtmlView::load: " << url; + dbg() << "HtmlView::load: " << url.to_string(); if (window()) window()->set_override_cursor(GUI::StandardCursor::None); @@ -410,3 +413,5 @@ void HtmlView::did_scroll() { main_frame().set_viewport_rect(visible_content_rect()); } + +} diff --git a/Libraries/LibHTML/HtmlView.h b/Libraries/LibHTML/HtmlView.h index b38320afe0..f5efd9aaef 100644 --- a/Libraries/LibHTML/HtmlView.h +++ b/Libraries/LibHTML/HtmlView.h @@ -29,6 +29,8 @@ #include #include +namespace Web { + class Frame; class HtmlView : public GUI::ScrollableWidget { @@ -43,8 +45,8 @@ public: const LayoutDocument* layout_root() const; LayoutDocument* layout_root(); - ::Frame& main_frame() { return *m_main_frame; } - const ::Frame& main_frame() const { return *m_main_frame; } + Web::Frame& main_frame() { return *m_main_frame; } + const Web::Frame& main_frame() const { return *m_main_frame; } void reload(); void load(const URL&); @@ -77,8 +79,10 @@ private: void layout_and_sync_size(); void dump_selection(const char* event_name); - RefPtr<::Frame> m_main_frame; + RefPtr m_main_frame; bool m_should_show_line_box_borders { false }; bool m_in_mouse_selection { false }; }; + +} diff --git a/Libraries/LibHTML/Layout/BoxModelMetrics.cpp b/Libraries/LibHTML/Layout/BoxModelMetrics.cpp index 259a1c007e..e10576e9e4 100644 --- a/Libraries/LibHTML/Layout/BoxModelMetrics.cpp +++ b/Libraries/LibHTML/Layout/BoxModelMetrics.cpp @@ -26,6 +26,8 @@ #include +namespace Web { + BoxModelMetrics::BoxModelMetrics() { } @@ -43,3 +45,5 @@ BoxModelMetrics::PixelBox BoxModelMetrics::full_margin() const m_margin.left.to_px() + m_border.left.to_px() + m_padding.left.to_px(), }; } + +} diff --git a/Libraries/LibHTML/Layout/BoxModelMetrics.h b/Libraries/LibHTML/Layout/BoxModelMetrics.h index 57f146f7d5..0e27edc07c 100644 --- a/Libraries/LibHTML/Layout/BoxModelMetrics.h +++ b/Libraries/LibHTML/Layout/BoxModelMetrics.h @@ -29,6 +29,8 @@ #include #include +namespace Web { + class BoxModelMetrics { public: BoxModelMetrics(); @@ -56,3 +58,5 @@ private: LengthBox m_padding; LengthBox m_border; }; + +} diff --git a/Libraries/LibHTML/Layout/LayoutBlock.cpp b/Libraries/LibHTML/Layout/LayoutBlock.cpp index 7fab79726b..360fa85924 100644 --- a/Libraries/LibHTML/Layout/LayoutBlock.cpp +++ b/Libraries/LibHTML/Layout/LayoutBlock.cpp @@ -33,6 +33,8 @@ #include #include +namespace Web { + LayoutBlock::LayoutBlock(const Node* node, NonnullRefPtr style) : LayoutBox(node, move(style)) { @@ -384,3 +386,5 @@ LineBox& LayoutBlock::add_line_box() m_line_boxes.append(LineBox()); return m_line_boxes.last(); } + +} diff --git a/Libraries/LibHTML/Layout/LayoutBlock.h b/Libraries/LibHTML/Layout/LayoutBlock.h index 5f5d2d769d..b1f0d57c05 100644 --- a/Libraries/LibHTML/Layout/LayoutBlock.h +++ b/Libraries/LibHTML/Layout/LayoutBlock.h @@ -29,6 +29,8 @@ #include #include +namespace Web { + class Element; class LayoutBlock : public LayoutBox { @@ -103,3 +105,5 @@ inline bool is(const LayoutNode& node) { return node.is_block(); } + +} diff --git a/Libraries/LibHTML/Layout/LayoutBox.cpp b/Libraries/LibHTML/Layout/LayoutBox.cpp index 51a7bd0292..0bc90c8f41 100644 --- a/Libraries/LibHTML/Layout/LayoutBox.cpp +++ b/Libraries/LibHTML/Layout/LayoutBox.cpp @@ -34,6 +34,8 @@ //#define DRAW_BOXES_AROUND_LAYOUT_NODES //#define DRAW_BOXES_AROUND_HOVERED_NODES +namespace Web { + void LayoutBox::paint_border(RenderingContext& context, Edge edge, const Gfx::FloatRect& rect, CSS::PropertyID style_property_id, CSS::PropertyID color_property_id, CSS::PropertyID width_property_id) { auto border_width = style().property(width_property_id); @@ -238,3 +240,5 @@ bool LayoutBox::is_body() const { return node() && node() == document().body(); } + +} diff --git a/Libraries/LibHTML/Layout/LayoutBox.h b/Libraries/LibHTML/Layout/LayoutBox.h index 5c9a226faf..d79b5a6e4e 100644 --- a/Libraries/LibHTML/Layout/LayoutBox.h +++ b/Libraries/LibHTML/Layout/LayoutBox.h @@ -29,6 +29,8 @@ #include #include +namespace Web { + class LayoutBox : public LayoutNodeWithStyleAndBoxModelMetrics { public: const Gfx::FloatRect& rect() const { return m_rect; } @@ -74,3 +76,5 @@ inline bool is(const LayoutNode& node) { return node.is_box(); } + +} diff --git a/Libraries/LibHTML/Layout/LayoutBreak.cpp b/Libraries/LibHTML/Layout/LayoutBreak.cpp index e91cb1bae5..d85e8c32e7 100644 --- a/Libraries/LibHTML/Layout/LayoutBreak.cpp +++ b/Libraries/LibHTML/Layout/LayoutBreak.cpp @@ -27,6 +27,8 @@ #include #include +namespace Web { + LayoutBreak::LayoutBreak(const HTMLBRElement& element) : LayoutNodeWithStyleAndBoxModelMetrics(&element, StyleProperties::create()) { @@ -41,3 +43,5 @@ void LayoutBreak::split_into_lines(LayoutBlock& block) { block.add_line_box(); } + +} diff --git a/Libraries/LibHTML/Layout/LayoutBreak.h b/Libraries/LibHTML/Layout/LayoutBreak.h index b5e8c29e90..ef3f0f2439 100644 --- a/Libraries/LibHTML/Layout/LayoutBreak.h +++ b/Libraries/LibHTML/Layout/LayoutBreak.h @@ -29,6 +29,8 @@ #include #include +namespace Web { + class LayoutBreak final : public LayoutNodeWithStyleAndBoxModelMetrics { public: explicit LayoutBreak(const HTMLBRElement&); @@ -40,3 +42,5 @@ private: virtual const char* class_name() const override { return "LayoutBreak"; } virtual void split_into_lines(LayoutBlock&) override; }; + +} diff --git a/Libraries/LibHTML/Layout/LayoutDocument.cpp b/Libraries/LibHTML/Layout/LayoutDocument.cpp index b1fc37800c..f711a31071 100644 --- a/Libraries/LibHTML/Layout/LayoutDocument.cpp +++ b/Libraries/LibHTML/Layout/LayoutDocument.cpp @@ -29,6 +29,8 @@ #include #include +namespace Web { + LayoutDocument::LayoutDocument(const Document& document, NonnullRefPtr style) : LayoutBlock(&document, move(style)) { @@ -65,3 +67,5 @@ void LayoutDocument::did_set_viewport_rect(Badge, const Gfx::Rect& a_view return IterationDecision::Continue; }); } + +} diff --git a/Libraries/LibHTML/Layout/LayoutDocument.h b/Libraries/LibHTML/Layout/LayoutDocument.h index 7cd59b68b1..39f68c459a 100644 --- a/Libraries/LibHTML/Layout/LayoutDocument.h +++ b/Libraries/LibHTML/Layout/LayoutDocument.h @@ -29,6 +29,8 @@ #include #include +namespace Web { + class LayoutDocument final : public LayoutBlock { public: explicit LayoutDocument(const Document&, NonnullRefPtr); @@ -46,3 +48,5 @@ public: private: LayoutRange m_selection; }; + +} diff --git a/Libraries/LibHTML/Layout/LayoutImage.cpp b/Libraries/LibHTML/Layout/LayoutImage.cpp index 22fccfebd5..45e865a931 100644 --- a/Libraries/LibHTML/Layout/LayoutImage.cpp +++ b/Libraries/LibHTML/Layout/LayoutImage.cpp @@ -29,6 +29,8 @@ #include #include +namespace Web { + LayoutImage::LayoutImage(const HTMLImageElement& element, NonnullRefPtr style) : LayoutReplaced(element, move(style)) { @@ -83,3 +85,5 @@ bool LayoutImage::renders_as_alt_text() const { return !node().image_decoder(); } + +} diff --git a/Libraries/LibHTML/Layout/LayoutImage.h b/Libraries/LibHTML/Layout/LayoutImage.h index f927a57028..54246466d9 100644 --- a/Libraries/LibHTML/Layout/LayoutImage.h +++ b/Libraries/LibHTML/Layout/LayoutImage.h @@ -29,6 +29,8 @@ #include #include +namespace Web { + class HTMLImageElement; class LayoutImage : public LayoutReplaced { @@ -53,3 +55,5 @@ inline bool is(const LayoutNode& node) { return node.is_image(); } + +} diff --git a/Libraries/LibHTML/Layout/LayoutInline.cpp b/Libraries/LibHTML/Layout/LayoutInline.cpp index 9d6a0d4df6..2ba96ff60e 100644 --- a/Libraries/LibHTML/Layout/LayoutInline.cpp +++ b/Libraries/LibHTML/Layout/LayoutInline.cpp @@ -28,6 +28,8 @@ #include #include +namespace Web { + LayoutInline::LayoutInline(const Element& element, NonnullRefPtr style) : LayoutNodeWithStyleAndBoxModelMetrics(&element, move(style)) { @@ -37,3 +39,5 @@ LayoutInline::LayoutInline(const Element& element, NonnullRefPtr +namespace Web { + class LayoutBlock; class LayoutInline : public LayoutNodeWithStyleAndBoxModelMetrics { @@ -36,3 +38,5 @@ public: virtual ~LayoutInline() override; virtual const char* class_name() const override { return "LayoutInline"; } }; + +} diff --git a/Libraries/LibHTML/Layout/LayoutListItem.cpp b/Libraries/LibHTML/Layout/LayoutListItem.cpp index b3fb90dcf3..322bf7b6e3 100644 --- a/Libraries/LibHTML/Layout/LayoutListItem.cpp +++ b/Libraries/LibHTML/Layout/LayoutListItem.cpp @@ -27,6 +27,8 @@ #include #include +namespace Web { + LayoutListItem::LayoutListItem(const Element& element, NonnullRefPtr style) : LayoutBlock(&element, move(style)) { @@ -50,3 +52,5 @@ void LayoutListItem::layout() Gfx::FloatRect marker_rect { x() - 8, y(), 4, height() }; m_marker->set_rect(marker_rect); } + +} diff --git a/Libraries/LibHTML/Layout/LayoutListItem.h b/Libraries/LibHTML/Layout/LayoutListItem.h index 16324bd919..0b4414b496 100644 --- a/Libraries/LibHTML/Layout/LayoutListItem.h +++ b/Libraries/LibHTML/Layout/LayoutListItem.h @@ -29,6 +29,8 @@ #include #include +namespace Web { + class LayoutListItemMarker; class LayoutListItem final : public LayoutBlock { @@ -43,3 +45,5 @@ private: RefPtr m_marker; }; + +} diff --git a/Libraries/LibHTML/Layout/LayoutListItemMarker.cpp b/Libraries/LibHTML/Layout/LayoutListItemMarker.cpp index 835c68f005..d30f43bf6f 100644 --- a/Libraries/LibHTML/Layout/LayoutListItemMarker.cpp +++ b/Libraries/LibHTML/Layout/LayoutListItemMarker.cpp @@ -27,6 +27,8 @@ #include #include +namespace Web { + LayoutListItemMarker::LayoutListItemMarker() : LayoutBox(nullptr, StyleProperties::create()) { @@ -44,3 +46,5 @@ void LayoutListItemMarker::render(RenderingContext& context) auto color = parent()->style().color_or_fallback(CSS::PropertyID::Color, document(), context.palette().base_text()); context.painter().fill_rect(bullet_rect, color); } + +} diff --git a/Libraries/LibHTML/Layout/LayoutListItemMarker.h b/Libraries/LibHTML/Layout/LayoutListItemMarker.h index 2afc387a28..c36baaf1f4 100644 --- a/Libraries/LibHTML/Layout/LayoutListItemMarker.h +++ b/Libraries/LibHTML/Layout/LayoutListItemMarker.h @@ -28,6 +28,8 @@ #include +namespace Web { + class LayoutListItemMarker final : public LayoutBox { public: LayoutListItemMarker(); @@ -38,3 +40,5 @@ public: private: virtual const char* class_name() const override { return "LayoutListItemMarker"; } }; + +} diff --git a/Libraries/LibHTML/Layout/LayoutNode.cpp b/Libraries/LibHTML/Layout/LayoutNode.cpp index d1ec2f7453..fd0c788642 100644 --- a/Libraries/LibHTML/Layout/LayoutNode.cpp +++ b/Libraries/LibHTML/Layout/LayoutNode.cpp @@ -31,6 +31,8 @@ #include #include +namespace Web { + LayoutNode::LayoutNode(const Node* node) : m_node(node) { @@ -152,3 +154,5 @@ Gfx::FloatPoint LayoutNode::box_type_agnostic_position() const } return position; } + +} diff --git a/Libraries/LibHTML/Layout/LayoutNode.h b/Libraries/LibHTML/Layout/LayoutNode.h index 6f218ae644..ebb74e6dea 100644 --- a/Libraries/LibHTML/Layout/LayoutNode.h +++ b/Libraries/LibHTML/Layout/LayoutNode.h @@ -36,6 +36,8 @@ #include #include +namespace Web { + class Document; class Element; class LayoutBlock; @@ -315,3 +317,5 @@ inline T* LayoutNode::first_ancestor_of_type() } return nullptr; } + +} diff --git a/Libraries/LibHTML/Layout/LayoutPosition.h b/Libraries/LibHTML/Layout/LayoutPosition.h index f8d7b2d4f1..227829fbad 100644 --- a/Libraries/LibHTML/Layout/LayoutPosition.h +++ b/Libraries/LibHTML/Layout/LayoutPosition.h @@ -28,6 +28,8 @@ #include +namespace Web { + class LayoutNode; struct LayoutPosition { @@ -80,3 +82,5 @@ private: LayoutPosition m_start; LayoutPosition m_end; }; + +} diff --git a/Libraries/LibHTML/Layout/LayoutReplaced.cpp b/Libraries/LibHTML/Layout/LayoutReplaced.cpp index efedb76d77..b60d2a2888 100644 --- a/Libraries/LibHTML/Layout/LayoutReplaced.cpp +++ b/Libraries/LibHTML/Layout/LayoutReplaced.cpp @@ -28,6 +28,8 @@ #include #include +namespace Web { + LayoutReplaced::LayoutReplaced(const Element& element, NonnullRefPtr style) : LayoutBox(&element, move(style)) { @@ -48,3 +50,5 @@ void LayoutReplaced::split_into_lines(LayoutBlock& container) line_box = &container.add_line_box(); line_box->add_fragment(*this, 0, 0, width(), height()); } + +} diff --git a/Libraries/LibHTML/Layout/LayoutReplaced.h b/Libraries/LibHTML/Layout/LayoutReplaced.h index 1f0a93abd5..c48dfbaec1 100644 --- a/Libraries/LibHTML/Layout/LayoutReplaced.h +++ b/Libraries/LibHTML/Layout/LayoutReplaced.h @@ -27,6 +27,8 @@ #include #include +namespace Web { + class LayoutReplaced : public LayoutBox { public: LayoutReplaced(const Element&, NonnullRefPtr); @@ -47,3 +49,5 @@ inline bool is(const LayoutNode& node) { return node.is_replaced(); } + +} diff --git a/Libraries/LibHTML/Layout/LayoutTable.cpp b/Libraries/LibHTML/Layout/LayoutTable.cpp index 226ebf4f68..17f00bb21f 100644 --- a/Libraries/LibHTML/Layout/LayoutTable.cpp +++ b/Libraries/LibHTML/Layout/LayoutTable.cpp @@ -28,6 +28,8 @@ #include #include +namespace Web { + LayoutTable::LayoutTable(const Element& element, NonnullRefPtr style) : LayoutBlock(&element, move(style)) { @@ -52,3 +54,5 @@ const LayoutTableRow* LayoutTable::first_row() const { return first_child_of_type(); } + +} diff --git a/Libraries/LibHTML/Layout/LayoutTable.h b/Libraries/LibHTML/Layout/LayoutTable.h index a880c761f4..738343449c 100644 --- a/Libraries/LibHTML/Layout/LayoutTable.h +++ b/Libraries/LibHTML/Layout/LayoutTable.h @@ -28,6 +28,8 @@ #include +namespace Web { + class LayoutTableRow; class LayoutTable final : public LayoutBlock { @@ -50,3 +52,5 @@ inline bool is(const LayoutNode& node) { return node.is_table(); } + +} diff --git a/Libraries/LibHTML/Layout/LayoutTableCell.cpp b/Libraries/LibHTML/Layout/LayoutTableCell.cpp index 48b00869a4..cf7f18078a 100644 --- a/Libraries/LibHTML/Layout/LayoutTableCell.cpp +++ b/Libraries/LibHTML/Layout/LayoutTableCell.cpp @@ -27,6 +27,8 @@ #include #include +namespace Web { + LayoutTableCell::LayoutTableCell(const Element& element, NonnullRefPtr style) : LayoutBlock(&element, move(style)) { @@ -35,3 +37,5 @@ LayoutTableCell::LayoutTableCell(const Element& element, NonnullRefPtr +namespace Web { + class LayoutTableCell final : public LayoutBlock { public: LayoutTableCell(const Element&, NonnullRefPtr); @@ -46,3 +48,5 @@ inline bool is(const LayoutNode& node) { return node.is_table_cell(); } + +} diff --git a/Libraries/LibHTML/Layout/LayoutTableRow.cpp b/Libraries/LibHTML/Layout/LayoutTableRow.cpp index 441602a0a1..effd6eebb6 100644 --- a/Libraries/LibHTML/Layout/LayoutTableRow.cpp +++ b/Libraries/LibHTML/Layout/LayoutTableRow.cpp @@ -28,6 +28,8 @@ #include #include +namespace Web { + LayoutTableRow::LayoutTableRow(const Element& element, NonnullRefPtr style) : LayoutBox(&element, move(style)) { @@ -61,3 +63,5 @@ const LayoutTableRow* LayoutTableRow::next_row() const { return next_sibling_of_type(); } + +} diff --git a/Libraries/LibHTML/Layout/LayoutTableRow.h b/Libraries/LibHTML/Layout/LayoutTableRow.h index 2fc39b5527..fc6c7ad93c 100644 --- a/Libraries/LibHTML/Layout/LayoutTableRow.h +++ b/Libraries/LibHTML/Layout/LayoutTableRow.h @@ -28,6 +28,8 @@ #include +namespace Web { + class LayoutTableCell; class LayoutTableRow final : public LayoutBox { @@ -53,3 +55,5 @@ inline bool is(const LayoutNode& node) { return node.is_table_row(); } + +} diff --git a/Libraries/LibHTML/Layout/LayoutText.cpp b/Libraries/LibHTML/Layout/LayoutText.cpp index ac3ca91e28..6b2acd7373 100644 --- a/Libraries/LibHTML/Layout/LayoutText.cpp +++ b/Libraries/LibHTML/Layout/LayoutText.cpp @@ -34,6 +34,8 @@ #include #include +namespace Web { + LayoutText::LayoutText(const Text& text) : LayoutNode(&text) { @@ -231,3 +233,5 @@ void LayoutText::split_into_lines(LayoutBlock& container) } } } + +} diff --git a/Libraries/LibHTML/Layout/LayoutText.h b/Libraries/LibHTML/Layout/LayoutText.h index ae2544d666..a8e4e47776 100644 --- a/Libraries/LibHTML/Layout/LayoutText.h +++ b/Libraries/LibHTML/Layout/LayoutText.h @@ -29,6 +29,8 @@ #include #include +namespace Web { + class LineBoxFragment; class LayoutText : public LayoutNode { @@ -64,3 +66,5 @@ inline bool is(const LayoutNode& node) { return node.is_text(); } + +} diff --git a/Libraries/LibHTML/Layout/LayoutTreeBuilder.cpp b/Libraries/LibHTML/Layout/LayoutTreeBuilder.cpp index 3992177040..436399f510 100644 --- a/Libraries/LibHTML/Layout/LayoutTreeBuilder.cpp +++ b/Libraries/LibHTML/Layout/LayoutTreeBuilder.cpp @@ -31,6 +31,8 @@ #include #include +namespace Web { + LayoutTreeBuilder::LayoutTreeBuilder() { } @@ -85,3 +87,5 @@ RefPtr LayoutTreeBuilder::build(Node& node) ASSERT(is(node)); return create_layout_tree(node, nullptr); } + +} diff --git a/Libraries/LibHTML/Layout/LayoutTreeBuilder.h b/Libraries/LibHTML/Layout/LayoutTreeBuilder.h index 7dba64a031..4e486b6218 100644 --- a/Libraries/LibHTML/Layout/LayoutTreeBuilder.h +++ b/Libraries/LibHTML/Layout/LayoutTreeBuilder.h @@ -28,6 +28,8 @@ #include +namespace Web { + class Node; class LayoutNode; @@ -37,3 +39,5 @@ public: RefPtr build(Node&); }; + +} diff --git a/Libraries/LibHTML/Layout/LayoutWidget.cpp b/Libraries/LibHTML/Layout/LayoutWidget.cpp index 9db153a4a0..f748fdfda7 100644 --- a/Libraries/LibHTML/Layout/LayoutWidget.cpp +++ b/Libraries/LibHTML/Layout/LayoutWidget.cpp @@ -30,6 +30,8 @@ #include #include +namespace Web { + LayoutWidget::LayoutWidget(const Element& element, GUI::Widget& widget) : LayoutReplaced(element, StyleProperties::create()) , m_widget(widget) @@ -52,3 +54,5 @@ void LayoutWidget::render(RenderingContext& context) { LayoutReplaced::render(context); } + +} diff --git a/Libraries/LibHTML/Layout/LayoutWidget.h b/Libraries/LibHTML/Layout/LayoutWidget.h index 1cb7831655..7a8c9efe18 100644 --- a/Libraries/LibHTML/Layout/LayoutWidget.h +++ b/Libraries/LibHTML/Layout/LayoutWidget.h @@ -28,6 +28,8 @@ #include +namespace Web { + class LayoutWidget : public LayoutReplaced { public: LayoutWidget(const Element&, GUI::Widget&); @@ -52,3 +54,5 @@ inline bool is(const LayoutNode& node) { return node.is_widget(); } + +} diff --git a/Libraries/LibHTML/Layout/LineBox.cpp b/Libraries/LibHTML/Layout/LineBox.cpp index 88b3ab35e1..c71ced5b2e 100644 --- a/Libraries/LibHTML/Layout/LineBox.cpp +++ b/Libraries/LibHTML/Layout/LineBox.cpp @@ -30,6 +30,8 @@ #include #include +namespace Web { + void LineBox::add_fragment(const LayoutNode& layout_node, int start, int length, int width, int height) { bool text_align_is_justify = layout_node.style().string_or_fallback(CSS::PropertyID::TextAlign, "left") == "justify"; @@ -66,3 +68,5 @@ void LineBox::trim_trailing_whitespace() m_width -= space_width; } } + +} diff --git a/Libraries/LibHTML/Layout/LineBox.h b/Libraries/LibHTML/Layout/LineBox.h index 96033b3a22..b7ea2ac331 100644 --- a/Libraries/LibHTML/Layout/LineBox.h +++ b/Libraries/LibHTML/Layout/LineBox.h @@ -29,6 +29,8 @@ #include #include +namespace Web { + class LineBox { public: LineBox() {} @@ -46,3 +48,5 @@ private: Vector m_fragments; float m_width { 0 }; }; + +} diff --git a/Libraries/LibHTML/Layout/LineBoxFragment.cpp b/Libraries/LibHTML/Layout/LineBoxFragment.cpp index 4da598be71..1491e1db75 100644 --- a/Libraries/LibHTML/Layout/LineBoxFragment.cpp +++ b/Libraries/LibHTML/Layout/LineBoxFragment.cpp @@ -31,6 +31,8 @@ #include #include +namespace Web { + void LineBoxFragment::render(RenderingContext& context) { for (auto* ancestor = layout_node().parent(); ancestor; ancestor = ancestor->parent()) { @@ -75,3 +77,5 @@ int LineBoxFragment::text_index_at(float x) const } return m_start + m_length - 1; } + +} diff --git a/Libraries/LibHTML/Layout/LineBoxFragment.h b/Libraries/LibHTML/Layout/LineBoxFragment.h index b79cdffde0..c22cee77bd 100644 --- a/Libraries/LibHTML/Layout/LineBoxFragment.h +++ b/Libraries/LibHTML/Layout/LineBoxFragment.h @@ -28,6 +28,8 @@ #include +namespace Web { + class LayoutNode; class RenderingContext; @@ -63,3 +65,5 @@ private: int m_length { 0 }; Gfx::FloatRect m_rect; }; + +} diff --git a/Libraries/LibHTML/Parser/CSSParser.cpp b/Libraries/LibHTML/Parser/CSSParser.cpp index b16da54860..d670cf3c1d 100644 --- a/Libraries/LibHTML/Parser/CSSParser.cpp +++ b/Libraries/LibHTML/Parser/CSSParser.cpp @@ -39,6 +39,8 @@ ASSERT_NOT_REACHED(); \ } +namespace Web { + static Optional parse_css_color(const StringView& view) { auto color = Color::from_string(view); @@ -631,3 +633,5 @@ RefPtr parse_css_declaration(const StringView& css) CSSParser parser(css); return parser.parse_standalone_declaration(); } + +} diff --git a/Libraries/LibHTML/Parser/CSSParser.h b/Libraries/LibHTML/Parser/CSSParser.h index 5918aaa5ec..260a9c372f 100644 --- a/Libraries/LibHTML/Parser/CSSParser.h +++ b/Libraries/LibHTML/Parser/CSSParser.h @@ -29,6 +29,10 @@ #include #include +namespace Web { + RefPtr parse_css(const StringView&); RefPtr parse_css_declaration(const StringView&); NonnullRefPtr parse_css_value(const StringView&); + +} diff --git a/Libraries/LibHTML/Parser/HTMLParser.cpp b/Libraries/LibHTML/Parser/HTMLParser.cpp index d105d87750..6f24a5277a 100644 --- a/Libraries/LibHTML/Parser/HTMLParser.cpp +++ b/Libraries/LibHTML/Parser/HTMLParser.cpp @@ -37,6 +37,8 @@ #include #include +namespace Web { + static bool is_valid_in_attribute_name(char ch) { return isalnum(ch) || ch == '_' || ch == '-'; @@ -378,3 +380,5 @@ RefPtr parse_html_document(const StringView& html, const URL& url) return document; } + +} diff --git a/Libraries/LibHTML/Parser/HTMLParser.h b/Libraries/LibHTML/Parser/HTMLParser.h index 726cae246e..a3077f14cf 100644 --- a/Libraries/LibHTML/Parser/HTMLParser.h +++ b/Libraries/LibHTML/Parser/HTMLParser.h @@ -29,7 +29,11 @@ #include #include +namespace Web { + class DocumentFragment; RefPtr parse_html_document(const StringView&, const URL& = URL()); RefPtr parse_html_fragment(Document&, const StringView&); + +} diff --git a/Libraries/LibHTML/RenderingContext.h b/Libraries/LibHTML/RenderingContext.h index 8880f205aa..36fc6c9d64 100644 --- a/Libraries/LibHTML/RenderingContext.h +++ b/Libraries/LibHTML/RenderingContext.h @@ -30,6 +30,8 @@ #include #include +namespace Web { + class RenderingContext { public: explicit RenderingContext(GUI::Painter& painter, const Palette& palette) @@ -53,3 +55,5 @@ private: Gfx::Rect m_viewport_rect; bool m_should_show_line_box_borders { false }; }; + +} diff --git a/Libraries/LibHTML/ResourceLoader.cpp b/Libraries/LibHTML/ResourceLoader.cpp index a4933a6a48..9e23aa6a32 100644 --- a/Libraries/LibHTML/ResourceLoader.cpp +++ b/Libraries/LibHTML/ResourceLoader.cpp @@ -30,6 +30,8 @@ #include #include +namespace Web { + ResourceLoader& ResourceLoader::the() { static ResourceLoader* s_the; @@ -83,3 +85,5 @@ void ResourceLoader::load(const URL& url, Function call dbg() << "Unimplemented protocol: " << url.protocol(); ASSERT_NOT_REACHED(); } + +} diff --git a/Libraries/LibHTML/ResourceLoader.h b/Libraries/LibHTML/ResourceLoader.h index eca57fa34e..fafd5156fd 100644 --- a/Libraries/LibHTML/ResourceLoader.h +++ b/Libraries/LibHTML/ResourceLoader.h @@ -34,6 +34,8 @@ namespace Protocol { class Client; } +namespace Web { + class ResourceLoader : public Core::Object { C_OBJECT(ResourceLoader) public: @@ -53,3 +55,5 @@ private: Protocol::Client& protocol_client() { return *m_protocol_client; } RefPtr m_protocol_client; }; + +} diff --git a/Libraries/LibHTML/Scripts/GenerateStyleSheetSource.sh b/Libraries/LibHTML/Scripts/GenerateStyleSheetSource.sh index 68140bc5a5..c529206f4d 100755 --- a/Libraries/LibHTML/Scripts/GenerateStyleSheetSource.sh +++ b/Libraries/LibHTML/Scripts/GenerateStyleSheetSource.sh @@ -1,8 +1,10 @@ #!/bin/sh +echo "namespace Web {" echo "extern const char $1[];" echo "const char $1[] = \"\\" grep -v '^ *#' < "$2" | while IFS= read -r line; do echo "$line""\\" done echo "\";" +echo "}" diff --git a/Libraries/LibHTML/StylePropertiesModel.cpp b/Libraries/LibHTML/StylePropertiesModel.cpp index f2b0b4f221..0bf7152be9 100644 --- a/Libraries/LibHTML/StylePropertiesModel.cpp +++ b/Libraries/LibHTML/StylePropertiesModel.cpp @@ -29,6 +29,8 @@ #include #include +namespace Web { + StylePropertiesModel::StylePropertiesModel(const StyleProperties& properties) : m_properties(properties) { @@ -72,3 +74,5 @@ void StylePropertiesModel::update() { did_update(); } + +} diff --git a/Libraries/LibHTML/StylePropertiesModel.h b/Libraries/LibHTML/StylePropertiesModel.h index ed6a09810e..5b79c1ec01 100644 --- a/Libraries/LibHTML/StylePropertiesModel.h +++ b/Libraries/LibHTML/StylePropertiesModel.h @@ -27,6 +27,8 @@ #include #include +namespace Web { + class StyleProperties; class StylePropertiesModel final : public GUI::Model { @@ -57,3 +59,5 @@ private: }; Vector m_values; }; + +} diff --git a/Libraries/LibHTML/TreeNode.h b/Libraries/LibHTML/TreeNode.h index f0550b9b21..188d142ab3 100644 --- a/Libraries/LibHTML/TreeNode.h +++ b/Libraries/LibHTML/TreeNode.h @@ -30,6 +30,8 @@ #include #include +namespace Web { + // FIXME: I wish I didn't have to forward declare these, but I can't seem to avoid // it if I still want to have for_each_in_subtree_of_type inline here. class Node; @@ -293,3 +295,5 @@ inline bool TreeNode::is_ancestor_of(const TreeNode& other) const } return false; } + +} diff --git a/Userland/html.cpp b/Userland/html.cpp index 76bbad5a43..71f1c7fc99 100644 --- a/Userland/html.cpp +++ b/Userland/html.cpp @@ -61,10 +61,10 @@ int main(int argc, char** argv) } String html = String::copy(f->read_all()); - auto document = parse_html_document(html); + auto document = Web::parse_html_document(html); auto window = GUI::Window::construct(); - auto& widget = window->set_main_widget(); + auto& widget = window->set_main_widget(); widget.set_document(document); if (!widget.document()->title().is_null()) window->set_title(String::format("%s - HTML", widget.document()->title().characters()));