Commit graph

199 commits

Author SHA1 Message Date
Timothy Flynn 27776c8854 UI/AppKit: Implement opening child web views from e.g. window.open
Some checks are pending
CI / Lagom (true, NO_FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-22.04, Linux, GNU) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-22.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
This has been implemented in Qt for quite some time. This patch adds the
same feature to AppKit. This is needed to run many WPT subtests with the
AppKit chrome. This is also needed to handle window.open, target=_blank
link clicks, etc.
2024-09-18 10:09:49 +02:00
Timothy Flynn e6965b11e4 UI/AppKit: Do not open child web views with an about:blank URL
This is overriding the URL passed to e.g. window.open and link clicks on
an <a target=_blank> element.

Note: This alone is not enough to support such use cases. We will also
need to actually implement opening child web views. But getting this fix
out of the way first makes that patch a bit simpler.
2024-09-18 10:09:49 +02:00
Timothy Flynn 9cd34a7d80 UI/AppKit: Re-order field designators to be in declaration order
This is required by C++, but for some reason, only started causing a
compiler error today.
2024-09-08 09:45:39 +02:00
Tim Ledbetter 7c953552b7 UI: Add the --disable-scripting option to disable scripting by default 2024-09-07 11:37:41 +02:00
Tim Ledbetter 256b56dde8 UI/AppKit: Disable popup blocking on startup if --allow-popups is set 2024-09-07 11:37:41 +02:00
Timothy Flynn 40db0848d5 UI/AppKit: Implement the Inspector's cookie context menu 2024-09-07 11:10:27 +02:00
Timothy Flynn ed3c450359 LibWebView+UI: Move the database and cookie jar to WebView::Application
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-22.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-22.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
The main motivator here was noticing that --disable-sql-database did not
work with AppKit. Rather than re-implementing this there, move ownership
of these classes to WebView::Application, so that each UI does not need
to individually worry about it.
2024-09-05 19:45:47 -04:00
Timothy Flynn 6a0c67d5d2 UI/AppKit: Do not expose PUA key event code points to WebContent
AppKit uses Private Use Area code points for a large collection of
functional keys (arrows, home/end, etc.). Re-assign them to 0 to avoid
tripping up WebContent's key handler.
2024-09-05 14:37:57 +01:00
Timothy Flynn bf2dad5d38 UI/AppKit: Implement download directory selection 2024-09-03 14:13:41 -04:00
Timothy Flynn e2ff234ac2 UI/AppKit: Update the User-Agent to the provided UA override name
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-22.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-22.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
2024-08-29 13:05:47 +01:00
Andreas Kling 7cf7a4d7aa Ladybird/AppKit: Use sRGB color space when blitting web content
Before this change, we were passing CGColorSpaceCreateDeviceRGB() to
CGImageCreate(), causing the system to assume that the image data is
in a device-specific RGB space without any color profile adjustments.

If your monitor is more vibrant than the assumed profile (for example,
a wide-gamut display), colors may appear over-saturated as there's no
correction applied for how the display actually renders those colors.

We now pass CGColorSpaceCreateWithName(kCGColorSpaceSRGB) instead,
which makes colors look the same in Ladybird as in other browsers. :^)
2024-08-20 20:31:10 +02:00
Timothy Flynn a46edc2f8b UI/AppKit: Remove workaround for Protocol naming conflict
The AppKit Application class is responsible for launching all helper
processes. This had to be moved to a .cpp file because we were unable to
include headers with the Protocol namespace in .mm files, as they would
conflict with the Protocol interface defined by Apple.

Now that this namespace has been renamed to Requests, we can remove this
workaround.
2024-08-20 09:29:12 +02:00
Timothy Flynn ac062d0c97 UI/AppKit: Process drag-and-drop events through the web view
This forwards all drag-and-drop events from the UI to the WebContent
process. If the page accepts the events, the UI does not handle them.
Otherwise, we will open the dropped files as file:// URLs.
2024-08-19 13:29:19 +02:00
Andrew Kaster 804729fe37 Libraries+Ladybird: Rename LibProtocol -> LibRequests
The identifier "Protocol" is claimed by Objective-C and Swift for use
by the language's built-in protocol conformance feature, which is
similar to Rust traits or Java interfaces.

Rename LibProtocol -> LibRequests, and its namespace from Protocol to
Requests to accomodate this.
2024-08-19 12:56:55 +02:00
Timothy Flynn b1433a8097 UI/AppKit: Add a debug menu item to dump RequestServer connection info 2024-08-03 15:53:07 -04:00
Timothy Flynn 5f8d852dae LibWebView+UI: Migrate Ladybird's command line flags to LibWebView
Currently, if we want to add a new e.g. WebContent command line option,
we have to add it to all of Qt, AppKit, and headless-browser. (Or worse,
we only add it to one of these, and we have feature disparity).

To prevent this, this moves command line flags to WebView::Application.
The flags are assigned to ChromeOptions and WebContentOptions structs.
Each chrome can still add its platform-specific options; for example,
the Qt chrome has a flag to enable Qt networking.

There should be no behavior change here, other than that AppKit will now
support command line flags that were previously only supported by Qt.
2024-08-01 11:38:42 +02:00
Andrew Kaster 07d387af96 Meta: Create a common Swift settings flow 2024-07-30 18:38:02 -06:00
Andrew Kaster 7f8103da7a CMake: Move GenerateSwiftHeader.cmake to Meta/CMake 2024-07-30 18:38:02 -06:00
Andrew Kaster cb7402bc69 Ladybird: Reformat AppKit UI Swift files 2024-07-30 18:38:02 -06:00
Timothy Flynn d58a8b5146 LibWebView+UI: Raise the chrome process open file limit
The default limit (at least on Linux) causes us to run out of file
descriptors at around 15 tabs. Increase this limit to 8k. This is a
rather arbitrary number, but matches the limit set by Chrome.
2024-07-23 09:04:42 +02:00
Andrew Kaster 989b4ac127 CMake: Ensure that dependency targets are built before AppKit UI files 2024-07-22 09:31:22 -06:00
circl 3adfdd3257 UI: Rename s_serenity_resource_root to s_ladybird_resource_root 2024-07-21 15:59:25 -06:00
Andrew Kaster 68ce5f8290 Ladybird/AppKit: Port TaskManager window to Swift
This is just a direct port of the Objective-C++ code to Swift 6.
A future patch should probably update it to actually use SwiftUI.
2024-07-21 15:55:47 -06:00
Aliaksandr Kalenik 3627329bed Everywhere: Use Skia painter by default
Skia painter is visibly faster than LibGfx painter and has more complete
CSS transforms support. With this change:
- On Linux, it will try to use Vulkan-backend with fallback to
  CPU-backend
- On macOS it will try to use Metal-backend with fallback to
  CPU-backend
- headless-browser always runs with CPU-backend in layout mode
2024-07-21 10:36:17 +02:00
Andrew Kaster 349a3ceec5 Ladybird/AppKit: Remove system header workarounds for global names 2024-07-18 09:43:38 +01:00
Daniel Bertalan c62240aa80 Everywhere: Warn on function definitions without prototypes
If no header includes the prototype of a function, then it cannot be
used from outside the translation unit it was defined in. In that case,
it should be marked as `static`, in order to avoid possible ODR
problems, unnecessary exported symbols, and allow the compiler to better
optimize those.

If this warning triggers in a function defined in a header, `inline`
needs to be added, otherwise if the header is included in more than one
TU, it will fail to link with a duplicate definition error.

The reason this diff got so big is that Lagom-only code wasn't built
with this flag even in Serenity times.
2024-07-17 21:51:29 +02:00
Sebastian Zaha 7604d15b99 UI/AppKit: Port --force-new-process option from Qt chrome 2024-07-10 11:03:47 -06:00
Sebastian Zaha 946ccfc108 UI/AppKit: Port --allow-popups option from Qt chrome
WebDriver requires this option to be present in order to run the WPT
tests.
2024-07-10 11:03:47 -06:00
Jamie Mansfield 98e1ae49f5 Ladybird/AppKit: Add actions to set navigator compatibility mode 2024-07-09 14:44:38 -04:00
Jamie Mansfield fe551d3eff Base: Update to new project logo
This removes the existing 16x16 and 32x32 app icons with 48x48 and
128x128 versions, as the new logo is not well suited to such small
resolutions.
2024-07-09 11:21:07 +02:00
Tim Ledbetter 8867146327 WebWorker: Allow the WebWorker process to optionally use Qt networking
This change adds a `--use-lagom-networking` flag to the WebWorker
process. Qt networking is used if this flag isn't passed. The flag is
passed the UI launches the WebWorker process unless the Qt chrome is
being run with the `--enable-qt-networking` flag.
2024-07-06 14:50:26 -06:00
Aliaksandr Kalenik 830b287c46 Everywhere: Remove GPU painter and AccelGfx
GPU painter that uses AccelGfx is slower and way less complete compared
to both default Gfx::Painter and Skia painter. It does not make much
sense to keep it, considering Skia painter already uses Metal backend on
macOS by default and there is an option to enable GPU-accelerated
backend on linux.
2024-07-04 14:47:02 +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
Kevin Meyer 8a7afffdd3 Ladybird/AppKit: Enable reload action
Is necessary, since history navigation was refactored
2024-07-02 13:44:48 -04:00
Nicolas Danelon af90978454 UI/AppKit: Make the header buttons more accessible
By Setting setBordered propperty on header buttons to `Yes` this
path makes the whole button clickable. Previously the only the
icon was clickable, now it's easy to click.
2024-07-02 09:17:20 -04: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
Andrew Kaster 598144d09c Ladybird/AppKit: Apply __weak until LadybirdWebView gets destroyed
A __weak a day keeps the reference cycle away.
2024-07-01 18:10:56 +02:00
Andrew Kaster 99f4fce12b Ladybird: Add CFEventLoop implementation of register/unregister_signal 2024-07-01 18:10:56 +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
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
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
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
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
Timothy Flynn 54183b8eef UI/AppKit: Display query results on the find-in-page panel 2024-06-11 09:50:13 +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