mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:22: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>(); |     auto& splitter = add<GUI::VerticalSplitter>(); | ||||||
|     m_dom_tree_view = splitter.add<GUI::TreeView>(); |     m_dom_tree_view = splitter.add<GUI::TreeView>(); | ||||||
|     m_dom_tree_view->on_selection = [this](auto& index) { |     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); |         node->document().set_inspected_node(node); | ||||||
|         if (node->is_element()) { |         if (node->is_element()) { | ||||||
|             auto element = to<Element>(*node); |             auto element = Web::to<Web::Element>(*node); | ||||||
|             if (element.resolved_style()) { |             if (element.resolved_style()) { | ||||||
|                 m_style_table_view->set_model(StylePropertiesModel::create(*element.resolved_style())); |                 m_style_table_view->set_model(Web::StylePropertiesModel::create(*element.resolved_style())); | ||||||
|                 m_computed_style_table_view->set_model(StylePropertiesModel::create(*element.computed_style())); |                 m_computed_style_table_view->set_model(Web::StylePropertiesModel::create(*element.computed_style())); | ||||||
|             } |             } | ||||||
|         } else { |         } else { | ||||||
|             m_style_table_view->set_model(nullptr); |             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) |     if (m_document == document) | ||||||
|         return; |         return; | ||||||
|     m_document = document; |     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> | #include <LibGUI/Widget.h> | ||||||
| 
 | #include <LibHTML/Forward.h> | ||||||
| class Document; |  | ||||||
| 
 | 
 | ||||||
| class InspectorWidget final : public GUI::Widget { | class InspectorWidget final : public GUI::Widget { | ||||||
|     C_OBJECT(InspectorWidget) |     C_OBJECT(InspectorWidget) | ||||||
| public: | public: | ||||||
|     virtual ~InspectorWidget(); |     virtual ~InspectorWidget(); | ||||||
| 
 | 
 | ||||||
|     void set_document(Document*); |     void set_document(Web::Document*); | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     InspectorWidget(); |     InspectorWidget(); | ||||||
|  | @ -41,5 +40,5 @@ private: | ||||||
|     RefPtr<GUI::TreeView> m_dom_tree_view; |     RefPtr<GUI::TreeView> m_dom_tree_view; | ||||||
|     RefPtr<GUI::TableView> m_style_table_view; |     RefPtr<GUI::TableView> m_style_table_view; | ||||||
|     RefPtr<GUI::TableView> m_computed_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); |     GUI::Application app(argc, argv); | ||||||
| 
 | 
 | ||||||
|     // Connect to the ProtocolServer immediately so we can drop the "unix" pledge.
 |     // 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) { |     if (pledge("stdio shared_buffer accept rpath", nullptr) < 0) { | ||||||
|         perror("pledge"); |         perror("pledge"); | ||||||
|  | @ -81,7 +81,7 @@ int main(int argc, char** argv) | ||||||
|     widget.layout()->set_spacing(0); |     widget.layout()->set_spacing(0); | ||||||
| 
 | 
 | ||||||
|     auto& toolbar = widget.add<GUI::ToolBar>(); |     auto& toolbar = widget.add<GUI::ToolBar>(); | ||||||
|     auto& html_widget = widget.add<HtmlView>(); |     auto& html_widget = widget.add<Web::HtmlView>(); | ||||||
| 
 | 
 | ||||||
|     History<URL> history; |     History<URL> history; | ||||||
| 
 | 
 | ||||||
|  | @ -157,12 +157,12 @@ int main(int argc, char** argv) | ||||||
|         statusbar.set_text(href); |         statusbar.set_text(href); | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     ResourceLoader::the().on_load_counter_change = [&] { |     Web::ResourceLoader::the().on_load_counter_change = [&] { | ||||||
|         if (ResourceLoader::the().pending_loads() == 0) { |         if (Web::ResourceLoader::the().pending_loads() == 0) { | ||||||
|             statusbar.set_text(""); |             statusbar.set_text(""); | ||||||
|             return; |             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>(); |     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_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fill); | ||||||
|     tree_view.set_preferred_size(200, 500); |     tree_view.set_preferred_size(200, 500); | ||||||
| 
 | 
 | ||||||
|     auto& html_view = splitter.add<HtmlView>(); |     auto& html_view = splitter.add<Web::HtmlView>(); | ||||||
| 
 | 
 | ||||||
|     History history; |     History history; | ||||||
| 
 | 
 | ||||||
|  | @ -129,7 +129,7 @@ int main(int argc, char* argv[]) | ||||||
|         ASSERT(success); |         ASSERT(success); | ||||||
| 
 | 
 | ||||||
|         String html = md_document.render_to_html(); |         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); |         html_view.set_document(html_document); | ||||||
| 
 | 
 | ||||||
|         String page_and_section = model->page_and_section(tree_view.selection().first()); |         String page_and_section = model->page_and_section(tree_view.selection().first()); | ||||||
|  |  | ||||||
|  | @ -43,14 +43,14 @@ NonnullRefPtr<IRCLogBuffer> IRCLogBuffer::create() | ||||||
| 
 | 
 | ||||||
| IRCLogBuffer::IRCLogBuffer() | IRCLogBuffer::IRCLogBuffer() | ||||||
| { | { | ||||||
|     m_document = adopt(*new Document); |     m_document = adopt(*new Web::Document); | ||||||
|     m_document->append_child(adopt(*new DocumentType(document()))); |     m_document->append_child(adopt(*new Web::DocumentType(document()))); | ||||||
|     auto html_element = create_element(document(), "html"); |     auto html_element = create_element(document(), "html"); | ||||||
|     m_document->append_child(html_element); |     m_document->append_child(html_element); | ||||||
|     auto head_element = create_element(document(), "head"); |     auto head_element = create_element(document(), "head"); | ||||||
|     html_element->append_child(head_element); |     html_element->append_child(head_element); | ||||||
|     auto style_element = create_element(document(), "style"); |     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); |     head_element->append_child(style_element); | ||||||
|     auto body_element = create_element(document(), "body"); |     auto body_element = create_element(document(), "body"); | ||||||
|     html_element->append_child(body_element); |     html_element->append_child(body_element); | ||||||
|  |  | ||||||
|  | @ -49,11 +49,11 @@ public: | ||||||
|     void add_message(const String& text, Color = Color::Black); |     void add_message(const String& text, Color = Color::Black); | ||||||
|     void dump() const; |     void dump() const; | ||||||
| 
 | 
 | ||||||
|     const Document& document() const { return *m_document; } |     const Web::Document& document() const { return *m_document; } | ||||||
|     Document& document() { return *m_document; } |     Web::Document& document() { return *m_document; } | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     IRCLogBuffer(); |     IRCLogBuffer(); | ||||||
|     RefPtr<Document> m_document; |     RefPtr<Web::Document> m_document; | ||||||
|     RefPtr<Element> m_container_element; |     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.
 |     // Make a container for the log buffer view + (optional) member list.
 | ||||||
|     auto& container = add<GUI::HorizontalSplitter>(); |     auto& container = add<GUI::HorizontalSplitter>(); | ||||||
| 
 | 
 | ||||||
|     m_html_view = container.add<HtmlView>(); |     m_html_view = container.add<Web::HtmlView>(); | ||||||
| 
 | 
 | ||||||
|     if (m_type == Channel) { |     if (m_type == Channel) { | ||||||
|         auto& member_view = container.add<GUI::TableView>(); |         auto& member_view = container.add<GUI::TableView>(); | ||||||
|  | @ -82,7 +82,7 @@ IRCWindow::~IRCWindow() | ||||||
| void IRCWindow::set_log_buffer(const IRCLogBuffer& log_buffer) | void IRCWindow::set_log_buffer(const IRCLogBuffer& log_buffer) | ||||||
| { | { | ||||||
|     m_log_buffer = &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 | bool IRCWindow::is_active() const | ||||||
|  |  | ||||||
|  | @ -27,12 +27,12 @@ | ||||||
| #pragma once | #pragma once | ||||||
| 
 | 
 | ||||||
| #include <LibGUI/Widget.h> | #include <LibGUI/Widget.h> | ||||||
|  | #include <LibHTML/Forward.h> | ||||||
| 
 | 
 | ||||||
| class IRCChannel; | class IRCChannel; | ||||||
| class IRCClient; | class IRCClient; | ||||||
| class IRCQuery; | class IRCQuery; | ||||||
| class IRCLogBuffer; | class IRCLogBuffer; | ||||||
| class HtmlView; |  | ||||||
| 
 | 
 | ||||||
| class IRCWindow : public GUI::Widget { | class IRCWindow : public GUI::Widget { | ||||||
|     C_OBJECT(IRCWindow) |     C_OBJECT(IRCWindow) | ||||||
|  | @ -72,7 +72,7 @@ private: | ||||||
|     void* m_owner { nullptr }; |     void* m_owner { nullptr }; | ||||||
|     Type m_type; |     Type m_type; | ||||||
|     String m_name; |     String m_name; | ||||||
|     RefPtr<HtmlView> m_html_view; |     RefPtr<Web::HtmlView> m_html_view; | ||||||
|     RefPtr<GUI::TextEditor> m_text_editor; |     RefPtr<GUI::TextEditor> m_text_editor; | ||||||
|     RefPtr<IRCLogBuffer> m_log_buffer; |     RefPtr<IRCLogBuffer> m_log_buffer; | ||||||
|     int m_unread_count { 0 }; |     int m_unread_count { 0 }; | ||||||
|  |  | ||||||
|  | @ -48,7 +48,7 @@ Editor::Editor() | ||||||
|     m_documentation_tooltip_window = GUI::Window::construct(); |     m_documentation_tooltip_window = GUI::Window::construct(); | ||||||
|     m_documentation_tooltip_window->set_rect(0, 0, 500, 400); |     m_documentation_tooltip_window->set_rect(0, 0, 500, 400); | ||||||
|     m_documentation_tooltip_window->set_window_type(GUI::WindowType::Tooltip); |     m_documentation_tooltip_window->set_window_type(GUI::WindowType::Tooltip); | ||||||
|     m_documentation_html_view = m_documentation_tooltip_window->set_main_widget<HtmlView>(); |     m_documentation_html_view = m_documentation_tooltip_window->set_main_widget<Web::HtmlView>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Editor::~Editor() | 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_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) { |     if (!html_document) { | ||||||
|         dbg() << "failed to parse HTML"; |         dbg() << "failed to parse HTML"; | ||||||
|         return; |         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 :^)
 |     // FIXME: LibHTML needs a friendlier DOM manipulation API. Something like innerHTML :^)
 | ||||||
|     auto style_element = create_element(*html_document, "style"); |     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.
 |     // FIXME: This const_cast should not be necessary.
 | ||||||
|     auto* head_element = const_cast<HTMLHeadElement*>(html_document->head()); |     auto* head_element = const_cast<Web::HTMLHeadElement*>(html_document->head()); | ||||||
|     ASSERT(head_element); |     ASSERT(head_element); | ||||||
|     head_element->append_child(style_element); |     head_element->append_child(style_element); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -27,9 +27,9 @@ | ||||||
| #pragma once | #pragma once | ||||||
| 
 | 
 | ||||||
| #include <LibGUI/TextEditor.h> | #include <LibGUI/TextEditor.h> | ||||||
|  | #include <LibHTML/Forward.h> | ||||||
| 
 | 
 | ||||||
| class EditorWrapper; | class EditorWrapper; | ||||||
| class HtmlView; |  | ||||||
| 
 | 
 | ||||||
| class Editor final : public GUI::TextEditor { | class Editor final : public GUI::TextEditor { | ||||||
|     C_OBJECT(Editor) |     C_OBJECT(Editor) | ||||||
|  | @ -52,6 +52,6 @@ private: | ||||||
|     explicit Editor(); |     explicit Editor(); | ||||||
| 
 | 
 | ||||||
|     RefPtr<GUI::Window> m_documentation_tooltip_window; |     RefPtr<GUI::Window> m_documentation_tooltip_window; | ||||||
|     RefPtr<HtmlView> m_documentation_html_view; |     RefPtr<Web::HtmlView> m_documentation_html_view; | ||||||
|     String m_last_parsed_token; |     String m_last_parsed_token; | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | @ -309,7 +309,8 @@ PageFaultResponse Region::handle_fault(const PageFault& fault) | ||||||
|         } |         } | ||||||
|         return handle_zero_fault(page_index_in_region); |         return handle_zero_fault(page_index_in_region); | ||||||
| #else | #else | ||||||
|         ASSERT_NOT_REACHED(); |         dbg() << "BUG! Unexpected NP fault at " << fault.vaddr(); | ||||||
|  |         return PageFaultResponse::ShouldCrash; | ||||||
| #endif | #endif | ||||||
|     } |     } | ||||||
|     ASSERT(fault.type() == PageFault::Type::ProtectionViolation); |     ASSERT(fault.type() == PageFault::Type::ProtectionViolation); | ||||||
|  |  | ||||||
|  | @ -50,7 +50,7 @@ void __libc_init() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| extern u32 __stack_chk_guard; | extern u32 __stack_chk_guard; | ||||||
| u32 __stack_chk_guard = (u32)0xc0000c13; | u32 __stack_chk_guard = (u32)0xc6c7c8c9; | ||||||
| 
 | 
 | ||||||
| [[noreturn]] void __stack_chk_fail() | [[noreturn]] void __stack_chk_fail() | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -28,6 +28,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <AK/String.h> | #include <AK/String.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class Length { | class Length { | ||||||
| public: | public: | ||||||
|     enum class Type { |     enum class Type { | ||||||
|  | @ -76,3 +78,5 @@ inline const LogStream& operator<<(const LogStream& stream, const Length& value) | ||||||
| { | { | ||||||
|     return stream << value.to_string(); |     return stream << value.to_string(); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -28,9 +28,13 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/CSS/Length.h> | #include <LibHTML/CSS/Length.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| struct LengthBox { | struct LengthBox { | ||||||
|     Length top; |     Length top; | ||||||
|     Length right; |     Length right; | ||||||
|     Length bottom; |     Length bottom; | ||||||
|     Length left; |     Length left; | ||||||
| }; | }; | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -26,6 +26,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/CSS/Selector.h> | #include <LibHTML/CSS/Selector.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| Selector::Selector(Vector<ComplexSelector>&& component_lists) | Selector::Selector(Vector<ComplexSelector>&& component_lists) | ||||||
|     : m_complex_selectors(move(component_lists)) |     : m_complex_selectors(move(component_lists)) | ||||||
| { | { | ||||||
|  | @ -61,3 +63,5 @@ Specificity Selector::specificity() const | ||||||
| 
 | 
 | ||||||
|     return { ids, classes, tag_names }; |     return { ids, classes, tag_names }; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -30,6 +30,8 @@ | ||||||
| #include <AK/Vector.h> | #include <AK/Vector.h> | ||||||
| #include <LibHTML/CSS/Specificity.h> | #include <LibHTML/CSS/Specificity.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class Selector { | class Selector { | ||||||
| public: | public: | ||||||
|     struct SimpleSelector { |     struct SimpleSelector { | ||||||
|  | @ -90,3 +92,5 @@ public: | ||||||
| private: | private: | ||||||
|     Vector<ComplexSelector> m_complex_selectors; |     Vector<ComplexSelector> m_complex_selectors; | ||||||
| }; | }; | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -29,6 +29,8 @@ | ||||||
| #include <LibHTML/DOM/Element.h> | #include <LibHTML/DOM/Element.h> | ||||||
| #include <LibHTML/DOM/Text.h> | #include <LibHTML/DOM/Text.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| namespace SelectorEngine { | namespace SelectorEngine { | ||||||
| 
 | 
 | ||||||
| static bool matches_hover_pseudo_class(const Element& element) | static bool matches_hover_pseudo_class(const Element& element) | ||||||
|  | @ -146,3 +148,5 @@ bool matches(const Selector& selector, const Element& element) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -28,6 +28,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/CSS/Selector.h> | #include <LibHTML/CSS/Selector.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class Element; | class Element; | ||||||
| 
 | 
 | ||||||
| namespace SelectorEngine { | namespace SelectorEngine { | ||||||
|  | @ -35,3 +37,5 @@ namespace SelectorEngine { | ||||||
| bool matches(const Selector&, const Element&); | bool matches(const Selector&, const Element&); | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -26,6 +26,8 @@ | ||||||
| 
 | 
 | ||||||
| #pragma once | #pragma once | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class Specificity { | class Specificity { | ||||||
| public: | public: | ||||||
|     Specificity(unsigned ids, unsigned classes, unsigned tag_names) |     Specificity(unsigned ids, unsigned classes, unsigned tag_names) | ||||||
|  | @ -58,3 +60,5 @@ private: | ||||||
|     unsigned m_classes { 0 }; |     unsigned m_classes { 0 }; | ||||||
|     unsigned m_tag_names { 0 }; |     unsigned m_tag_names { 0 }; | ||||||
| }; | }; | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -26,6 +26,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/CSS/StyleDeclaration.h> | #include <LibHTML/CSS/StyleDeclaration.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| StyleDeclaration::StyleDeclaration(Vector<StyleProperty>&& properties) | StyleDeclaration::StyleDeclaration(Vector<StyleProperty>&& properties) | ||||||
|     : m_properties(move(properties)) |     : m_properties(move(properties)) | ||||||
| { | { | ||||||
|  | @ -34,3 +36,5 @@ StyleDeclaration::StyleDeclaration(Vector<StyleProperty>&& properties) | ||||||
| StyleDeclaration::~StyleDeclaration() | StyleDeclaration::~StyleDeclaration() | ||||||
| { | { | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -30,6 +30,8 @@ | ||||||
| #include <AK/Vector.h> | #include <AK/Vector.h> | ||||||
| #include <LibHTML/CSS/StyleValue.h> | #include <LibHTML/CSS/StyleValue.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| struct StyleProperty { | struct StyleProperty { | ||||||
|     CSS::PropertyID property_id; |     CSS::PropertyID property_id; | ||||||
|     NonnullRefPtr<StyleValue> value; |     NonnullRefPtr<StyleValue> value; | ||||||
|  | @ -52,3 +54,5 @@ public: | ||||||
| 
 | 
 | ||||||
|     Vector<StyleProperty> m_properties; |     Vector<StyleProperty> m_properties; | ||||||
| }; | }; | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -29,6 +29,8 @@ | ||||||
| #include <LibHTML/FontCache.h> | #include <LibHTML/FontCache.h> | ||||||
| #include <ctype.h> | #include <ctype.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| StyleProperties::StyleProperties() | StyleProperties::StyleProperties() | ||||||
| { | { | ||||||
| } | } | ||||||
|  | @ -177,3 +179,5 @@ bool StyleProperties::operator==(const StyleProperties& other) const | ||||||
| 
 | 
 | ||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -32,6 +32,8 @@ | ||||||
| #include <LibGfx/Forward.h> | #include <LibGfx/Forward.h> | ||||||
| #include <LibHTML/CSS/StyleValue.h> | #include <LibHTML/CSS/StyleValue.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class StyleProperties : public RefCounted<StyleProperties> { | class StyleProperties : public RefCounted<StyleProperties> { | ||||||
| public: | public: | ||||||
|     StyleProperties(); |     StyleProperties(); | ||||||
|  | @ -75,3 +77,5 @@ private: | ||||||
| 
 | 
 | ||||||
|     mutable RefPtr<Gfx::Font> m_font; |     mutable RefPtr<Gfx::Font> m_font; | ||||||
| }; | }; | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -34,6 +34,8 @@ | ||||||
| #include <ctype.h> | #include <ctype.h> | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| StyleResolver::StyleResolver(Document& document) | StyleResolver::StyleResolver(Document& document) | ||||||
|     : m_document(document) |     : m_document(document) | ||||||
| { | { | ||||||
|  | @ -294,3 +296,5 @@ NonnullRefPtr<StyleProperties> StyleResolver::resolve_style(const Element& eleme | ||||||
| 
 | 
 | ||||||
|     return style; |     return style; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -30,6 +30,8 @@ | ||||||
| #include <AK/OwnPtr.h> | #include <AK/OwnPtr.h> | ||||||
| #include <LibHTML/CSS/StyleProperties.h> | #include <LibHTML/CSS/StyleProperties.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class Document; | class Document; | ||||||
| class Element; | class Element; | ||||||
| class ParentNode; | class ParentNode; | ||||||
|  | @ -56,3 +58,5 @@ private: | ||||||
| 
 | 
 | ||||||
|     Document& m_document; |     Document& m_document; | ||||||
| }; | }; | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -26,6 +26,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/CSS/StyleRule.h> | #include <LibHTML/CSS/StyleRule.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| StyleRule::StyleRule(Vector<Selector>&& selectors, NonnullRefPtr<StyleDeclaration>&& declaration) | StyleRule::StyleRule(Vector<Selector>&& selectors, NonnullRefPtr<StyleDeclaration>&& declaration) | ||||||
|     : m_selectors(move(selectors)) |     : m_selectors(move(selectors)) | ||||||
|     , m_declaration(move(declaration)) |     , m_declaration(move(declaration)) | ||||||
|  | @ -35,3 +37,5 @@ StyleRule::StyleRule(Vector<Selector>&& selectors, NonnullRefPtr<StyleDeclaratio | ||||||
| StyleRule::~StyleRule() | StyleRule::~StyleRule() | ||||||
| { | { | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -30,6 +30,8 @@ | ||||||
| #include <LibHTML/CSS/Selector.h> | #include <LibHTML/CSS/Selector.h> | ||||||
| #include <LibHTML/CSS/StyleDeclaration.h> | #include <LibHTML/CSS/StyleDeclaration.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class StyleRule : public RefCounted<StyleRule> { | class StyleRule : public RefCounted<StyleRule> { | ||||||
| public: | public: | ||||||
|     static NonnullRefPtr<StyleRule> create(Vector<Selector>&& selectors, NonnullRefPtr<StyleDeclaration>&& declaration) |     static NonnullRefPtr<StyleRule> create(Vector<Selector>&& selectors, NonnullRefPtr<StyleDeclaration>&& declaration) | ||||||
|  | @ -48,3 +50,5 @@ private: | ||||||
|     Vector<Selector> m_selectors; |     Vector<Selector> m_selectors; | ||||||
|     NonnullRefPtr<StyleDeclaration> m_declaration; |     NonnullRefPtr<StyleDeclaration> m_declaration; | ||||||
| }; | }; | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -26,6 +26,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/CSS/StyleSheet.h> | #include <LibHTML/CSS/StyleSheet.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| StyleSheet::StyleSheet(NonnullRefPtrVector<StyleRule>&& rules) | StyleSheet::StyleSheet(NonnullRefPtrVector<StyleRule>&& rules) | ||||||
|     : m_rules(move(rules)) |     : m_rules(move(rules)) | ||||||
| { | { | ||||||
|  | @ -34,3 +36,5 @@ StyleSheet::StyleSheet(NonnullRefPtrVector<StyleRule>&& rules) | ||||||
| StyleSheet::~StyleSheet() | StyleSheet::~StyleSheet() | ||||||
| { | { | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -29,6 +29,8 @@ | ||||||
| #include <AK/NonnullRefPtrVector.h> | #include <AK/NonnullRefPtrVector.h> | ||||||
| #include <LibHTML/CSS/StyleRule.h> | #include <LibHTML/CSS/StyleRule.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class StyleSheet : public RefCounted<StyleSheet> { | class StyleSheet : public RefCounted<StyleSheet> { | ||||||
| public: | public: | ||||||
|     static NonnullRefPtr<StyleSheet> create(NonnullRefPtrVector<StyleRule>&& rules) |     static NonnullRefPtr<StyleSheet> create(NonnullRefPtrVector<StyleRule>&& rules) | ||||||
|  | @ -45,3 +47,5 @@ private: | ||||||
| 
 | 
 | ||||||
|     NonnullRefPtrVector<StyleRule> m_rules; |     NonnullRefPtrVector<StyleRule> m_rules; | ||||||
| }; | }; | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -32,6 +32,8 @@ | ||||||
| #include <LibHTML/Frame.h> | #include <LibHTML/Frame.h> | ||||||
| #include <LibHTML/ResourceLoader.h> | #include <LibHTML/ResourceLoader.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| StyleValue::StyleValue(Type type) | StyleValue::StyleValue(Type type) | ||||||
|     : m_type(type) |     : m_type(type) | ||||||
| { | { | ||||||
|  | @ -76,3 +78,5 @@ ImageStyleValue::ImageStyleValue(const URL& url, Document& document) | ||||||
|         m_document->frame()->set_needs_display({}); |         m_document->frame()->set_needs_display({}); | ||||||
|     }); |     }); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -37,6 +37,8 @@ | ||||||
| #include <LibHTML/CSS/Length.h> | #include <LibHTML/CSS/Length.h> | ||||||
| #include <LibHTML/CSS/PropertyID.h> | #include <LibHTML/CSS/PropertyID.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class Document; | class Document; | ||||||
| 
 | 
 | ||||||
| namespace CSS { | namespace CSS { | ||||||
|  | @ -222,3 +224,5 @@ private: | ||||||
|     WeakPtr<Document> m_document; |     WeakPtr<Document> m_document; | ||||||
|     RefPtr<Gfx::Bitmap> m_bitmap; |     RefPtr<Gfx::Bitmap> m_bitmap; | ||||||
| }; | }; | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -60,6 +60,7 @@ int main(int argc, char** argv) | ||||||
| 
 | 
 | ||||||
|     dbg() << "#include <AK/Assertions.h>"; |     dbg() << "#include <AK/Assertions.h>"; | ||||||
|     dbg() << "#include <LibHTML/CSS/PropertyID.h>"; |     dbg() << "#include <LibHTML/CSS/PropertyID.h>"; | ||||||
|  |     dbg() << "namespace Web {"; | ||||||
|     dbg() << "namespace CSS {"; |     dbg() << "namespace CSS {"; | ||||||
| 
 | 
 | ||||||
|     dbg() << "PropertyID property_id_from_string(const StringView& string) {"; |     dbg() << "PropertyID property_id_from_string(const StringView& string) {"; | ||||||
|  | @ -86,6 +87,7 @@ int main(int argc, char** argv) | ||||||
|     dbg() << "    }"; |     dbg() << "    }"; | ||||||
|     dbg() << "}"; |     dbg() << "}"; | ||||||
|     dbg() << "}"; |     dbg() << "}"; | ||||||
|  |     dbg() << "}"; | ||||||
| 
 | 
 | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -62,6 +62,7 @@ int main(int argc, char** argv) | ||||||
|     dbg() << "#include <AK/StringView.h>"; |     dbg() << "#include <AK/StringView.h>"; | ||||||
|     dbg() << "#include <AK/Traits.h>"; |     dbg() << "#include <AK/Traits.h>"; | ||||||
| 
 | 
 | ||||||
|  |     dbg() << "namespace Web {"; | ||||||
|     dbg() << "namespace CSS {"; |     dbg() << "namespace CSS {"; | ||||||
|     dbg() << "enum class PropertyID {"; |     dbg() << "enum class PropertyID {"; | ||||||
|     dbg() << "    Invalid,"; |     dbg() << "    Invalid,"; | ||||||
|  | @ -75,11 +76,12 @@ int main(int argc, char** argv) | ||||||
| PropertyID property_id_from_string(const StringView&);\n\ | PropertyID property_id_from_string(const StringView&);\n\ | ||||||
| const char* string_from_property_id(PropertyID);\n\ | const char* string_from_property_id(PropertyID);\n\ | ||||||
| }\n\ | }\n\ | ||||||
|  | }\n\ | ||||||
| \n\ | \n\ | ||||||
| namespace AK {\n\ | namespace AK {\n\ | ||||||
| template<>\n\ | template<>\n\ | ||||||
| struct Traits<CSS::PropertyID> : public GenericTraits<CSS::PropertyID> {\n\ | struct Traits<Web::CSS::PropertyID> : public GenericTraits<Web::CSS::PropertyID> {\n\ | ||||||
|     static unsigned hash(CSS::PropertyID property_id) { return int_hash((unsigned)property_id); }\n\ |     static unsigned hash(Web::CSS::PropertyID property_id) { return int_hash((unsigned)property_id); }\n\ | ||||||
| };\n\ | };\n\ | ||||||
| }\n"; | }\n"; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -26,6 +26,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/DOM/CharacterData.h> | #include <LibHTML/DOM/CharacterData.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| CharacterData::CharacterData(Document& document, NodeType type, const String& data) | CharacterData::CharacterData(Document& document, NodeType type, const String& data) | ||||||
|     : Node(document, type) |     : Node(document, type) | ||||||
|     , m_data(data) |     , m_data(data) | ||||||
|  | @ -35,3 +37,5 @@ CharacterData::CharacterData(Document& document, NodeType type, const String& da | ||||||
| CharacterData::~CharacterData() | CharacterData::~CharacterData() | ||||||
| { | { | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -29,6 +29,8 @@ | ||||||
| #include <AK/String.h> | #include <AK/String.h> | ||||||
| #include <LibHTML/DOM/Node.h> | #include <LibHTML/DOM/Node.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class CharacterData : public Node { | class CharacterData : public Node { | ||||||
| public: | public: | ||||||
|     virtual ~CharacterData() override; |     virtual ~CharacterData() override; | ||||||
|  | @ -49,3 +51,5 @@ inline bool is<CharacterData>(const Node& node) | ||||||
| { | { | ||||||
|     return node.is_character_data(); |     return node.is_character_data(); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -27,6 +27,8 @@ | ||||||
| #include <LibHTML/DOM/Comment.h> | #include <LibHTML/DOM/Comment.h> | ||||||
| #include <LibHTML/Layout/LayoutText.h> | #include <LibHTML/Layout/LayoutText.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| Comment::Comment(Document& document, const String& data) | Comment::Comment(Document& document, const String& data) | ||||||
|     : CharacterData(document, NodeType::COMMENT_NODE, data) |     : CharacterData(document, NodeType::COMMENT_NODE, data) | ||||||
| { | { | ||||||
|  | @ -35,3 +37,5 @@ Comment::Comment(Document& document, const String& data) | ||||||
| Comment::~Comment() | Comment::~Comment() | ||||||
| { | { | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -29,6 +29,8 @@ | ||||||
| #include <AK/String.h> | #include <AK/String.h> | ||||||
| #include <LibHTML/DOM/CharacterData.h> | #include <LibHTML/DOM/CharacterData.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class Comment final : public CharacterData { | class Comment final : public CharacterData { | ||||||
| public: | public: | ||||||
|     explicit Comment(Document&, const String&); |     explicit Comment(Document&, const String&); | ||||||
|  | @ -42,3 +44,5 @@ inline bool is<Comment>(const Node& node) | ||||||
| { | { | ||||||
|     return node.is_comment(); |     return node.is_comment(); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -43,6 +43,8 @@ | ||||||
| #include <LibHTML/Layout/LayoutTreeBuilder.h> | #include <LibHTML/Layout/LayoutTreeBuilder.h> | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| Document::Document() | Document::Document() | ||||||
|     : ParentNode(*this, NodeType::DOCUMENT_NODE) |     : ParentNode(*this, NodeType::DOCUMENT_NODE) | ||||||
|     , m_style_resolver(make<StyleResolver>(*this)) |     , m_style_resolver(make<StyleResolver>(*this)) | ||||||
|  | @ -329,3 +331,5 @@ Color Document::visited_link_color() const | ||||||
|         return Color::Magenta; |         return Color::Magenta; | ||||||
|     return frame()->html_view()->palette().visited_link(); |     return frame()->html_view()->palette().visited_link(); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -37,6 +37,8 @@ | ||||||
| #include <LibHTML/CSS/StyleSheet.h> | #include <LibHTML/CSS/StyleSheet.h> | ||||||
| #include <LibHTML/DOM/ParentNode.h> | #include <LibHTML/DOM/ParentNode.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class Frame; | class Frame; | ||||||
| class HTMLBodyElement; | class HTMLBodyElement; | ||||||
| class HTMLHtmlElement; | class HTMLHtmlElement; | ||||||
|  | @ -144,3 +146,5 @@ inline bool is<Document>(const Node& node) | ||||||
| { | { | ||||||
|     return node.is_document(); |     return node.is_document(); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -28,6 +28,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/DOM/ParentNode.h> | #include <LibHTML/DOM/ParentNode.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class DocumentFragment : public ParentNode { | class DocumentFragment : public ParentNode { | ||||||
| public: | public: | ||||||
|     DocumentFragment(Document& document) |     DocumentFragment(Document& document) | ||||||
|  | @ -43,3 +45,5 @@ inline bool is<DocumentFragment>(const Node& node) | ||||||
| { | { | ||||||
|     return node.is_document_fragment(); |     return node.is_document_fragment(); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -26,6 +26,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/DOM/DocumentType.h> | #include <LibHTML/DOM/DocumentType.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| DocumentType::DocumentType(Document& document) | DocumentType::DocumentType(Document& document) | ||||||
|     : Node(document, NodeType::DOCUMENT_TYPE_NODE) |     : Node(document, NodeType::DOCUMENT_TYPE_NODE) | ||||||
| { | { | ||||||
|  | @ -34,3 +36,5 @@ DocumentType::DocumentType(Document& document) | ||||||
| DocumentType::~DocumentType() | DocumentType::~DocumentType() | ||||||
| { | { | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -28,6 +28,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/DOM/Node.h> | #include <LibHTML/DOM/Node.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class DocumentType final : public Node { | class DocumentType final : public Node { | ||||||
| public: | public: | ||||||
|     explicit DocumentType(Document&); |     explicit DocumentType(Document&); | ||||||
|  | @ -41,3 +43,5 @@ inline bool is<DocumentType>(const Node& node) | ||||||
| { | { | ||||||
|     return node.type() == NodeType::DOCUMENT_TYPE_NODE; |     return node.type() == NodeType::DOCUMENT_TYPE_NODE; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -37,6 +37,8 @@ | ||||||
| #include <LibHTML/Layout/LayoutTableRow.h> | #include <LibHTML/Layout/LayoutTableRow.h> | ||||||
| #include <LibHTML/Layout/LayoutTreeBuilder.h> | #include <LibHTML/Layout/LayoutTreeBuilder.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| Element::Element(Document& document, const String& tag_name) | Element::Element(Document& document, const String& tag_name) | ||||||
|     : ParentNode(document, NodeType::ELEMENT_NODE) |     : ParentNode(document, NodeType::ELEMENT_NODE) | ||||||
|     , m_tag_name(tag_name) |     , m_tag_name(tag_name) | ||||||
|  | @ -215,3 +217,5 @@ NonnullRefPtr<StyleProperties> Element::computed_style() | ||||||
|     } |     } | ||||||
|     return properties; |     return properties; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -30,6 +30,8 @@ | ||||||
| #include <LibHTML/DOM/ParentNode.h> | #include <LibHTML/DOM/ParentNode.h> | ||||||
| #include <LibHTML/Layout/LayoutNode.h> | #include <LibHTML/Layout/LayoutNode.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class LayoutNodeWithStyle; | class LayoutNodeWithStyle; | ||||||
| 
 | 
 | ||||||
| class Attribute { | class Attribute { | ||||||
|  | @ -102,3 +104,5 @@ inline bool is<Element>(const Node& node) | ||||||
| { | { | ||||||
|     return node.is_element(); |     return node.is_element(); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -41,6 +41,8 @@ | ||||||
| #include <LibHTML/DOM/HTMLStyleElement.h> | #include <LibHTML/DOM/HTMLStyleElement.h> | ||||||
| #include <LibHTML/DOM/HTMLTitleElement.h> | #include <LibHTML/DOM/HTMLTitleElement.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| NonnullRefPtr<Element> create_element(Document& document, const String& tag_name) | NonnullRefPtr<Element> create_element(Document& document, const String& tag_name) | ||||||
| { | { | ||||||
|     auto lowercase_tag_name = tag_name.to_lowercase(); |     auto lowercase_tag_name = tag_name.to_lowercase(); | ||||||
|  | @ -82,3 +84,5 @@ NonnullRefPtr<Element> create_element(Document& document, const String& tag_name | ||||||
|     } |     } | ||||||
|     return adopt(*new Element(document, lowercase_tag_name)); |     return adopt(*new Element(document, lowercase_tag_name)); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -28,4 +28,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/DOM/Element.h> | #include <LibHTML/DOM/Element.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| NonnullRefPtr<Element> create_element(Document&, const String& tag_name); | NonnullRefPtr<Element> create_element(Document&, const String& tag_name); | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -26,6 +26,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/DOM/HTMLAnchorElement.h> | #include <LibHTML/DOM/HTMLAnchorElement.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| HTMLAnchorElement::HTMLAnchorElement(Document& document, const String& tag_name) | HTMLAnchorElement::HTMLAnchorElement(Document& document, const String& tag_name) | ||||||
|     : HTMLElement(document, tag_name) |     : HTMLElement(document, tag_name) | ||||||
| { | { | ||||||
|  | @ -34,3 +36,5 @@ HTMLAnchorElement::HTMLAnchorElement(Document& document, const String& tag_name) | ||||||
| HTMLAnchorElement::~HTMLAnchorElement() | HTMLAnchorElement::~HTMLAnchorElement() | ||||||
| { | { | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -28,6 +28,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/DOM/HTMLElement.h> | #include <LibHTML/DOM/HTMLElement.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class HTMLAnchorElement : public HTMLElement { | class HTMLAnchorElement : public HTMLElement { | ||||||
| public: | public: | ||||||
|     HTMLAnchorElement(Document&, const String& tag_name); |     HTMLAnchorElement(Document&, const String& tag_name); | ||||||
|  | @ -41,3 +43,5 @@ inline bool is<HTMLAnchorElement>(const Node& node) | ||||||
| { | { | ||||||
|     return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "a"; |     return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "a"; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -27,6 +27,8 @@ | ||||||
| #include <LibHTML/DOM/HTMLBRElement.h> | #include <LibHTML/DOM/HTMLBRElement.h> | ||||||
| #include <LibHTML/Layout/LayoutBreak.h> | #include <LibHTML/Layout/LayoutBreak.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| HTMLBRElement::HTMLBRElement(Document& document, const String& tag_name) | HTMLBRElement::HTMLBRElement(Document& document, const String& tag_name) | ||||||
|     : HTMLElement(document, tag_name) |     : HTMLElement(document, tag_name) | ||||||
| { | { | ||||||
|  | @ -40,3 +42,5 @@ RefPtr<LayoutNode> HTMLBRElement::create_layout_node(const StyleProperties*) con | ||||||
| { | { | ||||||
|     return adopt(*new LayoutBreak(*this)); |     return adopt(*new LayoutBreak(*this)); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -28,6 +28,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/DOM/HTMLElement.h> | #include <LibHTML/DOM/HTMLElement.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class HTMLBRElement final : public HTMLElement { | class HTMLBRElement final : public HTMLElement { | ||||||
| public: | public: | ||||||
|     HTMLBRElement(Document&, const String& tag_name); |     HTMLBRElement(Document&, const String& tag_name); | ||||||
|  | @ -41,3 +43,5 @@ inline bool is<HTMLBRElement>(const Node& node) | ||||||
| { | { | ||||||
|     return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "br"; |     return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "br"; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -30,6 +30,8 @@ | ||||||
| #include <LibHTML/DOM/HTMLBlinkElement.h> | #include <LibHTML/DOM/HTMLBlinkElement.h> | ||||||
| #include <LibHTML/Layout/LayoutNode.h> | #include <LibHTML/Layout/LayoutNode.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| HTMLBlinkElement::HTMLBlinkElement(Document& document, const String& tag_name) | HTMLBlinkElement::HTMLBlinkElement(Document& document, const String& tag_name) | ||||||
|     : HTMLElement(document, tag_name) |     : HTMLElement(document, tag_name) | ||||||
|     , m_timer(Core::Timer::construct()) |     , m_timer(Core::Timer::construct()) | ||||||
|  | @ -51,3 +53,5 @@ void HTMLBlinkElement::blink() | ||||||
|     layout_node()->set_visible(!layout_node()->is_visible()); |     layout_node()->set_visible(!layout_node()->is_visible()); | ||||||
|     layout_node()->set_needs_display(); |     layout_node()->set_needs_display(); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -29,6 +29,8 @@ | ||||||
| #include <LibCore/Forward.h> | #include <LibCore/Forward.h> | ||||||
| #include <LibHTML/DOM/HTMLElement.h> | #include <LibHTML/DOM/HTMLElement.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class HTMLBlinkElement : public HTMLElement { | class HTMLBlinkElement : public HTMLElement { | ||||||
| public: | public: | ||||||
|     HTMLBlinkElement(Document&, const String& tag_name); |     HTMLBlinkElement(Document&, const String& tag_name); | ||||||
|  | @ -39,3 +41,5 @@ private: | ||||||
| 
 | 
 | ||||||
|     NonnullRefPtr<Core::Timer> m_timer; |     NonnullRefPtr<Core::Timer> m_timer; | ||||||
| }; | }; | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -29,6 +29,8 @@ | ||||||
| #include <LibHTML/DOM/Document.h> | #include <LibHTML/DOM/Document.h> | ||||||
| #include <LibHTML/DOM/HTMLBodyElement.h> | #include <LibHTML/DOM/HTMLBodyElement.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| HTMLBodyElement::HTMLBodyElement(Document& document, const String& tag_name) | HTMLBodyElement::HTMLBodyElement(Document& document, const String& tag_name) | ||||||
|     : HTMLElement(document, 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()); |             document().set_visited_link_color(color.value()); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -28,6 +28,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/DOM/HTMLElement.h> | #include <LibHTML/DOM/HTMLElement.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class HTMLBodyElement : public HTMLElement { | class HTMLBodyElement : public HTMLElement { | ||||||
| public: | public: | ||||||
|     HTMLBodyElement(Document&, const String& tag_name); |     HTMLBodyElement(Document&, const String& tag_name); | ||||||
|  | @ -42,3 +44,5 @@ inline bool is<HTMLBodyElement>(const Node& node) | ||||||
| { | { | ||||||
|     return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "body"; |     return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "body"; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -26,6 +26,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/DOM/HTMLElement.h> | #include <LibHTML/DOM/HTMLElement.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| HTMLElement::HTMLElement(Document& document, const String& tag_name) | HTMLElement::HTMLElement(Document& document, const String& tag_name) | ||||||
|     : Element(document, tag_name) |     : Element(document, tag_name) | ||||||
| { | { | ||||||
|  | @ -34,3 +36,5 @@ HTMLElement::HTMLElement(Document& document, const String& tag_name) | ||||||
| HTMLElement::~HTMLElement() | HTMLElement::~HTMLElement() | ||||||
| { | { | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -28,6 +28,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/DOM/Element.h> | #include <LibHTML/DOM/Element.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class HTMLElement : public Element { | class HTMLElement : public Element { | ||||||
| public: | public: | ||||||
|     HTMLElement(Document&, const String& tag_name); |     HTMLElement(Document&, const String& tag_name); | ||||||
|  | @ -44,3 +46,5 @@ inline bool is<HTMLElement>(const Node& node) | ||||||
| { | { | ||||||
|     return node.is_html_element(); |     return node.is_html_element(); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -28,6 +28,8 @@ | ||||||
| #include <LibHTML/CSS/StyleValue.h> | #include <LibHTML/CSS/StyleValue.h> | ||||||
| #include <LibHTML/DOM/HTMLFontElement.h> | #include <LibHTML/DOM/HTMLFontElement.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| HTMLFontElement::HTMLFontElement(Document& document, const String& tag_name) | HTMLFontElement::HTMLFontElement(Document& document, const String& tag_name) | ||||||
|     : HTMLElement(document, tag_name) |     : HTMLElement(document, tag_name) | ||||||
| { | { | ||||||
|  | @ -47,3 +49,5 @@ void HTMLFontElement::apply_presentational_hints(StyleProperties& style) const | ||||||
|         } |         } | ||||||
|     }); |     }); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -28,6 +28,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/DOM/HTMLElement.h> | #include <LibHTML/DOM/HTMLElement.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class HTMLFontElement : public HTMLElement { | class HTMLFontElement : public HTMLElement { | ||||||
| public: | public: | ||||||
|     HTMLFontElement(Document&, const String& tag_name); |     HTMLFontElement(Document&, const String& tag_name); | ||||||
|  | @ -35,3 +37,5 @@ public: | ||||||
| 
 | 
 | ||||||
|     virtual void apply_presentational_hints(StyleProperties&) const override; |     virtual void apply_presentational_hints(StyleProperties&) const override; | ||||||
| }; | }; | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -30,6 +30,8 @@ | ||||||
| #include <LibHTML/Frame.h> | #include <LibHTML/Frame.h> | ||||||
| #include <LibHTML/HtmlView.h> | #include <LibHTML/HtmlView.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| HTMLFormElement::HTMLFormElement(Document& document, const String& tag_name) | HTMLFormElement::HTMLFormElement(Document& document, const String& tag_name) | ||||||
|     : HTMLElement(document, 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.
 |     // FIXME: We shouldn't let the form just do this willy-nilly.
 | ||||||
|     document().frame()->html_view()->load(url); |     document().frame()->html_view()->load(url); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -28,6 +28,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/DOM/HTMLElement.h> | #include <LibHTML/DOM/HTMLElement.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class HTMLFormElement : public HTMLElement { | class HTMLFormElement : public HTMLElement { | ||||||
| public: | public: | ||||||
|     HTMLFormElement(Document&, const String& tag_name); |     HTMLFormElement(Document&, const String& tag_name); | ||||||
|  | @ -44,3 +46,5 @@ inline bool is<HTMLFormElement>(const Node& node) | ||||||
| { | { | ||||||
|     return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "form"; |     return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "form"; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -26,6 +26,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/DOM/HTMLHRElement.h> | #include <LibHTML/DOM/HTMLHRElement.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| HTMLHRElement::HTMLHRElement(Document& document, const String& tag_name) | HTMLHRElement::HTMLHRElement(Document& document, const String& tag_name) | ||||||
|     : HTMLElement(document, tag_name) |     : HTMLElement(document, tag_name) | ||||||
| { | { | ||||||
|  | @ -34,3 +36,5 @@ HTMLHRElement::HTMLHRElement(Document& document, const String& tag_name) | ||||||
| HTMLHRElement::~HTMLHRElement() | HTMLHRElement::~HTMLHRElement() | ||||||
| { | { | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -28,8 +28,12 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/DOM/HTMLElement.h> | #include <LibHTML/DOM/HTMLElement.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class HTMLHRElement : public HTMLElement { | class HTMLHRElement : public HTMLElement { | ||||||
| public: | public: | ||||||
|     HTMLHRElement(Document&, const String& tag_name); |     HTMLHRElement(Document&, const String& tag_name); | ||||||
|     virtual ~HTMLHRElement() override; |     virtual ~HTMLHRElement() override; | ||||||
| }; | }; | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -26,6 +26,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/DOM/HTMLHeadElement.h> | #include <LibHTML/DOM/HTMLHeadElement.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| HTMLHeadElement::HTMLHeadElement(Document& document, const String& tag_name) | HTMLHeadElement::HTMLHeadElement(Document& document, const String& tag_name) | ||||||
|     : HTMLElement(document, tag_name) |     : HTMLElement(document, tag_name) | ||||||
| { | { | ||||||
|  | @ -34,3 +36,5 @@ HTMLHeadElement::HTMLHeadElement(Document& document, const String& tag_name) | ||||||
| HTMLHeadElement::~HTMLHeadElement() | HTMLHeadElement::~HTMLHeadElement() | ||||||
| { | { | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -28,6 +28,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/DOM/HTMLElement.h> | #include <LibHTML/DOM/HTMLElement.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class HTMLHeadElement : public HTMLElement { | class HTMLHeadElement : public HTMLElement { | ||||||
| public: | public: | ||||||
|     HTMLHeadElement(Document&, const String& tag_name); |     HTMLHeadElement(Document&, const String& tag_name); | ||||||
|  | @ -39,3 +41,5 @@ inline bool is<HTMLHeadElement>(const Node& node) | ||||||
| { | { | ||||||
|     return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "head"; |     return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "head"; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -26,6 +26,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/DOM/HTMLHeadingElement.h> | #include <LibHTML/DOM/HTMLHeadingElement.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| HTMLHeadingElement::HTMLHeadingElement(Document& document, const String& tag_name) | HTMLHeadingElement::HTMLHeadingElement(Document& document, const String& tag_name) | ||||||
|     : HTMLElement(document, tag_name) |     : HTMLElement(document, tag_name) | ||||||
| { | { | ||||||
|  | @ -34,3 +36,5 @@ HTMLHeadingElement::HTMLHeadingElement(Document& document, const String& tag_nam | ||||||
| HTMLHeadingElement::~HTMLHeadingElement() | HTMLHeadingElement::~HTMLHeadingElement() | ||||||
| { | { | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -28,8 +28,12 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/DOM/HTMLElement.h> | #include <LibHTML/DOM/HTMLElement.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class HTMLHeadingElement : public HTMLElement { | class HTMLHeadingElement : public HTMLElement { | ||||||
| public: | public: | ||||||
|     HTMLHeadingElement(Document&, const String& tag_name); |     HTMLHeadingElement(Document&, const String& tag_name); | ||||||
|     virtual ~HTMLHeadingElement() override; |     virtual ~HTMLHeadingElement() override; | ||||||
| }; | }; | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -26,6 +26,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/DOM/HTMLHtmlElement.h> | #include <LibHTML/DOM/HTMLHtmlElement.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| HTMLHtmlElement::HTMLHtmlElement(Document& document, const String& tag_name) | HTMLHtmlElement::HTMLHtmlElement(Document& document, const String& tag_name) | ||||||
|     : HTMLElement(document, tag_name) |     : HTMLElement(document, tag_name) | ||||||
| { | { | ||||||
|  | @ -34,3 +36,5 @@ HTMLHtmlElement::HTMLHtmlElement(Document& document, const String& tag_name) | ||||||
| HTMLHtmlElement::~HTMLHtmlElement() | HTMLHtmlElement::~HTMLHtmlElement() | ||||||
| { | { | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -28,6 +28,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/DOM/HTMLElement.h> | #include <LibHTML/DOM/HTMLElement.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class HTMLHtmlElement : public HTMLElement { | class HTMLHtmlElement : public HTMLElement { | ||||||
| public: | public: | ||||||
|     HTMLHtmlElement(Document&, const String& tag_name); |     HTMLHtmlElement(Document&, const String& tag_name); | ||||||
|  | @ -39,3 +41,5 @@ inline bool is<HTMLHtmlElement>(const Node& node) | ||||||
| { | { | ||||||
|     return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "html"; |     return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "html"; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -32,6 +32,8 @@ | ||||||
| #include <LibHTML/Layout/LayoutImage.h> | #include <LibHTML/Layout/LayoutImage.h> | ||||||
| #include <LibHTML/ResourceLoader.h> | #include <LibHTML/ResourceLoader.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| HTMLImageElement::HTMLImageElement(Document& document, const String& tag_name) | HTMLImageElement::HTMLImageElement(Document& document, const String& tag_name) | ||||||
|     : HTMLElement(document, tag_name) |     : HTMLElement(document, tag_name) | ||||||
| { | { | ||||||
|  | @ -121,3 +123,5 @@ void HTMLImageElement::set_volatile(Badge<LayoutDocument>, bool v) | ||||||
|         return; |         return; | ||||||
|     m_image_decoder = Gfx::ImageDecoder::create(m_encoded_data.data(), m_encoded_data.size()); |     m_image_decoder = Gfx::ImageDecoder::create(m_encoded_data.data(), m_encoded_data.size()); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -30,6 +30,8 @@ | ||||||
| #include <LibGfx/Forward.h> | #include <LibGfx/Forward.h> | ||||||
| #include <LibHTML/DOM/HTMLElement.h> | #include <LibHTML/DOM/HTMLElement.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class LayoutDocument; | class LayoutDocument; | ||||||
| 
 | 
 | ||||||
| class HTMLImageElement : public HTMLElement { | class HTMLImageElement : public HTMLElement { | ||||||
|  | @ -57,3 +59,5 @@ private: | ||||||
|     RefPtr<Gfx::ImageDecoder> m_image_decoder; |     RefPtr<Gfx::ImageDecoder> m_image_decoder; | ||||||
|     ByteBuffer m_encoded_data; |     ByteBuffer m_encoded_data; | ||||||
| }; | }; | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -34,6 +34,8 @@ | ||||||
| #include <LibHTML/HtmlView.h> | #include <LibHTML/HtmlView.h> | ||||||
| #include <LibHTML/Layout/LayoutWidget.h> | #include <LibHTML/Layout/LayoutWidget.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| HTMLInputElement::HTMLInputElement(Document& document, const String& tag_name) | HTMLInputElement::HTMLInputElement(Document& document, const String& tag_name) | ||||||
|     : HTMLElement(document, tag_name) |     : HTMLElement(document, tag_name) | ||||||
| { | { | ||||||
|  | @ -76,3 +78,5 @@ RefPtr<LayoutNode> HTMLInputElement::create_layout_node(const StyleProperties*) | ||||||
| 
 | 
 | ||||||
|     return adopt(*new LayoutWidget(*this, *widget)); |     return adopt(*new LayoutWidget(*this, *widget)); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -28,6 +28,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/DOM/HTMLElement.h> | #include <LibHTML/DOM/HTMLElement.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class HTMLInputElement : public HTMLElement { | class HTMLInputElement : public HTMLElement { | ||||||
| public: | public: | ||||||
|     HTMLInputElement(Document&, const String& tag_name); |     HTMLInputElement(Document&, const String& tag_name); | ||||||
|  | @ -45,3 +47,5 @@ inline bool is<HTMLInputElement>(const Node& node) | ||||||
| { | { | ||||||
|     return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "input"; |     return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "input"; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -32,6 +32,8 @@ | ||||||
| #include <LibHTML/Parser/CSSParser.h> | #include <LibHTML/Parser/CSSParser.h> | ||||||
| #include <LibHTML/ResourceLoader.h> | #include <LibHTML/ResourceLoader.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| HTMLLinkElement::HTMLLinkElement(Document& document, const String& tag_name) | HTMLLinkElement::HTMLLinkElement(Document& document, const String& tag_name) | ||||||
|     : HTMLElement(document, tag_name) |     : HTMLElement(document, tag_name) | ||||||
| { | { | ||||||
|  | @ -60,3 +62,5 @@ void HTMLLinkElement::inserted_into(Node&) | ||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -28,6 +28,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/DOM/HTMLElement.h> | #include <LibHTML/DOM/HTMLElement.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class HTMLLinkElement final : public HTMLElement { | class HTMLLinkElement final : public HTMLElement { | ||||||
| public: | public: | ||||||
|     HTMLLinkElement(Document&, const String& tag_name); |     HTMLLinkElement(Document&, const String& tag_name); | ||||||
|  | @ -45,3 +47,5 @@ inline bool is<HTMLLinkElement>(const Node& node) | ||||||
| { | { | ||||||
|     return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "link"; |     return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "link"; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -30,6 +30,8 @@ | ||||||
| #include <LibHTML/DOM/Text.h> | #include <LibHTML/DOM/Text.h> | ||||||
| #include <LibHTML/Parser/CSSParser.h> | #include <LibHTML/Parser/CSSParser.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| HTMLStyleElement::HTMLStyleElement(Document& document, const String& tag_name) | HTMLStyleElement::HTMLStyleElement(Document& document, const String& tag_name) | ||||||
|     : HTMLElement(document, tag_name) |     : HTMLElement(document, tag_name) | ||||||
| { | { | ||||||
|  | @ -59,3 +61,5 @@ void HTMLStyleElement::removed_from(Node& old_parent) | ||||||
|     } |     } | ||||||
|     return HTMLElement::removed_from(old_parent); |     return HTMLElement::removed_from(old_parent); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -28,6 +28,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/DOM/HTMLElement.h> | #include <LibHTML/DOM/HTMLElement.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class StyleSheet; | class StyleSheet; | ||||||
| 
 | 
 | ||||||
| class HTMLStyleElement : public HTMLElement { | class HTMLStyleElement : public HTMLElement { | ||||||
|  | @ -41,3 +43,5 @@ public: | ||||||
| private: | private: | ||||||
|     RefPtr<StyleSheet> m_stylesheet; |     RefPtr<StyleSheet> m_stylesheet; | ||||||
| }; | }; | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -26,6 +26,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/DOM/HTMLTitleElement.h> | #include <LibHTML/DOM/HTMLTitleElement.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| HTMLTitleElement::HTMLTitleElement(Document& document, const String& tag_name) | HTMLTitleElement::HTMLTitleElement(Document& document, const String& tag_name) | ||||||
|     : HTMLElement(document, tag_name) |     : HTMLElement(document, tag_name) | ||||||
| { | { | ||||||
|  | @ -34,3 +36,5 @@ HTMLTitleElement::HTMLTitleElement(Document& document, const String& tag_name) | ||||||
| HTMLTitleElement::~HTMLTitleElement() | HTMLTitleElement::~HTMLTitleElement() | ||||||
| { | { | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -28,6 +28,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/DOM/HTMLElement.h> | #include <LibHTML/DOM/HTMLElement.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class HTMLTitleElement : public HTMLElement { | class HTMLTitleElement : public HTMLElement { | ||||||
| public: | public: | ||||||
|     HTMLTitleElement(Document&, const String& tag_name); |     HTMLTitleElement(Document&, const String& tag_name); | ||||||
|  | @ -39,3 +41,5 @@ inline bool is<HTMLTitleElement>(const Node& node) | ||||||
| { | { | ||||||
|     return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "title"; |     return is<Element>(node) && to<Element>(node).tag_name().to_lowercase() == "title"; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -35,6 +35,8 @@ | ||||||
| #include <LibHTML/Layout/LayoutNode.h> | #include <LibHTML/Layout/LayoutNode.h> | ||||||
| #include <LibHTML/Layout/LayoutText.h> | #include <LibHTML/Layout/LayoutText.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| Node::Node(Document& document, NodeType type) | Node::Node(Document& document, NodeType type) | ||||||
|     : m_document(document) |     : m_document(document) | ||||||
|     , m_type(type) |     , m_type(type) | ||||||
|  | @ -114,3 +116,5 @@ bool Node::is_link() const | ||||||
|         return false; |         return false; | ||||||
|     return enclosing_link->has_attribute("href"); |     return enclosing_link->has_attribute("href"); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -32,6 +32,8 @@ | ||||||
| #include <AK/Vector.h> | #include <AK/Vector.h> | ||||||
| #include <LibHTML/TreeNode.h> | #include <LibHTML/TreeNode.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| enum class NodeType : unsigned { | enum class NodeType : unsigned { | ||||||
|     INVALID = 0, |     INVALID = 0, | ||||||
|     ELEMENT_NODE = 1, |     ELEMENT_NODE = 1, | ||||||
|  | @ -185,3 +187,5 @@ inline const T* Node::first_ancestor_of_type() const | ||||||
|     } |     } | ||||||
|     return nullptr; |     return nullptr; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -28,6 +28,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/DOM/Node.h> | #include <LibHTML/DOM/Node.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class ParentNode : public Node { | class ParentNode : public Node { | ||||||
| public: | public: | ||||||
|     template<typename F> void for_each_child(F) const; |     template<typename F> 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()) |     for (auto* node = first_child(); node; node = node->next_sibling()) | ||||||
|         callback(*node); |         callback(*node); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -27,6 +27,8 @@ | ||||||
| #include <LibHTML/DOM/Text.h> | #include <LibHTML/DOM/Text.h> | ||||||
| #include <LibHTML/Layout/LayoutText.h> | #include <LibHTML/Layout/LayoutText.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| Text::Text(Document& document, const String& data) | Text::Text(Document& document, const String& data) | ||||||
|     : CharacterData(document, NodeType::TEXT_NODE, data) |     : CharacterData(document, NodeType::TEXT_NODE, data) | ||||||
| { | { | ||||||
|  | @ -40,3 +42,5 @@ RefPtr<LayoutNode> Text::create_layout_node(const StyleProperties*) const | ||||||
| { | { | ||||||
|     return adopt(*new LayoutText(*this)); |     return adopt(*new LayoutText(*this)); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -29,6 +29,8 @@ | ||||||
| #include <AK/String.h> | #include <AK/String.h> | ||||||
| #include <LibHTML/DOM/CharacterData.h> | #include <LibHTML/DOM/CharacterData.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class Text final : public CharacterData { | class Text final : public CharacterData { | ||||||
| public: | public: | ||||||
|     explicit Text(Document&, const String&); |     explicit Text(Document&, const String&); | ||||||
|  | @ -45,3 +47,5 @@ inline bool is<Text>(const Node& node) | ||||||
| { | { | ||||||
|     return node.is_text(); |     return node.is_text(); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -32,6 +32,8 @@ | ||||||
| #include <ctype.h> | #include <ctype.h> | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| DOMTreeModel::DOMTreeModel(Document& document) | DOMTreeModel::DOMTreeModel(Document& document) | ||||||
|     : m_document(document) |     : m_document(document) | ||||||
| { | { | ||||||
|  | @ -151,3 +153,5 @@ void DOMTreeModel::update() | ||||||
| { | { | ||||||
|     did_update(); |     did_update(); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -28,6 +28,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibGUI/Model.h> | #include <LibGUI/Model.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class Document; | class Document; | ||||||
| 
 | 
 | ||||||
| class DOMTreeModel final : public GUI::Model { | class DOMTreeModel final : public GUI::Model { | ||||||
|  | @ -55,3 +57,5 @@ private: | ||||||
|     GUI::Icon m_element_icon; |     GUI::Icon m_element_icon; | ||||||
|     GUI::Icon m_text_icon; |     GUI::Icon m_text_icon; | ||||||
| }; | }; | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -38,6 +38,8 @@ | ||||||
| #include <LibHTML/Layout/LayoutText.h> | #include <LibHTML/Layout/LayoutText.h> | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| void dump_tree(const Node& node) | void dump_tree(const Node& node) | ||||||
| { | { | ||||||
|     static int indent = 0; |     static int indent = 0; | ||||||
|  | @ -252,3 +254,5 @@ void dump_sheet(const StyleSheet& sheet) | ||||||
|         dump_rule(rule); |         dump_rule(rule); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -26,6 +26,8 @@ | ||||||
| 
 | 
 | ||||||
| #pragma once | #pragma once | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class Node; | class Node; | ||||||
| class LayoutNode; | class LayoutNode; | ||||||
| class StyleRule; | class StyleRule; | ||||||
|  | @ -37,3 +39,5 @@ void dump_sheet(const StyleSheet&); | ||||||
| void dump_rule(const StyleRule&); | void dump_rule(const StyleRule&); | ||||||
| 
 | 
 | ||||||
| #undef HTML_DEBUG | #undef HTML_DEBUG | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
							
								
								
									
										37
									
								
								Libraries/LibHTML/Forward.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								Libraries/LibHTML/Forward.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,37 @@ | ||||||
|  | /*
 | ||||||
|  |  * Copyright (c) 2020, Andreas Kling <kling@serenityos.org> | ||||||
|  |  * 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; | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  | @ -29,6 +29,8 @@ | ||||||
| #include <LibHTML/HtmlView.h> | #include <LibHTML/HtmlView.h> | ||||||
| #include <LibHTML/Layout/LayoutDocument.h> | #include <LibHTML/Layout/LayoutDocument.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| Frame::Frame(HtmlView& html_view) | Frame::Frame(HtmlView& html_view) | ||||||
|     : m_html_view(html_view.make_weak_ptr()) |     : m_html_view(html_view.make_weak_ptr()) | ||||||
| { | { | ||||||
|  | @ -78,3 +80,5 @@ void Frame::set_needs_display(const Gfx::Rect& rect) | ||||||
|         return; |         return; | ||||||
|     on_set_needs_display(rect); |     on_set_needs_display(rect); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -34,6 +34,8 @@ | ||||||
| #include <LibGfx/Size.h> | #include <LibGfx/Size.h> | ||||||
| #include <LibHTML/TreeNode.h> | #include <LibHTML/TreeNode.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class Document; | class Document; | ||||||
| class HtmlView; | class HtmlView; | ||||||
| 
 | 
 | ||||||
|  | @ -67,3 +69,5 @@ private: | ||||||
|     Gfx::Size m_size; |     Gfx::Size m_size; | ||||||
|     Gfx::Rect m_viewport_rect; |     Gfx::Rect m_viewport_rect; | ||||||
| }; | }; | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -25,6 +25,7 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <AK/FileSystemPath.h> | #include <AK/FileSystemPath.h> | ||||||
|  | #include <AK/URL.h> | ||||||
| #include <LibCore/File.h> | #include <LibCore/File.h> | ||||||
| #include <LibGUI/Application.h> | #include <LibGUI/Application.h> | ||||||
| #include <LibGUI/Painter.h> | #include <LibGUI/Painter.h> | ||||||
|  | @ -46,8 +47,10 @@ | ||||||
| #include <LibHTML/ResourceLoader.h> | #include <LibHTML/ResourceLoader.h> | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| HtmlView::HtmlView() | 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) { |     main_frame().on_set_needs_display = [this](auto& content_rect) { | ||||||
|         if (content_rect.is_empty()) { |         if (content_rect.is_empty()) { | ||||||
|  | @ -320,7 +323,7 @@ static RefPtr<Document> create_image_document(const ByteBuffer& data, const URL& | ||||||
| 
 | 
 | ||||||
| void HtmlView::load(const URL& url) | void HtmlView::load(const URL& url) | ||||||
| { | { | ||||||
|     dbg() << "HtmlView::load: " << url; |     dbg() << "HtmlView::load: " << url.to_string(); | ||||||
| 
 | 
 | ||||||
|     if (window()) |     if (window()) | ||||||
|         window()->set_override_cursor(GUI::StandardCursor::None); |         window()->set_override_cursor(GUI::StandardCursor::None); | ||||||
|  | @ -410,3 +413,5 @@ void HtmlView::did_scroll() | ||||||
| { | { | ||||||
|     main_frame().set_viewport_rect(visible_content_rect()); |     main_frame().set_viewport_rect(visible_content_rect()); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -29,6 +29,8 @@ | ||||||
| #include <LibGUI/ScrollableWidget.h> | #include <LibGUI/ScrollableWidget.h> | ||||||
| #include <LibHTML/DOM/Document.h> | #include <LibHTML/DOM/Document.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class Frame; | class Frame; | ||||||
| 
 | 
 | ||||||
| class HtmlView : public GUI::ScrollableWidget { | class HtmlView : public GUI::ScrollableWidget { | ||||||
|  | @ -43,8 +45,8 @@ public: | ||||||
|     const LayoutDocument* layout_root() const; |     const LayoutDocument* layout_root() const; | ||||||
|     LayoutDocument* layout_root(); |     LayoutDocument* layout_root(); | ||||||
| 
 | 
 | ||||||
|     ::Frame& main_frame() { return *m_main_frame; } |     Web::Frame& main_frame() { return *m_main_frame; } | ||||||
|     const ::Frame& main_frame() const { return *m_main_frame; } |     const Web::Frame& main_frame() const { return *m_main_frame; } | ||||||
| 
 | 
 | ||||||
|     void reload(); |     void reload(); | ||||||
|     void load(const URL&); |     void load(const URL&); | ||||||
|  | @ -77,8 +79,10 @@ private: | ||||||
|     void layout_and_sync_size(); |     void layout_and_sync_size(); | ||||||
|     void dump_selection(const char* event_name); |     void dump_selection(const char* event_name); | ||||||
| 
 | 
 | ||||||
|     RefPtr<::Frame> m_main_frame; |     RefPtr<Web::Frame> m_main_frame; | ||||||
| 
 | 
 | ||||||
|     bool m_should_show_line_box_borders { false }; |     bool m_should_show_line_box_borders { false }; | ||||||
|     bool m_in_mouse_selection { false }; |     bool m_in_mouse_selection { false }; | ||||||
| }; | }; | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -26,6 +26,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <LibHTML/Layout/BoxModelMetrics.h> | #include <LibHTML/Layout/BoxModelMetrics.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| BoxModelMetrics::BoxModelMetrics() | 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(), |         m_margin.left.to_px() + m_border.left.to_px() + m_padding.left.to_px(), | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -29,6 +29,8 @@ | ||||||
| #include <LibGfx/Size.h> | #include <LibGfx/Size.h> | ||||||
| #include <LibHTML/CSS/LengthBox.h> | #include <LibHTML/CSS/LengthBox.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class BoxModelMetrics { | class BoxModelMetrics { | ||||||
| public: | public: | ||||||
|     BoxModelMetrics(); |     BoxModelMetrics(); | ||||||
|  | @ -56,3 +58,5 @@ private: | ||||||
|     LengthBox m_padding; |     LengthBox m_padding; | ||||||
|     LengthBox m_border; |     LengthBox m_border; | ||||||
| }; | }; | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -33,6 +33,8 @@ | ||||||
| #include <LibHTML/Layout/LayoutText.h> | #include <LibHTML/Layout/LayoutText.h> | ||||||
| #include <math.h> | #include <math.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| LayoutBlock::LayoutBlock(const Node* node, NonnullRefPtr<StyleProperties> style) | LayoutBlock::LayoutBlock(const Node* node, NonnullRefPtr<StyleProperties> style) | ||||||
|     : LayoutBox(node, move(style)) |     : LayoutBox(node, move(style)) | ||||||
| { | { | ||||||
|  | @ -384,3 +386,5 @@ LineBox& LayoutBlock::add_line_box() | ||||||
|     m_line_boxes.append(LineBox()); |     m_line_boxes.append(LineBox()); | ||||||
|     return m_line_boxes.last(); |     return m_line_boxes.last(); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -29,6 +29,8 @@ | ||||||
| #include <LibHTML/Layout/LayoutBox.h> | #include <LibHTML/Layout/LayoutBox.h> | ||||||
| #include <LibHTML/Layout/LineBox.h> | #include <LibHTML/Layout/LineBox.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class Element; | class Element; | ||||||
| 
 | 
 | ||||||
| class LayoutBlock : public LayoutBox { | class LayoutBlock : public LayoutBox { | ||||||
|  | @ -103,3 +105,5 @@ inline bool is<LayoutBlock>(const LayoutNode& node) | ||||||
| { | { | ||||||
|     return node.is_block(); |     return node.is_block(); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -34,6 +34,8 @@ | ||||||
| //#define DRAW_BOXES_AROUND_LAYOUT_NODES
 | //#define DRAW_BOXES_AROUND_LAYOUT_NODES
 | ||||||
| //#define DRAW_BOXES_AROUND_HOVERED_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) | 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); |     auto border_width = style().property(width_property_id); | ||||||
|  | @ -238,3 +240,5 @@ bool LayoutBox::is_body() const | ||||||
| { | { | ||||||
|     return node() && node() == document().body(); |     return node() && node() == document().body(); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -29,6 +29,8 @@ | ||||||
| #include <LibGfx/FloatRect.h> | #include <LibGfx/FloatRect.h> | ||||||
| #include <LibHTML/Layout/LayoutNode.h> | #include <LibHTML/Layout/LayoutNode.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class LayoutBox : public LayoutNodeWithStyleAndBoxModelMetrics { | class LayoutBox : public LayoutNodeWithStyleAndBoxModelMetrics { | ||||||
| public: | public: | ||||||
|     const Gfx::FloatRect& rect() const { return m_rect; } |     const Gfx::FloatRect& rect() const { return m_rect; } | ||||||
|  | @ -74,3 +76,5 @@ inline bool is<LayoutBox>(const LayoutNode& node) | ||||||
| { | { | ||||||
|     return node.is_box(); |     return node.is_box(); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -27,6 +27,8 @@ | ||||||
| #include <LibHTML/Layout/LayoutBlock.h> | #include <LibHTML/Layout/LayoutBlock.h> | ||||||
| #include <LibHTML/Layout/LayoutBreak.h> | #include <LibHTML/Layout/LayoutBreak.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| LayoutBreak::LayoutBreak(const HTMLBRElement& element) | LayoutBreak::LayoutBreak(const HTMLBRElement& element) | ||||||
|     : LayoutNodeWithStyleAndBoxModelMetrics(&element, StyleProperties::create()) |     : LayoutNodeWithStyleAndBoxModelMetrics(&element, StyleProperties::create()) | ||||||
| { | { | ||||||
|  | @ -41,3 +43,5 @@ void LayoutBreak::split_into_lines(LayoutBlock& block) | ||||||
| { | { | ||||||
|     block.add_line_box(); |     block.add_line_box(); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -29,6 +29,8 @@ | ||||||
| #include <LibHTML/DOM/HTMLBRElement.h> | #include <LibHTML/DOM/HTMLBRElement.h> | ||||||
| #include <LibHTML/Layout/LayoutNode.h> | #include <LibHTML/Layout/LayoutNode.h> | ||||||
| 
 | 
 | ||||||
|  | namespace Web { | ||||||
|  | 
 | ||||||
| class LayoutBreak final : public LayoutNodeWithStyleAndBoxModelMetrics { | class LayoutBreak final : public LayoutNodeWithStyleAndBoxModelMetrics { | ||||||
| public: | public: | ||||||
|     explicit LayoutBreak(const HTMLBRElement&); |     explicit LayoutBreak(const HTMLBRElement&); | ||||||
|  | @ -40,3 +42,5 @@ private: | ||||||
|     virtual const char* class_name() const override { return "LayoutBreak"; } |     virtual const char* class_name() const override { return "LayoutBreak"; } | ||||||
|     virtual void split_into_lines(LayoutBlock&) override; |     virtual void split_into_lines(LayoutBlock&) override; | ||||||
| }; | }; | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
Some files were not shown because too many files have changed in this diff Show more
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling