Commit Graph

913 Commits

Author SHA1 Message Date
Tim Ledbetter
b95c05b611 UI/Qt: Ignore tab bar middle clicks if the user didn't click on a tab
This avoids a segfault that would previously occur when middle clicking
to close a tab if only 1 tab was open.
2024-06-30 13:09:39 +02:00
Aliaksandr Kalenik
8de9516272 Ladybird: Account for backing store bitmap pitch
In the upcoming changes, Skia painter will be switched to Metal backend,
so we can no longer assume `pitch = width * 4` while reading Gfx::Bitmap
that wraps IOSurface populated by writing into MTLTexture that has
padded scanlines.
2024-06-28 14:25:34 +02:00
Nico Weber
c4e935aa97 Ladybird/AppKit: Send mouse event on middle click 2024-06-27 18:38:06 -04:00
Nico Weber
450b9ffcfd Ladybird/AppKit: Send correct mouse event on right click 2024-06-27 18:38:06 -04:00
Tim Ledbetter
944dbfdc97 UI/Qt: Limit number of autocomplete results to 6 2024-06-27 18:24:28 +02:00
Tim Ledbetter
c36a49b61e UI/Qt: Reduce flicker when populating autocomplete
Previously, autocomplete was cleared before the results for the current
query were retrieved. The new results would then be added when the
network request completed. This resulted in a noticable flicker. The
results are now updated when the request for the current query is
completed.

There is a small behavior change in that the query itself is no longer
included in the autocomplete dropdown unless the list would otherwise
be empty.
2024-06-27 18:24:28 +02:00
Andrew Kaster
ba4e6dc52b Ladybird: Remove unnecessary RegisterWithProcessManager enum
This was only put in place because on SerenityOS, we wanted to use the
pid of the WebContent process, rather than the peer pid for the socket.

When launching with SystemServer, this got annoying. However, now that
we only have the case that the UI process spawns processes, we can
get rid of this hack. This restores the ability to see WebContent
processes' statistics in the task manager widget.
2024-06-26 16:09:33 -06:00
Andrew Kaster
e7ece774a2 ImageDecoder: Register with mach server on macOS
This allows viewing the resource usage in the task manager widget
2024-06-26 16:09:33 -06:00
Andrew Kaster
4b5541e1b7 Everywhere: Transition ImageDecoder to be single-instance, owned by UI
This is the same behavior as RequestServer, with the added benefit that
we know how to gracefully reconnect ImageDecoder to all WebContent
processes on restart.
2024-06-26 16:09:33 -06:00
Andrew Kaster
343a3a0d7e Ladybird+LibIPC: Move clearing FD_CLOEXEC helper logic to IPC::File 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
Hugh Davenport
637ccbec35 UI/Qt: Show search engine name in location bar
The placeholder text shows "Search or enter web address" which doesn't
tell the user about *how* the search will be performed. Other popular
open source browsers show the search engine that will be used. For
example:

	Chromium: "Search **engine** or type a URL"
	Firefox: "Search with **engine** or enter address"

This change changes the placeholder text of the location bar to show
"Search with **engine** or enter web address".
2024-06-25 09:56:42 +01: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
Timothy Flynn
ebdb92eef6 LibUnicode+Everywhere: Merge LibLocale back into LibUnicode
LibLocale was split off from LibUnicode a couple years ago to reduce the
number of applications on SerenityOS that depend on CLDR data. Now that
we use ICU, both LibUnicode and LibLocale are actually linking in this
data. And since vcpkg gives us static libraries, both libraries are over
30MB in size.

This patch reverts the separation and merges LibLocale into LibUnicode
again. We now have just one library that includes the ICU data.

Further, this will let LibUnicode share the locale cache that previously
would only exist in LibLocale.
2024-06-23 19:52:45 +02:00
Andreas Kling
a3c8e60710 LibWeb: Implement very basic in-memory HTTP caching
This patch adds a simple in-memory HTTP cache to each WebContent
process.

It's currently off by default (turn it on with --enable-http-cache)
since the validation logic is lacking and incomplete.
2024-06-23 09:37:23 +02:00
Aliaksandr Kalenik
a9604ece2b Ladybird/AppKit: Add --enable-skia-painting argument support 2024-06-21 08:30:47 -04:00
Tim Ledbetter
efce3d9671 UI/Qt: Don't hide the location bar URL when creating a tab from a URL
The location bar URL is no longer hidden when creating a new tab or
opening a new window that has an associated URL. Conversely, the
location bar is now always focused and the URL hidden when creating a
window or tab without an associated URL.

The location bar is focused when:
* Opening the browser from the command line with no URL arguments
* Opening a new tab (Ctrl+T)
* Opening a new window (Ctrl+N)

The location bar is not focused when:
* Opening the browser from the command line with one or more URLs
* Opening hyperlinks in a new tab
* Clicking a hyperlink with `target="_blank"`

This matches the behavior of other major browsers.
2024-06-21 07:31:53 +02:00
Aliaksandr Kalenik
0b48c1ea3f Everywhere: Remove AffineCommandExecutorCPU
No need to have it after introduction of Skia painter that supports
transforms.
2024-06-19 17:22:30 +03:00
Andreas Kling
9bfed9a9ae Ladybird/Qt: Use "Ladybird" as the QSettings organization 2024-06-18 21:48:55 +02:00
Andreas Kling
722a669b22 Ladybird: Load about:blank when opening a new tab
Let's not show the unappealing about:newtab to new users by default.
If it becomes more useful/interesting in the future, we can reconsider.
2024-06-18 21:48:38 +02:00
Aliaksandr Kalenik
25c4355406 Ladybird+LibWeb+WebContent: Add an option to enable Skia painter 2024-06-18 21:05:50 +02: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
Tim Ledbetter
c14dc77349 WebDriver: Launch Ladybird with --force-new-process
This allows multiple WPT tests to be run in parallel with using the
`--processes` option.
2024-06-18 09:36:41 +02:00
Tim Ledbetter
808784092c UI/Qt: Don't show URL when a new tab is initially focused
The URL is now not shown when a new tab is initially activated until
the location bar loses focus. This allows the user to see the location
bar placeholder text when opening a new tab. It also makes it easier to
paste URLs into the location bar after opening a new tab.
2024-06-17 17:26:55 +02:00
Tim Ledbetter
b94ec419ac WebDriver: Use --allow-popups option when launching Ladybird
This prevents an "unable to find test window" error on tests that
attempt to open a new window.
2024-06-17 14:16:39 +03:00
Tim Ledbetter
577a7610fb UI/Qt: Add --allow-popups option to disable popup blocking by default 2024-06-17 14:16:39 +03:00
Tim Ledbetter
88d134a4da UI/Qt: Add standard shortcuts for find in page actions
This commit adds the standard shortcuts for the Find Next and Find
Previous buttons on the find in page panel. These shortcuts are usually
F3 and Shift+F3 respectively, although Qt standard shortcuts may vary
across platforms.
2024-06-14 14:11:19 +02:00
Luke Warlow
ee64684565 LibWeb: Add Contrast preference 2024-06-13 11:18:38 +02:00
Tim Ledbetter
ebfb847d34 UI/Qt: Ensure we don't add the same zoom shortcut key more than once
On my system `QKeySequence::StandardKey::ZoomIn` includes both `Ctrl++`
and `Ctrl+=`, so explicitly adding the secondary `Ctrl+=` shortcut
ourselves results in an ambiguous shortcut error message being shown.

According to the Qt documentation the key bindings returned by
`QKeySequence::StandardKey::*` are platform specific, so we may still
need to add the secondary shortcut on some systems. Therefore, we now
check whether our secondary shortcut is already in the shortcut list
before adding it.
2024-06-11 09:19:01 -04:00
Hugh Davenport
cb657a038f UI/Qt: Update placeholder text if search disabled
The placeholder text is there to prompt the user as to what could be
added in the address bar. The current text tells the user that they can
"Search or enter web address" even when the search setting is disabled.
When attempting to "Search" the user is instead sent to page ":", with
an error in the console:
    WebContent(575249): (FIXME) Don't know how to navigate to :

This patch fixes this by checking whether the search feature is enabled
and setting the placeholder appropriately. This provides a slightly
better user experience.

Closes #132
2024-06-11 09:50:46 +02:00
Timothy Flynn
54183b8eef UI/AppKit: Display query results on the find-in-page panel 2024-06-11 09:50:13 +02:00
Tim Ledbetter
2ea680b5b3 UI/Qt: Display query results on find in page panel
The number of matches and current match index are now displayed to the
user when a find in page query is performed.
2024-06-09 21:12:33 -04:00
Tim Ledbetter
0a3203fa25 UI/Qt: Remove unused member variable from FindInPageWidget 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
Andreas Kling
5ac0938859 LibHTTP+LibWeb: Stop bundling "Set-Cookie" headers as JSON
Before we had HTTP::HeaderMap (which preserves multiple headers with the
same name), we collected multiple "Set-Cookie" headers and bundled them
together as a JSON array.

This was a huge hack, and now we can stop doing that, since LibWeb gets
access to the full set of headers now.
2024-06-09 15:34:02 +02:00
Andreas Kling
e636851481 LibHTTP+RequestServer: Add HTTP::HeaderMap and use for response headers
Instead of using a HashMap<ByteString, ByteString, CaseInsensitive...>
everywhere, we now encapsulate this in a class.

Even better, the new class also allows keeping track of multiple headers
with the same name! This will make it possible for HTTP responses to
actually retain all their headers on the perilous journey from
RequestServer to LibWeb.
2024-06-09 15:34:02 +02:00
Andreas Kling
2f68e36137 Ladybird: Use fontconfig to choose generic fonts on non-Apple systems
If we get a suggestion from fontconfig, we try those fonts first, before
falling back on the hard coded list of known suitable fonts for each
generic family.
2024-06-08 10:23:36 +02:00
Andrew Kaster
9f25dc6b09 CMake+CI: Remove BUILD_LAGOM=OFF option in favor of LAGOM_TOOLS_ONLY=ON
The far more common configuration for Ladybird is to always build the
Lagom libraries.
2024-06-08 07:58:11 +02:00
Andrew Kaster
d90a9ab70c LibWeb: Add Web::UIEvents::KeyCode and KeyModifier enums, drop Kernel
This was the last Kernel header we had. Move the definitions we need
into a UIEvents header similar to MouseButton.
2024-06-07 09:44:41 +02:00
Timothy Flynn
d61770c457 LibCore: Remove now-unused singleton process utilities 2024-06-06 11:27:03 -04: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
cd581e9502 Meta: Do not pass an empty --resources flag to headless-browser
The ${resource_base_dir} no longer exists in this context. Thus LibWeb
tests were no longer actually running.
2024-06-06 13:55:10 +02:00
Tim Ledbetter
fdd2f9ebbd UI/Qt: Spoof user agent across all tabs 2024-06-06 10:07:57 +02:00
Tim Ledbetter
99555f19f4 UI/Qt: Set debug menu checkbox options across all tabs
The "Enable Scripting", "Block Pop-ups" and "Enable Same-Origin Policy"
options are now set for every tab when toggled. They are also applied
to new tabs when they are created.
2024-06-06 10:07:57 +02:00
Timothy Flynn
8641e78cdc Meta: Copy resources to the app bundle during create_ladybird_bundle()
For some reason, moving the UI-specific CMake to its own files prevents
resource files from being copied to the Resource directory in the macOS
application. I'm not sure what the difference here is, but doing this
step during create_ladybird_bundle() works.
2024-06-05 14:40:02 -06:00
Andrew Kaster
354b0062fa CMake: Simplify WebContent CMakeLists to always create a static lib 2024-06-05 13:56:46 -04:00
Andrew Kaster
47d6a263d8 CMake: Move ladybird target creation to UI-specific CMakeLists 2024-06-05 13:56:46 -04:00