1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:18:12 +00:00

LibWeb: Make the link click hooks include the destination URL

We have all the context needed for relative URL resolution inside the
engine, so let's not make embedders worry about this.
This commit is contained in:
Andreas Kling 2020-07-06 19:41:10 +02:00
parent 1037a24076
commit 02c5e22f06
6 changed files with 23 additions and 24 deletions

View file

@ -151,10 +151,9 @@ int main(int argc, char* argv[])
open_page(path);
};
page_view.on_link_click = [&](const String& href, auto&, unsigned) {
page_view.on_link_click = [&](auto& url, 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);
char* path = realpath(url.path().characters(), nullptr);
free(current_path);
auto tree_view_index = model->index_from_path(path);
if (tree_view_index.has_value()) {