summaryrefslogtreecommitdiff
path: root/Applications/Browser
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-07-06 20:00:56 +0200
committerAndreas Kling <kling@serenityos.org>2020-07-06 20:00:56 +0200
commitfd65a2483492dfd50cae61b613d9bd8ed95306b3 (patch)
tree994b02a5b583a6ad4bae3edc4908ab162bddd254 /Applications/Browser
parent02c5e22f06dbe198fdc51eef488929518856d5c8 (diff)
downloadserenity-fd65a2483492dfd50cae61b613d9bd8ed95306b3.zip
LibWeb: Make the link context menu hook include the destination URL
Diffstat (limited to 'Applications/Browser')
-rw-r--r--Applications/Browser/Tab.cpp12
-rw-r--r--Applications/Browser/Tab.h2
2 files changed, 7 insertions, 7 deletions
diff --git a/Applications/Browser/Tab.cpp b/Applications/Browser/Tab.cpp
index 8093e6942e..9045588f6f 100644
--- a/Applications/Browser/Tab.cpp
+++ b/Applications/Browser/Tab.cpp
@@ -164,19 +164,19 @@ Tab::Tab()
m_link_context_menu = GUI::Menu::construct();
m_link_context_menu->add_action(GUI::Action::create("Open", [this](auto&) {
- m_page_view->on_link_click(m_link_context_menu_href, "", 0);
+ m_page_view->on_link_click(m_link_context_menu_url, "", 0);
}));
m_link_context_menu->add_action(GUI::Action::create("Open in new tab", [this](auto&) {
- m_page_view->on_link_click(m_link_context_menu_href, "_blank", 0);
+ m_page_view->on_link_click(m_link_context_menu_url, "_blank", 0);
}));
m_link_context_menu->add_action(GUI::Action::create("Copy link", [this](auto&) {
- GUI::Clipboard::the().set_data(m_page_view->document()->complete_url(m_link_context_menu_href).to_string());
+ GUI::Clipboard::the().set_data(m_link_context_menu_url.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_page_view->document()->complete_url(m_link_context_menu_href);
+ auto url = m_link_context_menu_url;
window->set_title(String::format("0%% of %s", url.basename().characters()));
window->set_resizable(false);
window->set_main_widget<DownloadWidget>(url);
@@ -184,8 +184,8 @@ Tab::Tab()
(void)window.leak_ref();
}));
- m_page_view->on_link_context_menu_request = [this](auto& href, auto& screen_position) {
- m_link_context_menu_href = href;
+ m_page_view->on_link_context_menu_request = [this](auto& url, auto& screen_position) {
+ m_link_context_menu_url = url;
m_link_context_menu->popup(screen_position);
};
diff --git a/Applications/Browser/Tab.h b/Applications/Browser/Tab.h
index ecf9338619..ddf285675a 100644
--- a/Applications/Browser/Tab.h
+++ b/Applications/Browser/Tab.h
@@ -73,7 +73,7 @@ private:
RefPtr<GUI::ToolBarContainer> m_toolbar_container;
RefPtr<GUI::Menu> m_link_context_menu;
- String m_link_context_menu_href;
+ URL m_link_context_menu_url;
RefPtr<GUI::Menu> m_tab_context_menu;
RefPtr<GUI::Menu> m_page_context_menu;