소스 검색

LibWeb: Rename Web::HtmlView => Web::PageView

This widget doesn't just view HTML, it views a web page. :^)
Andreas Kling 5 년 전
부모
커밋
42243d2e06

+ 1 - 1
Applications/Browser/BrowserConsoleClient.h

@@ -28,7 +28,7 @@
 #include <LibGUI/Widget.h>
 #include <LibJS/Console.h>
 #include <LibJS/Forward.h>
-#include <LibWeb/HtmlView.h>
+#include <LibWeb/PageView.h>
 
 namespace Browser {
 

+ 1 - 1
Applications/Browser/ConsoleWidget.cpp

@@ -56,7 +56,7 @@ ConsoleWidget::ConsoleWidget()
     html_element->append_child(body_element);
     m_output_container = body_element;
 
-    m_output_view = add<Web::HtmlView>();
+    m_output_view = add<Web::PageView>();
     m_output_view->set_document(base_document);
 
     m_input = add<GUI::TextBox>();

+ 2 - 2
Applications/Browser/ConsoleWidget.h

@@ -29,7 +29,7 @@
 #include "History.h"
 #include <LibGUI/Widget.h>
 #include <LibJS/Forward.h>
-#include <LibWeb/HtmlView.h>
+#include <LibWeb/PageView.h>
 
 namespace Browser {
 
@@ -47,7 +47,7 @@ private:
     ConsoleWidget();
 
     RefPtr<GUI::TextBox> m_input;
-    RefPtr<Web::HtmlView> m_output_view;
+    RefPtr<Web::PageView> m_output_view;
     RefPtr<Web::Element> m_output_container;
     WeakPtr<JS::Interpreter> m_interpreter;
     OwnPtr<BrowserConsoleClient> m_console_client;

+ 42 - 42
Applications/Browser/Tab.cpp

@@ -49,7 +49,7 @@
 #include <LibWeb/DOMTreeModel.h>
 #include <LibWeb/Dump.h>
 #include <LibWeb/Frame.h>
-#include <LibWeb/HtmlView.h>
+#include <LibWeb/PageView.h>
 #include <LibWeb/Layout/LayoutBlock.h>
 #include <LibWeb/Layout/LayoutDocument.h>
 #include <LibWeb/Layout/LayoutInline.h>
@@ -69,34 +69,34 @@ Tab::Tab()
 
     m_toolbar_container = widget.add<GUI::ToolBarContainer>();
     auto& toolbar = m_toolbar_container->add<GUI::ToolBar>();
-    m_html_widget = widget.add<Web::HtmlView>();
+    m_page_view = widget.add<Web::PageView>();
 
-    m_html_widget->set_use_new_parser(g_use_new_html_parser);
+    m_page_view->set_use_new_parser(g_use_new_html_parser);
 
     m_go_back_action = GUI::CommonActions::make_go_back_action([this](auto&) {
         m_history.go_back();
         update_actions();
         TemporaryChange<bool> change(m_should_push_loads_to_history, false);
-        m_html_widget->load(m_history.current());
+        m_page_view->load(m_history.current());
     }, this);
 
     m_go_forward_action = GUI::CommonActions::make_go_forward_action([this](auto&) {
         m_history.go_forward();
         update_actions();
         TemporaryChange<bool> change(m_should_push_loads_to_history, false);
-        m_html_widget->load(m_history.current());
+        m_page_view->load(m_history.current());
     }, this);
 
     toolbar.add_action(*m_go_back_action);
     toolbar.add_action(*m_go_forward_action);
 
     toolbar.add_action(GUI::CommonActions::make_go_home_action([this](auto&) {
-        m_html_widget->load(g_home_url);
+        m_page_view->load(g_home_url);
     }, this));
 
     m_reload_action = GUI::CommonActions::make_reload_action([this](auto&) {
         TemporaryChange<bool> change(m_should_push_loads_to_history, false);
-        m_html_widget->reload();
+        m_page_view->reload();
     }, this);
 
     toolbar.add_action(*m_reload_action);
@@ -114,8 +114,8 @@ Tab::Tab()
             location = builder.build();
         }
 
-        m_html_widget->load(location);
-        m_html_widget->set_focus(true);
+        m_page_view->load(location);
+        m_page_view->set_focus(true);
     };
 
     m_location_box->add_custom_context_menu_action(GUI::Action::create("Paste & Go", [this](auto&) {
@@ -130,7 +130,7 @@ Tab::Tab()
     m_bookmark_button->set_preferred_size(22, 22);
 
     m_bookmark_button->on_click = [this](auto) {
-        auto url = m_html_widget->main_frame().document()->url().to_string();
+        auto url = m_page_view->main_frame().document()->url().to_string();
         if (BookmarksBarWidget::the().contains_bookmark(url)) {
             BookmarksBarWidget::the().remove_bookmark(url);
         } else {
@@ -139,7 +139,7 @@ Tab::Tab()
         update_bookmark_button(url);
     };
 
-    m_html_widget->on_load_start = [this](auto& url) {
+    m_page_view->on_load_start = [this](auto& url) {
         m_location_box->set_text(url.to_string());
         if (m_should_push_loads_to_history)
             m_history.push(url);
@@ -147,36 +147,36 @@ Tab::Tab()
         update_bookmark_button(url.to_string());
     };
 
-    m_html_widget->on_link_click = [this](auto& href, auto& target, unsigned modifiers) {
+    m_page_view->on_link_click = [this](auto& href, auto& target, unsigned modifiers) {
         if (target == "_blank" || modifiers == Mod_Ctrl) {
-            auto url = m_html_widget->document()->complete_url(href);
+            auto url = m_page_view->document()->complete_url(href);
             on_tab_open_request(url);
         } else {
             if (href.starts_with("#")) {
                 auto anchor = href.substring_view(1, href.length() - 1);
-                m_html_widget->scroll_to_anchor(anchor);
+                m_page_view->scroll_to_anchor(anchor);
             } else {
-                auto url = m_html_widget->document()->complete_url(href);
-                m_html_widget->load(url);
+                auto url = m_page_view->document()->complete_url(href);
+                m_page_view->load(url);
             }
         }
     };
 
     m_link_context_menu = GUI::Menu::construct();
     m_link_context_menu->add_action(GUI::Action::create("Open", [this](auto&) {
-        m_html_widget->on_link_click(m_link_context_menu_href, "", 0);
+        m_page_view->on_link_click(m_link_context_menu_href, "", 0);
     }));
     m_link_context_menu->add_action(GUI::Action::create("Open in new tab", [this](auto&) {
-        m_html_widget->on_link_click(m_link_context_menu_href, "_blank", 0);
+        m_page_view->on_link_click(m_link_context_menu_href, "_blank", 0);
     }));
     m_link_context_menu->add_action(GUI::Action::create("Copy link", [this](auto&) {
-        GUI::Clipboard::the().set_data(m_html_widget->document()->complete_url(m_link_context_menu_href).to_string());
+        GUI::Clipboard::the().set_data(m_page_view->document()->complete_url(m_link_context_menu_href).to_string());
     }));
     m_link_context_menu->add_separator();
     m_link_context_menu->add_action(GUI::Action::create("Download", [this](auto&) {
         auto window = GUI::Window::construct();
         window->set_rect(300, 300, 300, 150);
-        auto url = m_html_widget->document()->complete_url(m_link_context_menu_href);
+        auto url = m_page_view->document()->complete_url(m_link_context_menu_href);
         window->set_title(String::format("0%% of %s", url.basename().characters()));
         window->set_resizable(false);
         window->set_main_widget<DownloadWidget>(url);
@@ -184,18 +184,18 @@ Tab::Tab()
         (void)window.leak_ref();
     }));
 
-    m_html_widget->on_link_context_menu_request = [this](auto& href, auto& screen_position) {
+    m_page_view->on_link_context_menu_request = [this](auto& href, auto& screen_position) {
         m_link_context_menu_href = href;
         m_link_context_menu->popup(screen_position);
     };
 
-    m_html_widget->on_link_middle_click = [this](auto& href) {
-        m_html_widget->on_link_click(href, "_blank", 0);
+    m_page_view->on_link_middle_click = [this](auto& href) {
+        m_page_view->on_link_click(href, "_blank", 0);
     };
 
-    m_html_widget->on_title_change = [this](auto& title) {
+    m_page_view->on_title_change = [this](auto& title) {
         if (title.is_null()) {
-            m_title = m_html_widget->main_frame().document()->url().to_string();
+            m_title = m_page_view->main_frame().document()->url().to_string();
         } else {
             m_title = title;
         }
@@ -203,13 +203,13 @@ Tab::Tab()
             on_title_change(m_title);
     };
 
-    m_html_widget->on_favicon_change = [this](auto& icon) {
+    m_page_view->on_favicon_change = [this](auto& icon) {
         m_icon = icon;
         if (on_favicon_change)
             on_favicon_change(icon);
     };
 
-    m_html_widget->on_set_document = [this](auto* document) {
+    m_page_view->on_set_document = [this](auto* document) {
         if (document && m_console_window) {
             auto* console_widget = static_cast<ConsoleWidget*>(m_console_window->main_widget());
             console_widget->set_interpreter(document->interpreter().make_weak_ptr());
@@ -225,12 +225,12 @@ Tab::Tab()
 
     m_statusbar = widget.add<GUI::StatusBar>();
 
-    m_html_widget->on_link_hover = [this](auto& href) {
+    m_page_view->on_link_hover = [this](auto& href) {
         m_statusbar->set_text(href);
     };
 
-    m_html_widget->on_url_drop = [this](auto& url) {
-        m_html_widget->load(url);
+    m_page_view->on_url_drop = [this](auto& url) {
+        m_page_view->load(url);
     };
 
     m_menubar = GUI::MenuBar::construct();
@@ -265,9 +265,9 @@ Tab::Tab()
     auto& inspect_menu = m_menubar->add_menu("Inspect");
     inspect_menu.add_action(GUI::Action::create(
         "View source", { Mod_Ctrl, Key_U }, [this](auto&) {
-            ASSERT(m_html_widget->document());
-            auto url = m_html_widget->document()->url().to_string();
-            auto source = m_html_widget->document()->source();
+            ASSERT(m_page_view->document());
+            auto url = m_page_view->document()->url().to_string();
+            auto source = m_page_view->document()->source();
             auto window = GUI::Window::construct();
             auto& editor = window->set_main_widget<GUI::TextEditor>();
             editor.set_text(source);
@@ -288,7 +288,7 @@ Tab::Tab()
                 m_dom_inspector_window->set_main_widget<InspectorWidget>();
             }
             auto* inspector_widget = static_cast<InspectorWidget*>(m_dom_inspector_window->main_widget());
-            inspector_widget->set_document(m_html_widget->document());
+            inspector_widget->set_document(m_page_view->document());
             m_dom_inspector_window->show();
             m_dom_inspector_window->move_to_front();
         },
@@ -303,7 +303,7 @@ Tab::Tab()
                 m_console_window->set_main_widget<ConsoleWidget>();
             }
             auto* console_widget = static_cast<ConsoleWidget*>(m_console_window->main_widget());
-            console_widget->set_interpreter(m_html_widget->document()->interpreter().make_weak_ptr());
+            console_widget->set_interpreter(m_page_view->document()->interpreter().make_weak_ptr());
             m_console_window->show();
             m_console_window->move_to_front();
         },
@@ -312,17 +312,17 @@ Tab::Tab()
     auto& debug_menu = m_menubar->add_menu("Debug");
     debug_menu.add_action(GUI::Action::create(
         "Dump DOM tree", [this](auto&) {
-            Web::dump_tree(*m_html_widget->document());
+            Web::dump_tree(*m_page_view->document());
         },
         this));
     debug_menu.add_action(GUI::Action::create(
         "Dump Layout tree", [this](auto&) {
-            Web::dump_tree(*m_html_widget->document()->layout_node());
+            Web::dump_tree(*m_page_view->document()->layout_node());
         },
         this));
     debug_menu.add_action(GUI::Action::create(
         "Dump Style sheets", [this](auto&) {
-            for (auto& sheet : m_html_widget->document()->stylesheets()) {
+            for (auto& sheet : m_page_view->document()->stylesheets()) {
                 dump_sheet(sheet);
             }
         },
@@ -330,8 +330,8 @@ Tab::Tab()
     debug_menu.add_separator();
     auto line_box_borders_action = GUI::Action::create_checkable(
         "Line box borders", [this](auto& action) {
-            m_html_widget->set_should_show_line_box_borders(action.is_checked());
-            m_html_widget->update();
+            m_page_view->set_should_show_line_box_borders(action.is_checked());
+            m_page_view->update();
         },
         this);
     line_box_borders_action->set_checked(false);
@@ -358,7 +358,7 @@ Tab::~Tab()
 
 void Tab::load(const URL& url)
 {
-    m_html_widget->load(url);
+    m_page_view->load(url);
 }
 
 void Tab::update_actions()
@@ -392,7 +392,7 @@ void Tab::did_become_active()
         if (modifiers & Mod_Ctrl)
             on_tab_open_request(url);
         else
-            m_html_widget->load(url);
+            m_page_view->load(url);
     };
 
     BookmarksBarWidget::the().on_bookmark_hover = [this](auto&, auto& url) {

+ 1 - 1
Applications/Browser/Tab.h

@@ -60,7 +60,7 @@ private:
     void update_bookmark_button(const String& url);
 
     History<URL> m_history;
-    RefPtr<Web::HtmlView> m_html_widget;
+    RefPtr<Web::PageView> m_page_view;
     RefPtr<GUI::Action> m_go_back_action;
     RefPtr<GUI::Action> m_go_forward_action;
     RefPtr<GUI::Action> m_reload_action;

+ 6 - 6
Applications/Help/main.cpp

@@ -42,7 +42,7 @@
 #include <LibGUI/TreeView.h>
 #include <LibGUI/Window.h>
 #include <LibMarkdown/Document.h>
-#include <LibWeb/HtmlView.h>
+#include <LibWeb/PageView.h>
 #include <LibWeb/Layout/LayoutNode.h>
 #include <LibWeb/Parser/CSSParser.h>
 #include <LibWeb/Parser/HTMLParser.h>
@@ -97,7 +97,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<Web::HtmlView>();
+    auto& page_view = splitter.add<Web::PageView>();
 
     History history;
 
@@ -111,7 +111,7 @@ int main(int argc, char* argv[])
 
     auto open_page = [&](const String& path) {
         if (path.is_null()) {
-            html_view.set_document(nullptr);
+            page_view.set_document(nullptr);
             return;
         }
 
@@ -134,7 +134,7 @@ int main(int argc, char* argv[])
 
         String html = md_document.render_to_html();
         auto html_document = Web::parse_html_document(html);
-        html_view.set_document(html_document);
+        page_view.set_document(html_document);
 
         String page_and_section = model->page_and_section(tree_view.selection().first());
         window->set_title(String::format("%s - Help", page_and_section.characters()));
@@ -143,7 +143,7 @@ int main(int argc, char* argv[])
     tree_view.on_selection_change = [&] {
         String path = model->page_path(tree_view.selection().first());
         if (path.is_null()) {
-            html_view.set_document(nullptr);
+            page_view.set_document(nullptr);
             return;
         }
         history.push(path);
@@ -151,7 +151,7 @@ int main(int argc, char* argv[])
         open_page(path);
     };
 
-    html_view.on_link_click = [&](const String& href, auto&, unsigned) {
+    page_view.on_link_click = [&](const String& href, auto&, unsigned) {
         char* current_path = strdup(history.current().characters());
         char* dir_path = dirname(current_path);
         char* path = realpath(String::format("%s/%s", dir_path, href.characters()).characters(), nullptr);

+ 4 - 4
Applications/IRCClient/IRCWindow.cpp

@@ -39,7 +39,7 @@
 #include <LibGUI/TextBox.h>
 #include <LibGUI/TextEditor.h>
 #include <LibGUI/Window.h>
-#include <LibWeb/HtmlView.h>
+#include <LibWeb/PageView.h>
 
 IRCWindow::IRCWindow(IRCClient& client, void* owner, Type type, const String& name)
     : m_client(client)
@@ -52,7 +52,7 @@ IRCWindow::IRCWindow(IRCClient& client, void* owner, Type type, const String& na
     // Make a container for the log buffer view + (optional) member list.
     auto& container = add<GUI::HorizontalSplitter>();
 
-    m_html_view = container.add<Web::HtmlView>();
+    m_page_view = container.add<Web::PageView>();
 
     if (m_type == Channel) {
         auto& member_view = container.add<GUI::TableView>();
@@ -215,7 +215,7 @@ IRCWindow::~IRCWindow()
 void IRCWindow::set_log_buffer(const IRCLogBuffer& log_buffer)
 {
     m_log_buffer = &log_buffer;
-    m_html_view->set_document(const_cast<Web::Document*>(&log_buffer.document()));
+    m_page_view->set_document(const_cast<Web::Document*>(&log_buffer.document()));
 }
 
 bool IRCWindow::is_active() const
@@ -263,7 +263,7 @@ void IRCWindow::did_add_message(const String& name, const String& message)
         m_client.aid_update_window_list();
         return;
     }
-    m_html_view->scroll_to_bottom();
+    m_page_view->scroll_to_bottom();
 }
 
 void IRCWindow::clear_unread_count()

+ 1 - 1
Applications/IRCClient/IRCWindow.h

@@ -74,7 +74,7 @@ private:
     void* m_owner { nullptr };
     Type m_type;
     String m_name;
-    RefPtr<Web::HtmlView> m_html_view;
+    RefPtr<Web::PageView> m_page_view;
     RefPtr<GUI::TextBox> m_text_box;
     RefPtr<IRCLogBuffer> m_log_buffer;
     RefPtr<GUI::Menu> m_context_menu;

+ 5 - 5
Applications/TextEditor/TextEditorWidget.cpp

@@ -51,7 +51,7 @@
 #include <LibGUI/ToolBarContainer.h>
 #include <LibGfx/Font.h>
 #include <LibMarkdown/Document.h>
-#include <LibWeb/HtmlView.h>
+#include <LibWeb/PageView.h>
 #include <LibWeb/Parser/HTMLParser.h>
 #include <string.h>
 
@@ -87,8 +87,8 @@ TextEditorWidget::TextEditorWidget()
             update_title();
     };
 
-    m_html_view = splitter.add<Web::HtmlView>();
-    m_html_view->set_visible(false);
+    m_page_view = splitter.add<Web::PageView>();
+    m_page_view->set_visible(false);
 
     m_find_replace_widget = add<GUI::Widget>();
     m_find_replace_widget->set_fill_with_background_color(true);
@@ -553,7 +553,7 @@ void TextEditorWidget::set_markdown_preview_enabled(bool enabled)
         return;
     m_markdown_preview_enabled = enabled;
     m_markdown_preview_action->set_checked(enabled);
-    m_html_view->set_visible(enabled);
+    m_page_view->set_visible(enabled);
     if (enabled)
         update_markdown_preview();
 }
@@ -564,6 +564,6 @@ void TextEditorWidget::update_markdown_preview()
     if (document.parse(m_editor->text())) {
         auto html = document.render_to_html();
         auto html_document = Web::parse_html_document(html, URL::create_with_file_protocol(m_path));
-        m_html_view->set_document(html_document);
+        m_page_view->set_document(html_document);
     }
 }

+ 1 - 1
Applications/TextEditor/TextEditorWidget.h

@@ -90,7 +90,7 @@ private:
     RefPtr<GUI::Action> m_js_highlight;
     RefPtr<GUI::Action> m_ini_highlight;
 
-    RefPtr<Web::HtmlView> m_html_view;
+    RefPtr<Web::PageView> m_page_view;
 
     bool m_document_dirty { false };
     bool m_document_opening { false };

+ 3 - 3
DevTools/HackStudio/Editor.cpp

@@ -40,7 +40,7 @@
 #include <LibWeb/DOM/ElementFactory.h>
 #include <LibWeb/DOM/HTMLHeadElement.h>
 #include <LibWeb/DOM/Text.h>
-#include <LibWeb/HtmlView.h>
+#include <LibWeb/PageView.h>
 #include <LibWeb/Parser/HTMLParser.h>
 
 // #define EDITOR_DEBUG
@@ -50,7 +50,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<Web::HtmlView>();
+    m_documentation_page_view = m_documentation_tooltip_window->set_main_widget<Web::PageView>();
 }
 
 Editor::~Editor()
@@ -194,7 +194,7 @@ void Editor::show_documentation_tooltip_if_available(const String& hovered_token
     ASSERT(head_element);
     head_element->append_child(style_element);
 
-    m_documentation_html_view->set_document(html_document);
+    m_documentation_page_view->set_document(html_document);
     m_documentation_tooltip_window->move_to(screen_location.translated(4, 4));
     m_documentation_tooltip_window->show();
 

+ 1 - 1
DevTools/HackStudio/Editor.h

@@ -71,7 +71,7 @@ private:
     explicit Editor();
 
     RefPtr<GUI::Window> m_documentation_tooltip_window;
-    RefPtr<Web::HtmlView> m_documentation_html_view;
+    RefPtr<Web::PageView> m_documentation_page_view;
     String m_last_parsed_token;
     GUI::TextPosition m_previous_text_position { 0, 0 };
     bool m_hovering_editor { false };

+ 3 - 3
Libraries/LibWeb/CMakeLists.txt

@@ -57,13 +57,12 @@ set(SOURCES
     DOM/Node.cpp
     DOM/ParentNode.cpp
     DOM/Text.cpp
-    DOMTreeModel.cpp
     DOM/Window.cpp
     DOM/XMLHttpRequest.cpp
+    DOMTreeModel.cpp
     Dump.cpp
     FontCache.cpp
     Frame.cpp
-    HtmlView.cpp
     Layout/BoxModelMetrics.cpp
     Layout/LayoutBlock.cpp
     Layout/LayoutBox.cpp
@@ -76,14 +75,15 @@ set(SOURCES
     Layout/LayoutListItemMarker.cpp
     Layout/LayoutNode.cpp
     Layout/LayoutReplaced.cpp
-    Layout/LayoutTableCell.cpp
     Layout/LayoutTable.cpp
+    Layout/LayoutTableCell.cpp
     Layout/LayoutTableRow.cpp
     Layout/LayoutText.cpp
     Layout/LayoutTreeBuilder.cpp
     Layout/LayoutWidget.cpp
     Layout/LineBox.cpp
     Layout/LineBoxFragment.cpp
+    PageView.cpp
     Parser/CSSParser.cpp
     Parser/Entities.cpp
     Parser/HTMLDocumentParser.cpp

+ 2 - 2
Libraries/LibWeb/CSS/StyleValue.cpp

@@ -31,7 +31,7 @@
 #include <LibWeb/CSS/StyleValue.h>
 #include <LibWeb/DOM/Document.h>
 #include <LibWeb/Frame.h>
-#include <LibWeb/HtmlView.h>
+#include <LibWeb/PageView.h>
 #include <LibWeb/ResourceLoader.h>
 
 namespace Web {
@@ -170,7 +170,7 @@ Color IdentifierStyleValue::to_color(const Document& document) const
     if (id() == CSS::ValueID::VendorSpecificLink)
         return document.link_color();
 
-    auto palette = document.frame()->html_view()->palette();
+    auto palette = document.frame()->page_view()->palette();
     switch (id()) {
     case CSS::ValueID::VendorSpecificPaletteDesktopBackground:
         return palette.color(ColorRole::DesktopBackground);

+ 4 - 4
Libraries/LibWeb/DOM/Document.cpp

@@ -51,7 +51,7 @@
 #include <LibWeb/DOM/Window.h>
 #include <LibWeb/Dump.h>
 #include <LibWeb/Frame.h>
-#include <LibWeb/HtmlView.h>
+#include <LibWeb/PageView.h>
 #include <LibWeb/Layout/LayoutDocument.h>
 #include <LibWeb/Layout/LayoutTreeBuilder.h>
 #include <LibWeb/Origin.h>
@@ -368,7 +368,7 @@ Color Document::link_color() const
         return m_link_color.value();
     if (!frame())
         return Color::Blue;
-    return frame()->html_view()->palette().link();
+    return frame()->page_view()->palette().link();
 }
 
 Color Document::active_link_color() const
@@ -377,7 +377,7 @@ Color Document::active_link_color() const
         return m_active_link_color.value();
     if (!frame())
         return Color::Red;
-    return frame()->html_view()->palette().active_link();
+    return frame()->page_view()->palette().active_link();
 }
 
 Color Document::visited_link_color() const
@@ -386,7 +386,7 @@ Color Document::visited_link_color() const
         return m_visited_link_color.value();
     if (!frame())
         return Color::Magenta;
-    return frame()->html_view()->palette().visited_link();
+    return frame()->page_view()->palette().visited_link();
 }
 
 JS::Interpreter& Document::interpreter()

+ 2 - 2
Libraries/LibWeb/DOM/HTMLFormElement.cpp

@@ -28,7 +28,7 @@
 #include <LibWeb/DOM/HTMLFormElement.h>
 #include <LibWeb/DOM/HTMLInputElement.h>
 #include <LibWeb/Frame.h>
-#include <LibWeb/HtmlView.h>
+#include <LibWeb/PageView.h>
 #include <LibWeb/URLEncoder.h>
 
 namespace Web {
@@ -72,7 +72,7 @@ void HTMLFormElement::submit(RefPtr<HTMLInputElement> submitter)
     url.set_query(url_encode(parameters));
 
     // FIXME: We shouldn't let the form just do this willy-nilly.
-    document().frame()->html_view()->load(url);
+    document().frame()->page_view()->load(url);
 }
 
 }

+ 5 - 5
Libraries/LibWeb/DOM/HTMLInputElement.cpp

@@ -31,7 +31,7 @@
 #include <LibWeb/DOM/HTMLFormElement.h>
 #include <LibWeb/DOM/HTMLInputElement.h>
 #include <LibWeb/Frame.h>
-#include <LibWeb/HtmlView.h>
+#include <LibWeb/PageView.h>
 #include <LibWeb/Layout/LayoutWidget.h>
 
 namespace Web {
@@ -49,15 +49,15 @@ RefPtr<LayoutNode> HTMLInputElement::create_layout_node(const StyleProperties*)
 {
     ASSERT(document().frame());
     auto& frame = *document().frame();
-    ASSERT(frame.html_view());
-    auto& html_view = const_cast<HtmlView&>(*frame.html_view());
+    ASSERT(frame.page_view());
+    auto& page_view = const_cast<PageView&>(*frame.page_view());
 
     if (type() == "hidden")
         return nullptr;
 
     RefPtr<GUI::Widget> widget;
     if (type() == "submit") {
-        auto& button = html_view.add<GUI::Button>(value());
+        auto& button = page_view.add<GUI::Button>(value());
         int text_width = Gfx::Font::default_font().width(value());
         button.set_relative_rect(0, 0, text_width + 20, 20);
         button.on_click = [this](auto) {
@@ -68,7 +68,7 @@ RefPtr<LayoutNode> HTMLInputElement::create_layout_node(const StyleProperties*)
         };
         widget = button;
     } else {
-        auto& text_box = html_view.add<GUI::TextBox>();
+        auto& text_box = page_view.add<GUI::TextBox>();
         text_box.set_text(value());
         text_box.on_change = [this] {
             auto& widget = to<LayoutWidget>(layout_node())->widget();

+ 3 - 3
Libraries/LibWeb/DOM/Window.cpp

@@ -33,7 +33,7 @@
 #include <LibWeb/DOM/Document.h>
 #include <LibWeb/DOM/Window.h>
 #include <LibWeb/Frame.h>
-#include <LibWeb/HtmlView.h>
+#include <LibWeb/PageView.h>
 
 namespace Web {
 
@@ -115,7 +115,7 @@ void Window::did_set_location_href(Badge<Bindings::LocationObject>, const String
     auto* frame = document().frame();
     if (!frame)
         return;
-    auto* view = frame->html_view();
+    auto* view = frame->page_view();
     if (!view)
         return;
     view->load(new_href);
@@ -126,7 +126,7 @@ void Window::did_call_location_reload(Badge<Bindings::LocationObject>)
     auto* frame = document().frame();
     if (!frame)
         return;
-    auto* view = frame->html_view();
+    auto* view = frame->page_view();
     if (!view)
         return;
     view->reload();

+ 1 - 1
Libraries/LibWeb/Forward.h

@@ -44,7 +44,7 @@ class HTMLHeadElement;
 class HTMLHtmlElement;
 class HTMLImageElement;
 class HTMLScriptElement;
-class HtmlView;
+class PageView;
 class ImageData;
 class LayoutDocument;
 class LayoutNode;

+ 3 - 3
Libraries/LibWeb/Frame.cpp

@@ -26,13 +26,13 @@
 
 #include <LibWeb/DOM/Document.h>
 #include <LibWeb/Frame.h>
-#include <LibWeb/HtmlView.h>
+#include <LibWeb/PageView.h>
 #include <LibWeb/Layout/LayoutDocument.h>
 
 namespace Web {
 
-Frame::Frame(HtmlView& html_view)
-    : m_html_view(html_view.make_weak_ptr())
+Frame::Frame(PageView& page_view)
+    : m_page_view(page_view.make_weak_ptr())
 {
 }
 

+ 6 - 6
Libraries/LibWeb/Frame.h

@@ -37,11 +37,11 @@
 namespace Web {
 
 class Document;
-class HtmlView;
+class PageView;
 
 class Frame : public TreeNode<Frame> {
 public:
-    static NonnullRefPtr<Frame> create(HtmlView& html_view) { return adopt(*new Frame(html_view)); }
+    static NonnullRefPtr<Frame> create(PageView& page_view) { return adopt(*new Frame(page_view)); }
     ~Frame();
 
     const Document* document() const { return m_document; }
@@ -49,8 +49,8 @@ public:
 
     void set_document(Document*);
 
-    HtmlView* html_view() { return m_html_view; }
-    const HtmlView* html_view() const { return m_html_view; }
+    PageView* page_view() { return m_page_view; }
+    const PageView* page_view() const { return m_page_view; }
 
     const Gfx::Size& size() const { return m_size; }
     void set_size(const Gfx::Size&);
@@ -62,9 +62,9 @@ public:
     Gfx::Rect viewport_rect() const { return m_viewport_rect; }
 
 private:
-    explicit Frame(HtmlView&);
+    explicit Frame(PageView&);
 
-    WeakPtr<HtmlView> m_html_view;
+    WeakPtr<PageView> m_page_view;
     RefPtr<Document> m_document;
     Gfx::Size m_size;
     Gfx::Rect m_viewport_rect;

+ 30 - 30
Libraries/LibWeb/HtmlView.cpp → Libraries/LibWeb/PageView.cpp

@@ -44,7 +44,7 @@
 #include <LibWeb/DOM/Text.h>
 #include <LibWeb/Dump.h>
 #include <LibWeb/Frame.h>
-#include <LibWeb/HtmlView.h>
+#include <LibWeb/PageView.h>
 #include <LibWeb/Layout/LayoutDocument.h>
 #include <LibWeb/Layout/LayoutNode.h>
 #include <LibWeb/Parser/HTMLDocumentParser.h>
@@ -57,7 +57,7 @@
 
 namespace Web {
 
-HtmlView::HtmlView()
+PageView::PageView()
     : m_main_frame(Web::Frame::create(*this))
 {
     main_frame().on_set_needs_display = [this](auto& content_rect) {
@@ -74,11 +74,11 @@ HtmlView::HtmlView()
     set_background_role(ColorRole::Base);
 }
 
-HtmlView::~HtmlView()
+PageView::~PageView()
 {
 }
 
-void HtmlView::set_document(Document* new_document)
+void PageView::set_document(Document* new_document)
 {
     RefPtr<Document> old_document = document();
 
@@ -111,7 +111,7 @@ void HtmlView::set_document(Document* new_document)
     update();
 }
 
-void HtmlView::layout_and_sync_size()
+void PageView::layout_and_sync_size()
 {
     if (!document())
         return;
@@ -139,13 +139,13 @@ void HtmlView::layout_and_sync_size()
 #endif
 }
 
-void HtmlView::resize_event(GUI::ResizeEvent& event)
+void PageView::resize_event(GUI::ResizeEvent& event)
 {
     GUI::ScrollableWidget::resize_event(event);
     layout_and_sync_size();
 }
 
-void HtmlView::paint_event(GUI::PaintEvent& event)
+void PageView::paint_event(GUI::PaintEvent& event)
 {
     GUI::Frame::paint_event(event);
 
@@ -173,7 +173,7 @@ void HtmlView::paint_event(GUI::PaintEvent& event)
     layout_root()->render(context);
 }
 
-void HtmlView::mousemove_event(GUI::MouseEvent& event)
+void PageView::mousemove_event(GUI::MouseEvent& event)
 {
     if (!layout_root())
         return GUI::ScrollableWidget::mousemove_event(event);
@@ -191,7 +191,7 @@ void HtmlView::mousemove_event(GUI::MouseEvent& event)
             hovered_link_element = node->enclosing_link_element();
             if (hovered_link_element) {
 #ifdef HTML_DEBUG
-                dbg() << "HtmlView: hovering over a link to " << hovered_link_element->href();
+                dbg() << "PageView: hovering over a link to " << hovered_link_element->href();
 #endif
                 is_hovering_link = true;
             }
@@ -224,7 +224,7 @@ void HtmlView::mousemove_event(GUI::MouseEvent& event)
     event.accept();
 }
 
-void HtmlView::mousedown_event(GUI::MouseEvent& event)
+void PageView::mousedown_event(GUI::MouseEvent& event)
 {
     if (!layout_root())
         return GUI::ScrollableWidget::mousemove_event(event);
@@ -239,7 +239,7 @@ void HtmlView::mousedown_event(GUI::MouseEvent& event)
             auto offset = compute_mouse_event_offset(event.position(), *result.layout_node);
             node->dispatch_event(MouseEvent::create("mousedown", offset.x(), offset.y()));
             if (RefPtr<HTMLAnchorElement> link = node->enclosing_link_element()) {
-                dbg() << "HtmlView: clicking on a link to " << link->href();
+                dbg() << "PageView: clicking on a link to " << link->href();
 
                 if (event.button() == GUI::MouseButton::Left) {
                     if (link->href().starts_with("javascript:")) {
@@ -270,7 +270,7 @@ void HtmlView::mousedown_event(GUI::MouseEvent& event)
     event.accept();
 }
 
-void HtmlView::mouseup_event(GUI::MouseEvent& event)
+void PageView::mouseup_event(GUI::MouseEvent& event)
 {
     if (!layout_root())
         return GUI::ScrollableWidget::mouseup_event(event);
@@ -289,7 +289,7 @@ void HtmlView::mouseup_event(GUI::MouseEvent& event)
     }
 }
 
-void HtmlView::keydown_event(GUI::KeyEvent& event)
+void PageView::keydown_event(GUI::KeyEvent& event)
 {
     if (event.modifiers() == 0) {
         switch (event.key()) {
@@ -325,7 +325,7 @@ void HtmlView::keydown_event(GUI::KeyEvent& event)
     event.accept();
 }
 
-void HtmlView::reload()
+void PageView::reload()
 {
     load(main_frame().document()->url());
 }
@@ -432,7 +432,7 @@ static String guess_mime_type_based_on_filename(const URL& url)
     return "text/plain";
 }
 
-RefPtr<Document> HtmlView::create_document_from_mime_type(const ByteBuffer& data, const URL& url, const String& mime_type, const String& encoding)
+RefPtr<Document> PageView::create_document_from_mime_type(const ByteBuffer& data, const URL& url, const String& mime_type, const String& encoding)
 {
     if (mime_type.starts_with("image/"))
         return create_image_document(data, url);
@@ -453,9 +453,9 @@ RefPtr<Document> HtmlView::create_document_from_mime_type(const ByteBuffer& data
     return nullptr;
 }
 
-void HtmlView::load(const URL& url)
+void PageView::load(const URL& url)
 {
-    dbg() << "HtmlView::load: " << url;
+    dbg() << "PageView::load: " << url;
 
     if (!url.is_valid()) {
         load_error_page(url, "Invalid URL");
@@ -537,7 +537,7 @@ void HtmlView::load(const URL& url)
     this->scroll_to_top();
 }
 
-void HtmlView::load_error_page(const URL& failed_url, const String& error)
+void PageView::load_error_page(const URL& failed_url, const String& error)
 {
     auto error_page_url = "file:///res/html/error.html";
     ResourceLoader::the().load(
@@ -560,19 +560,19 @@ void HtmlView::load_error_page(const URL& failed_url, const String& error)
         });
 }
 
-const LayoutDocument* HtmlView::layout_root() const
+const LayoutDocument* PageView::layout_root() const
 {
     return document() ? document()->layout_node() : nullptr;
 }
 
-LayoutDocument* HtmlView::layout_root()
+LayoutDocument* PageView::layout_root()
 {
     if (!document())
         return nullptr;
     return const_cast<LayoutDocument*>(document()->layout_node());
 }
 
-void HtmlView::scroll_to_anchor(const StringView& name)
+void PageView::scroll_to_anchor(const StringView& name)
 {
     if (!document())
         return;
@@ -589,11 +589,11 @@ void HtmlView::scroll_to_anchor(const StringView& name)
     }
 
     if (!element) {
-        dbg() << "HtmlView::scroll_to_anchor(): Anchor not found: '" << name << "'";
+        dbg() << "PageView::scroll_to_anchor(): Anchor not found: '" << name << "'";
         return;
     }
     if (!element->layout_node()) {
-        dbg() << "HtmlView::scroll_to_anchor(): Anchor found but without layout node: '" << name << "'";
+        dbg() << "PageView::scroll_to_anchor(): Anchor found but without layout node: '" << name << "'";
         return;
     }
     auto& layout_node = *element->layout_node();
@@ -602,17 +602,17 @@ void HtmlView::scroll_to_anchor(const StringView& name)
     window()->set_override_cursor(GUI::StandardCursor::None);
 }
 
-Document* HtmlView::document()
+Document* PageView::document()
 {
     return main_frame().document();
 }
 
-const Document* HtmlView::document() const
+const Document* PageView::document() const
 {
     return main_frame().document();
 }
 
-void HtmlView::dump_selection(const char* event_name)
+void PageView::dump_selection(const char* event_name)
 {
     UNUSED_PARAM(event_name);
 #ifdef SELECTION_DEBUG
@@ -622,12 +622,12 @@ void HtmlView::dump_selection(const char* event_name)
 #endif
 }
 
-void HtmlView::did_scroll()
+void PageView::did_scroll()
 {
     main_frame().set_viewport_rect(viewport_rect_in_content_coordinates());
 }
 
-Gfx::Point HtmlView::compute_mouse_event_offset(const Gfx::Point& event_position, const LayoutNode& layout_node) const
+Gfx::Point PageView::compute_mouse_event_offset(const Gfx::Point& event_position, const LayoutNode& layout_node) const
 {
     auto content_event_position = to_content_position(event_position);
     auto top_left_of_layout_node = layout_node.box_type_agnostic_position();
@@ -638,7 +638,7 @@ Gfx::Point HtmlView::compute_mouse_event_offset(const Gfx::Point& event_position
     };
 }
 
-void HtmlView::run_javascript_url(const String& url)
+void PageView::run_javascript_url(const String& url)
 {
     ASSERT(url.starts_with("javascript:"));
     if (!document())
@@ -649,7 +649,7 @@ void HtmlView::run_javascript_url(const String& url)
     document()->run_javascript(source);
 }
 
-void HtmlView::drop_event(GUI::DropEvent& event)
+void PageView::drop_event(GUI::DropEvent& event)
 {
     if (event.mime_data().has_urls()) {
         if (on_url_drop) {

+ 4 - 4
Libraries/LibWeb/HtmlView.h → Libraries/LibWeb/PageView.h

@@ -33,10 +33,10 @@ namespace Web {
 
 class Frame;
 
-class HtmlView : public GUI::ScrollableWidget {
-    C_OBJECT(HtmlView)
+class PageView : public GUI::ScrollableWidget {
+    C_OBJECT(PageView)
 public:
-    virtual ~HtmlView() override;
+    virtual ~PageView() override;
 
     // FIXME: Remove this once the new parser is ready.
     void set_use_new_parser(bool use_new_parser) { m_use_new_parser = use_new_parser; }
@@ -73,7 +73,7 @@ public:
     virtual bool accepts_focus() const override { return true; }
 
 protected:
-    HtmlView();
+    PageView();
 
     virtual void resize_event(GUI::ResizeEvent&) override;
     virtual void paint_event(GUI::PaintEvent&) override;

+ 2 - 2
Userland/html.cpp

@@ -35,7 +35,7 @@
 #include <LibWeb/CSS/StyleResolver.h>
 #include <LibWeb/DOM/Element.h>
 #include <LibWeb/Dump.h>
-#include <LibWeb/HtmlView.h>
+#include <LibWeb/PageView.h>
 #include <LibWeb/Layout/LayoutBlock.h>
 #include <LibWeb/Layout/LayoutInline.h>
 #include <LibWeb/Layout/LayoutNode.h>
@@ -64,7 +64,7 @@ int main(int argc, char** argv)
     auto document = Web::parse_html_document(html);
 
     auto window = GUI::Window::construct();
-    auto& widget = window->set_main_widget<Web::HtmlView>();
+    auto& widget = window->set_main_widget<Web::PageView>();
     widget.set_document(document);
     if (!widget.document()->title().is_null())
         window->set_title(String::format("%s - HTML", widget.document()->title().characters()));