Commit Graph

374 Commits

Author SHA1 Message Date
Jamie Mansfield
fb20326979 LibWeb: Support sending DNT header with requests 2024-07-04 16:42:34 +02:00
circl
ceb9c3b797 LibWeb+UI: Add tooltip overriding and use it for <video> tags
This call is used to inform the chrome that it should display a tooltip
now and avoid any hovering timers. This is used by <video> tags to
display the volume percentage when it is changed.
2024-07-04 14:15:51 +02:00
circl
0f7623dd83 LibWeb+UI/Qt: Display 'title' tooltips only when the mouse stops moving
Now instead of sending the position in which the user entered the
tooltip area, send just the text, and let the chrome figure out how to
display it.

In the case of Qt, wait for 600 milliseconds of no mouse movement, then
display it under the mouse cursor.
2024-07-04 14:15:51 +02:00
Samuel Eisenhandler
7de669dc07 LibWebView: Append remaining source after consuming all tokens
Since "Character" tokens do not have an "end position", viewing source
drops the source contents following the final non-"Character" token.

By handling the EOF token and breaking out of the loop, we avoid this
issue.
2024-07-03 08:59:53 -04:00
Andrew Kaster
29b4f21c7b WebContent: Add shutdown_server IPC call to request process exit
This ensures that removing the last view from a WebContentClient will
close its associated process, assuming the WebContent process is not
hung. A more drastic measure will be needed to trigger forcefully
killing the process when it doesn't respond to this request.
2024-07-01 18:10:56 +02:00
Andrew Kaster
4cc3d598f9 LibWebView+LibCore: Manage process lifecycle using a SIGCHLD handler
This large commit also refactors LibWebView's process handling to use
a top-level Application class that uses a new WebView::Process class to
encapsulate the IPC-centric nature of each helper process.
2024-07-01 18:10:56 +02:00
Andreas Kling
4fe21e6d87 LibIPC: Move stuff from Connection.h to .cpp and reduce #include count 2024-06-28 17:11:24 +02:00
Aliaksandr Kalenik
c62cc915df Everywhere: Pass backing store into Navigable::paint()
...instead of Gfx::Bitmap, which makes it possible to access and
directly paint into IOSurface on macOS.
2024-06-28 14:25:34 +02:00
Andrew Kaster
54f66c574c LibWebView: Allow querying and iterating all extant WebContentClients
This is mostly useful when some application-level logic needs to
iterate over all child processes. A more robust Process abstraction
would make this easier.
2024-06-26 16:09:33 -06:00
Andrew Kaster
a587eafbf4 CMake: Consistently use imported targets for third party dependencies 2024-06-25 17:15:42 -04:00
Aliaksandr Kalenik
c92f8ab1ea Everywhere: Use IOSurface as backing store on macOS
Using mmap-allocated memory for backing stores does not allow us to
benefit from using GPU-accelerated painting, because all the performance
increase we get is mostly negated by reading the GPU-allocated texture
back into RAM, so it can be shared with the browser process.

With IOSurface, we get a framebuffer that is both shareable between
processes and can be used as underlying memory for an OpenGL/Metal
texture.

This change does not yet benefit from using IOSurface and merely wraps
them into Gfx::Bitmap to be used by the CPU painter.
2024-06-24 13:09:08 +02:00
Aliaksandr Kalenik
c46bea479c Everywhere: Hand pid of new process to client in launch_server_process()
Allows WebContentClient to get pid of WebContent process right after
creation, so there is no window between forking and
notify_process_information() IPC response, when client doesn't know the
pid.
2024-06-24 13:09:08 +02:00
Aliaksandr Kalenik
be2c484bb6 LibWebView+WebContent: Move backing store allocation into WebContent
In the upcoming changes, we are going to switch macOS to using an
IOSurface for the backing store. This change will simplify the process
of sharing an IOSurface between processes because we already have the
MachPortServer running in the browser, and WebContent knows how to
locate the corresponding server.
2024-06-24 13:09:08 +02:00
Luke Warlow
6014727c20 LibWebView: Allow data URLs in sanitize_url
Allow navigation to data URLs from browser UI.
2024-06-24 06:31:17 -04:00
Luke Warlow
099b77d60f LibWeb: Add motion preference
This adds a motion preference to the browser UI similar to the existing
ones for color scheme and contrast.
Both AppKit UI and Qt UI has this new preference.
The auto value is currently the same as NoPreference, follow-ups can
address wiring that up to the actual preference for the OS.
2024-06-18 10:31:54 -04:00
Luke Warlow
ee64684565 LibWeb: Add Contrast preference 2024-06-13 11:18:38 +02:00
Tim Ledbetter
e9f34c7bd1 LibWebView: Don't query public suffix list when sanitizing URLs
Previously, part of the procedure we used to sanitize URLs entered via
the command line would check the host against the public suffix
database. This led to some valid, but not publicly accessible URLs
being treated as invalid.
2024-06-10 20:34:57 -04:00
Tim Ledbetter
d33c4c751f LibWeb+WebContent: Provide feedback on find in page requests
This change allows the results of a find in page query to be reported
back to the user interface. Currently, the number of results found and
the current match index are reported.
2024-06-09 21:12:33 -04:00
Andreas Kling
260c5c50ad LibHTTP+RequestServer: Use HTTP::HeaderMap for request headers
No longer just for response headers! The same type is obviously useful
and ergonomic when making requests as well.
2024-06-09 15:34:02 +02:00
Timothy Flynn
8362c073f3 Everywhere: Remove LibSQL, SQLServer, and the sql REPL :^)
It is now entirely unused and replaced by sqlite3.
2024-06-06 11:27:03 -04:00
Timothy Flynn
30e745ffa7 LibWebView: Replace usage of LibSQL with sqlite3
This makes WebView::Database wrap around sqlite3 instead of LibSQL. The
effect on outside callers is pretty minimal. The main consequences are:

1. We must ensure the Cookie table exists before preparing any SQL
   statements involving that table.
2. We can use an INSERT OR REPLACE statement instead of separate INSERT
   and UPDATE statements.
2024-06-06 11:27:03 -04:00
Timothy Flynn
65ddd0553b Meta+LibWebView: Install and link sqlite3 with vcpkg
We will use sqlite3 as a replacement for LibSQL. Using a tried-and-true
database will allow us to avoid maintaining our an incomplete, non-ACID,
and less performant implementation. It also means we do not have to
launch and manage the singleton SQLServer process.
2024-06-06 11:27:03 -04:00
Andreas Kling
a0874dc870 LibWebView: Remove ProcessManager debug spam 2024-06-05 07:10:42 +02:00
Aliaksandr Kalenik
94eacf6da7 LibWeb: Remove did_request_scroll_to IPC call
No longer used after moving scrollbar painting into WebContent.
2024-06-05 07:03:42 +02:00
Aliaksandr Kalenik
cc3d95a356 LibWeb: Remove did_request_scroll IPC call
No longer used after moving scrollbar painting into WebContent.
2024-06-05 07:03:42 +02:00
Aliaksandr Kalenik
5285e22f2a LibWeb+WebContent: Move scrollbar painting into WebContent
The main intention of this change is to have a consistent look and
behavior across all scrollbars, including elements with
`overflow: scroll` and `overflow: auto`, iframes, and a page.

Before:
- Page's scrollbar is painted by Browser (Qt/AppKit) using the
  corresponding UI framework style,
- Both WebContent and Browser know the scroll position offset.
- WebContent uses did_request_scroll_to() IPC call to send updates.
- Browser uses set_viewport_rect() to send updates.

After:
- Page's scrollbar is painted on WebContent side using the same style as
  currently used for elements with `overflow: scroll` and
  `overflow: auto`. A nice side effects: scrollbars are now painted for
  iframes, and page's scrollbar respects scrollbar-width CSS property.
- Only WebContent knows scroll position offset.
- did_request_scroll_to() is no longer used.
- set_viewport_rect() is changed to set_viewport_size().
2024-06-05 07:03:42 +02:00
Andreas Kling
f2fd8fc928 Everywhere: Remove LibGemini
This hasn't been maintained (or worked at all) for a long time,
and it's not a widely supported protocol, so let's drop it.
2024-06-04 09:19:39 +02:00
Timothy Flynn
edb527e04d Libraries: Remove some Serenity-only interface implementations 2024-06-04 07:45:42 +02:00
Andreas Kling
e70d96e4e7 Everywhere: Remove a lot more things we don't need 2024-06-03 10:53:53 +02:00
Andreas Kling
09980af4ea LibWeb: Add Web::UIEvents::MouseButton enum, drop dependency on LibGUI
This was the only thing LibWeb needed from LibGUI, and we can just
duplicate the enum in LibWeb and get rid of a bogus dependency.
2024-06-02 20:24:42 +02:00
Timothy Flynn
b01e810a89 LibWeb+LibWebView+WebContent: Support case-insensitive find-in-page
This allows searching for text with case-insensitivity. As this is
probably what most users expect, the default behavior is changes to
perform case-insensitive lookups. Chromes may add UI to change the
behavior as they see fit.
2024-06-01 07:37:54 +02:00
Tim Ledbetter
7aea87c9df LibWeb+LibWebView+WebContent: Add basic find in page functionality
This allows the browser to send a query to the WebContent process,
which will search the page for the given string and highlight any
occurrences of that string.
2024-05-30 16:30:11 +02:00
Timothy Flynn
168d28c15f LibProtocol+Userland: Support unbuffered protocol requests
LibWeb will need to use unbuffered requests to support server-sent
events. Connection for such events remain open and the remote end sends
data as HTTP bodies at its leisure. The browser needs to be able to
handle this data as it arrives, as the request essentially never
finishes.

To support this, this make Protocol::Request operate in one of two
modes: buffered or unbuffered. The existing mechanism for setting up a
buffered request was a bit awkward; you had to set specific callbacks,
but be sure not to set some others, and then set a flag. The new
mechanism is to set the mode and the callbacks that the mode needs in
one API.
2024-05-26 18:29:24 +02:00
Timothy Flynn
95c6fdf401 LibWebView: Escape HTML entities in the Task Manager process titles 2024-05-12 15:38:18 -06:00
theonlyasdk
9e976dfeac LibWebView: Add Wikipedia to builtin search engines list 2024-05-11 07:53:04 -04:00
Timothy Flynn
398ae75f9a Ladybird+LibWebView: Introduce a cache for cookies backed by SQL storage
Now that the chrome process is a singleton on all platforms, we can
safely add a cache to the CookieJar to greatly speed up access. The way
this works is we read all cookies upfront from the database. As cookies
are updated by the web, we store a list of "dirty" cookies that need to
be flushed to the database. We do that synchronization every 30 seconds
and at shutdown.

There's plenty of room for improvement here, some of which is marked
with FIXMEs in the CookieJar.

Before these changes, in a SQL database populated with 300 cookies,
browsing to https://twinings.co.uk/ WebContent spent:

    19,806ms waiting for a get-cookie response
    505ms waiting for a set-cookie response

With these changes, it spends:

    24ms waiting for a get-cookie response
    15ms waiting for a set-cookie response
2024-05-01 07:06:26 +02:00
Andrew Kaster
bc976fe7e1 LibWebView: Create plumbing for a single UI process
This allows main UI processes created while there is a currently
running one to request a new tab or a new window with the initial urls
provided on the command line. This matches (almost) the behavior of
Chromium and Firefox.

Add a new IPC protocol between two UI processes. The main UI process
will create an IPC server socket, while secondary UI processes will
connect to that socket and send over the URLs and action it wants the
main process to take.
2024-04-27 20:32:12 -04:00
Timothy Flynn
2851c05dee LibWebView: Display each tab's title in the Task Manager
This allows us to more easily differentiate between WebContent processes
in the Task Manager at a glance.
2024-04-22 14:46:10 -06:00
Timothy Flynn
2fc52657b6 LibWebView: Set a title on the Inspector and Task Manager views
These will be used to display the titles in the Task Manager window.
2024-04-22 14:46:10 -06:00
Timothy Flynn
c7ef8530bf LibWebView: Explicitly inititalize the ProcessHandle PID
Avoids UB if the PID is read from without otherwise being initialized.
2024-04-22 14:46:10 -06:00
Timothy Flynn
f16f89eb32 Ladybird+LibWebView: Move SQLServer launcher to Ladybird
It previously resided in LibWebView to hide the details of launching a
singleton process. That functionality now lives in LibCore. By moving
this to Ladybird, we will be able to register the process with the task
manager.
2024-04-22 14:46:10 -06:00
Timothy Flynn
76af4503c1 LibCore: Return the singleton process's PID along with its IPC client
The PID will be used for Ladybird's task manager.
2024-04-22 14:46:10 -06:00
Timothy Flynn
bf50881e61 LibCore+LibSQL+LibWebView: Move launching a singleton process to LibCore
This just moves the code to launch a single process such as SQLServer to
LibCore. This will allow re-using this feature for other processes, and
will allow moving the launching of SQLServer to Ladybird.
2024-04-22 14:46:10 -06:00
Timothy Flynn
5dd3b91f0e LibCore+LibWebView: Move process statistics to LibCore
This will be needed to collect statistics from processes that do not
have anything to do with LibWebView. The ProcessInfo structure must be
virtual to allow callers to add application-specific information.
2024-04-22 14:46:10 -06:00
Timothy Flynn
306041f4ac LibWebView: Do not update cookie access time when fetched with WebDriver
When WebDriver accesses cookies, it specifically says to run:

    the first step of the algorithm in RFC6265 to compute cookie-string

So we should skip subsequent steps. We already skip step 2, which sorts
the cookies, but neglected to skip step 3 to update their last access
time.
2024-04-21 14:46:54 -04:00
Andrew Kaster
5e1d678bae Ladybird+Userland: Remove use of unnecessary fd passing socket concept
Now that LibIPC is using SCM_RIGHTS properly, we can go back to only
having one socket laying around when needing to transfer fds to peers.
2024-04-19 16:38:55 -04:00
Andrew Kaster
6d4ba21832 LibIPC+Userland: Make IPC::File always own its file descriptor
Add factory functions to distinguish between when the owner of the File
wants to transfer ownership to the new IPC object (adopt) or to send a
copy of the same fd to the IPC peer (clone).

This behavior is more intuitive than the previous behavior. Previously,
an IPC::File would default to a shallow clone of the file descriptor,
only *actually* calling dup(2) for the fd when encoding or it into an
IPC MessageBuffer. Now the dup(2) for the fd is explicit in the clone_fd
factory function.
2024-04-19 06:34:07 -04:00
Andreas Kling
1cb5385a29 LibCore: Stop obsessing about tiny OOMs in Core::Timer
Work towards #20405
2024-04-17 07:16:52 +02:00
Timothy Flynn
9c608b46fd LibWeb+LibWebView+WebContent: Remove now-unused history change IPC 2024-04-14 18:53:58 -07:00
Timothy Flynn
6eb2052d40 LibWebView: Remove now-unused history object 2024-04-14 18:53:58 -07:00