diff options
author | Andreas Kling <kling@serenityos.org> | 2020-05-28 18:21:22 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-28 18:22:54 +0200 |
commit | 42243d2e06a28bd2da0420eea49d84cb31bb1a9a (patch) | |
tree | c577dfbbf3bf28d9269964747c069bb2921783ba /Libraries/LibWeb | |
parent | 5f8cbe6a1b2c434d7723b05148c299a9e3c01d2d (diff) | |
download | serenity-42243d2e06a28bd2da0420eea49d84cb31bb1a9a.zip |
LibWeb: Rename Web::HtmlView => Web::PageView
This widget doesn't just view HTML, it views a web page. :^)
Diffstat (limited to 'Libraries/LibWeb')
-rw-r--r-- | Libraries/LibWeb/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Libraries/LibWeb/CSS/StyleValue.cpp | 4 | ||||
-rw-r--r-- | Libraries/LibWeb/DOM/Document.cpp | 8 | ||||
-rw-r--r-- | Libraries/LibWeb/DOM/HTMLFormElement.cpp | 4 | ||||
-rw-r--r-- | Libraries/LibWeb/DOM/HTMLInputElement.cpp | 10 | ||||
-rw-r--r-- | Libraries/LibWeb/DOM/Window.cpp | 6 | ||||
-rw-r--r-- | Libraries/LibWeb/Forward.h | 2 | ||||
-rw-r--r-- | Libraries/LibWeb/Frame.cpp | 6 | ||||
-rw-r--r-- | Libraries/LibWeb/Frame.h | 12 | ||||
-rw-r--r-- | Libraries/LibWeb/PageView.cpp (renamed from Libraries/LibWeb/HtmlView.cpp) | 60 | ||||
-rw-r--r-- | Libraries/LibWeb/PageView.h (renamed from Libraries/LibWeb/HtmlView.h) | 8 |
11 files changed, 63 insertions, 63 deletions
diff --git a/Libraries/LibWeb/CMakeLists.txt b/Libraries/LibWeb/CMakeLists.txt index a8ff0b319d..4e976a2dad 100644 --- a/Libraries/LibWeb/CMakeLists.txt +++ b/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 diff --git a/Libraries/LibWeb/CSS/StyleValue.cpp b/Libraries/LibWeb/CSS/StyleValue.cpp index f58d6d19da..7d3fbff9fa 100644 --- a/Libraries/LibWeb/CSS/StyleValue.cpp +++ b/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); diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cpp index 2b2d242f13..51e68f80b9 100644 --- a/Libraries/LibWeb/DOM/Document.cpp +++ b/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() diff --git a/Libraries/LibWeb/DOM/HTMLFormElement.cpp b/Libraries/LibWeb/DOM/HTMLFormElement.cpp index cabb282d3e..e4eef82a58 100644 --- a/Libraries/LibWeb/DOM/HTMLFormElement.cpp +++ b/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); } } diff --git a/Libraries/LibWeb/DOM/HTMLInputElement.cpp b/Libraries/LibWeb/DOM/HTMLInputElement.cpp index df87b91ddc..a35c4ab7bf 100644 --- a/Libraries/LibWeb/DOM/HTMLInputElement.cpp +++ b/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(); diff --git a/Libraries/LibWeb/DOM/Window.cpp b/Libraries/LibWeb/DOM/Window.cpp index b1c9037229..55dce4c5e3 100644 --- a/Libraries/LibWeb/DOM/Window.cpp +++ b/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(); diff --git a/Libraries/LibWeb/Forward.h b/Libraries/LibWeb/Forward.h index 7b475d0fc7..00149973de 100644 --- a/Libraries/LibWeb/Forward.h +++ b/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; diff --git a/Libraries/LibWeb/Frame.cpp b/Libraries/LibWeb/Frame.cpp index ca1645d1de..94feac2e79 100644 --- a/Libraries/LibWeb/Frame.cpp +++ b/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()) { } diff --git a/Libraries/LibWeb/Frame.h b/Libraries/LibWeb/Frame.h index 9f91a928a1..97e2e3854a 100644 --- a/Libraries/LibWeb/Frame.h +++ b/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; diff --git a/Libraries/LibWeb/HtmlView.cpp b/Libraries/LibWeb/PageView.cpp index 2fc4b8f048..e5b1398166 100644 --- a/Libraries/LibWeb/HtmlView.cpp +++ b/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) { diff --git a/Libraries/LibWeb/HtmlView.h b/Libraries/LibWeb/PageView.h index 008279abec..7f53ac3be5 100644 --- a/Libraries/LibWeb/HtmlView.h +++ b/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; |