Commit graph

118 commits

Author SHA1 Message Date
Silvano Cerza
7c8d16ffca UI/AppKit: Fix template keyword misuse causing Mac build failure 2025-03-01 08:35:58 -05:00
Sam Atkins
fc4a2eeba8 UI/AppKit: Support image cursors 2025-02-28 13:50:13 +01:00
Sam Atkins
e0b5e742de UI/AppKit: Extract gfx_bitmap_to_ns_image() code 2025-02-28 13:50:13 +01:00
Sam Atkins
bfd7ac1204 LibWeb+WebContent+UI: Support image cursors
The `cursor` property accepts a list of possible cursors, which behave
as a fallback: We use whichever cursor is the first available one. This
is a little complicated because initially, any remote images have not
loaded, so we need to use the fallback standard cursor, and then switch
to another when it loads.

So, ComputedValues stores a Vector of cursors, and then in EventHandler
we scan down that list until we find a cursor that's ready for use.

The spec defines cursors as being `<url>`, but allows for `<image>`
instead. That includes functions like `linear-gradient()`.

This commit implements image cursors in the Qt UI, but not AppKit.
2025-02-28 13:50:13 +01:00
Sam Atkins
1990b2fc52 LibGfx: Add ImageCursor type and Cursor variant
Besides standard cursors, we also need to support custom images. For
now, everything still uses StandardCursor.
2025-02-28 13:50:13 +01:00
Timothy Flynn
533c8e910a headless-browser: Do not log the inner text of crash tests
This information is not particularly interesting, and it can be quite
verbose (such as style-propagation-for-long-continuation-chain.html,
which would log hundreds of lines of "a"s and "b"s).
2025-02-24 08:07:24 -05:00
Timothy Flynn
bc54c0cdfb AK+Everywhere: Store JSON strings as String 2025-02-20 19:27:51 -05:00
devgianlu
b8f609099a LibTLS: Remove unused DefaultRootCACertificates
The certificates are set inside `DefaultRootCACertificates` in some
places, but no one reads them.
2025-02-17 19:52:43 +01:00
Andrew Kaster
7ed4557573 UI: Only run Screenshot tests on x86_64 Linux
These were previously skipped on macOS, due to hard to
fix inconsistencies in the exact produced pixels.

Turns out, this is not just a macOS thing. The same sort
of hard-to-spot slight pixel deviations are present on
arm64 Linux as well.
2025-02-17 12:36:26 +01:00
devgianlu
62cd358fab Meta: Link with OpenSSL explicitly
Explicitly link final targets with OpenSSL to ensure that the vcpkg
version is loaded instead of the system one.

Before this change we would inherit `libcrypto.so` and `libssl.so` from
other dependencies, like Qt, that do not have their RPATH rewritten.
This would cause the loader to prefer the system libraries over the
vcpkg ones causing all sorts of version mismatch issues.

The effectiveness of this change can be verified with
`readelf -d ./bin/Ladybird` showing `libcrypto.so` and `libssl.so` as
direct dependencies, before they would not appear. Additionally, `ldd`
will show `libcrypto.so` and `libssl.so` pointing to the vcpkg builds.
2025-02-17 12:36:26 +01:00
Shannon Booth
9072a7caef Everywhere: Use URL::about_XXX factory functions 2025-02-15 17:05:55 +00:00
Shannon Booth
67f435975b headless-browser: Fix crash test globbing
Tests have the glob run against the relative path of the test file.
Since this was never set for crash tests the '-f' argument to
headless browser would never match the global against any crash test.
2025-02-10 09:25:09 +00:00
Tim Ledbetter
39e17e83f9 headless-browser: Allow the -f argument to be used multiple times
A test path is now included if it matches any of the given globs.
2025-02-05 06:58:52 -05:00
aplefull
b4ebade9c2 UI/Qt: Add copy/paste/select actions to the InspectorWidget
This fixes issue where it was impossible to paste text into
inspector console input.
2025-01-22 17:39:14 +01:00
Timothy Flynn
85b424464a AK+Everywhere: Rename verify_cast to as
Follow-up to fc20e61e72.
2025-01-21 11:34:06 -05:00
InvalidUsernameException
5cc9a5802d LibWeb+UI: Add internals API to set browser zoom 2025-01-21 16:05:12 +01:00
Rok Povsic
026fc6c1ca UI/Qt: Add '.com' to the URL if CTRL is held while pressing return 2025-01-20 19:21:56 +00:00
Timothy Flynn
43dc0f52a6 LibWeb: Do not run microtasks when the event loop is paused
For example, running `alert(1)` will pause the event loop, during which
time no JavaScript should execute. This patch extends this disruption to
microtasks. This avoids a crash inside the microtask executor, which
asserts the JS execution context stack is empty.

This makes us behave the same as Firefox in the following page:

    <script>
        queueMicrotask(() => {
            console.log("inside microtask");
        });

        alert("hi");
    </script>

Before the aforementioned assertion was added, we would execute that
microtask before showing the alert. Firefox does not do this, and now
we don't either.
2025-01-19 20:47:50 +00:00
Tim Ledbetter
bef7e704c5 headless-browser: Add support for crash tests
These are essentially the same as text tests, but they have no
associated expectation file. These tests pass if the test fully loads
without crashing.
2025-01-17 09:08:15 +01:00
Gingeh
6fd03425b2 UI: Prevent crash when right clicking on an unloaded image 2025-01-12 19:29:57 +00:00
Nicolas Ramz
0d92cd1f36 UI/AppKit: Add debug menu to clear all cookies 2025-01-10 14:57:26 +00:00
rmg-x
ba6b5adde3 UI/Qt: Add menu action to clear all cookies 2025-01-05 13:58:27 +00:00
Tyler Dence
5cfed4524d Inspector+UI: Close inspector with shortcuts
This brings keyboard shortcuts for the inspector up with common
convention in FF and Chrome: Ctrl+Shift+C now also opens the inspector,
and F12, Ctrl+W, and Ctrl+Shift+I now close the inspector when the
inspector window is focused.

Resolves #972
2025-01-03 10:47:13 +00:00
Tim Ledbetter
c55d40e84b UI/Headless: Ignore more WPT support files
We now ignore files imported from WPT, if they are in the root `common`
directory, or any directory named `resources`. This matches the
behavior of the WPT test harness.
2024-12-29 01:20:48 +00:00
Tim Ledbetter
9585700876 LibWeb: Don't try to wait for HTTP server to exit if kill call fails 2024-12-20 14:59:56 +01:00
Sam Atkins
be6a9940ad headless-browser: Let tests set their own timeout duration
Some tests take longer than others, and so may want to set a custom
timeout so that they pass, without increasing the timeout for all other
tests. For example, this is done in WPT.

Add an `internals.setTestTimeout(milliseconds)` method that overrides
the test runner's default timeout for the currently-run test.
2024-12-19 17:27:33 +00:00
Lucas CHOLLET
8a0c63f168 headless-browser: Stop considering support files from WPT as tests 2024-12-19 09:54:14 +00:00
Sam Atkins
bc971a4ccc UI/Headless: Clear pending data when a test completes
Without this, a crashing ref test is able to take down the entire
process because of the `VERIFY(!m_pending_screenshot);` in
`take_screenshot()`. The dialog/prompt fields were not causing crashes
but clearing them feels more hygienic.
2024-12-18 17:38:53 +00:00
Jess
61fcccb104 Flake: Add and run formatter + Rename devshell
Add a formatter output to the flake (`nix fmt`), along with moving +
renaming the devshell so it will work by running `nix-shell` in the root
of the project.
2024-12-18 15:15:42 +00:00
Pavel Shliak
ea469fbeab LibGfx: Let Painter care about TinyVG transforms
This helps us with non-uniform scales, and makes things simple
2024-12-14 23:29:43 +01:00
Tim Ledbetter
e764df15eb LibWebView+WebContent: Inform WebContent process if browser is headless 2024-12-10 10:31:47 -08:00
Pavel Shliak
6f81b80114 Everywhere: Include HashMap only where it's actually used 2024-12-09 12:31:16 +01:00
rmg-x
ece611718d LibWebView+UI: Read and set echo server port in HttpEchoServerFixture
This commit adds a "echo_server_port" property to `WebContentOptions`.

Additionally, it makes `Application::web_content_options()` return a
mutable reference instead of a const reference so that we can set the
port value from the fixture.
2024-12-05 17:02:57 -07:00
Tim Ledbetter
2455618995 WebContent+headless-browser: Implement mismatch conditions for ref tests
Ref tests can now have a `<link rel="mismatch">` condition. The test
will pass if the expectation page doesn't match the test page.
2024-12-04 19:50:00 +00:00
Shannon Booth
0fa54c2327 LibURL+LibWeb: Make URL::serialize return a String
Simplifying a bunch of uneeded error handling around the place.
2024-12-04 16:34:13 +00:00
Sidicer
edf29857f8 UI/Qt: Fix hover_label hiding URLs
m_hover_label did not have checks if the mouse is in the same location.
This caused clickable URLs to be hidden.
Also shortened the label text to not be longer than half of the window.
2024-12-04 16:09:59 +00:00
Pavel Shliak
be0857e390 UI/Qt: Do not pass left shift modifier on every return 2024-12-02 17:57:38 -05:00
Jess
43746ca52d flake: Fix broken dev-shell
Many dependencies aren't currently included in the devShell. As ladybird
is already packaged downstream, we can pull in those buildInputs along
with the extra dev dependencies already defined.
2024-12-01 13:27:59 -05:00
Timothy Flynn
c107ffa84f CI: Enable verbose logging of LibWeb tests
We currently have some tests that hang. In order to find which tests
these are, let's enable verbose logging to get a log of each running
test and its individual duration.
2024-11-30 12:10:12 -05:00
Timothy Flynn
ad5de9d4e5 headless-browser: Add an option to log per-test durations
This adds a verbosity option to log the start and end of each test, with
the duration taken for the test. To be able to use this option with our
exisiting verbosity flag, without cluttering stdout with other data, we
add verbosity levels to headless-browser. The level is increased by
providing the -v flag on the command line multiple times.
2024-11-30 12:10:12 -05:00
Timothy Flynn
49eeaaf8fe headless-browser: Store each test's relative path on the Test object
Rather than having to compute it each time we want it.
2024-11-30 12:10:12 -05:00
Pavel Shliak
dbfe5be9ff LibGfx: Delete DeprecatedPainter 2024-11-25 21:13:53 +01:00
devgianlu
49c388b891 LibTLS+LibWeb+LibCrypto: Move Certificate to LibCrypto
By moving `Certificate` to `LibCrypto` it is possible to reuse a bunch
of code from in `LibCrypto` itself. It also moves some constants
and pieces of code to a more appropriate place than `LibTLS`.

This also makes future work on WebCryptoAPI easier.
2024-11-25 13:38:38 +01:00
rmg-x
03b9e555c0 Libraries: Remove LibArchive
This library isn't used by anything but the Android build which
currently doesn't work. We most likely won't be using a homegrown
implementation for archive formats in the future, regardless.
2024-11-25 13:37:45 +01:00
Pavel Shliak
39c500ec7c LibGfx: Use Skia for TinyVG rendering 2024-11-25 12:14:24 +01:00
Jelle Raaijmakers
f0bcb07ff7 UI/Qt: Fall back to luma dark mode detection for unknown color scheme
The Qt style hints' color scheme can return ::Unknown, in which case we
still need to fall back to our 'old' method of using the luma component
of the background role color.
2024-11-24 21:02:50 -05:00
Pavel Shliak
6ad93d2b21 UI/Qt: Use Qt-reported dark theme
For Qt >= 6.5, the system theme can be determined reliably, so no
guesswork is needed. A fallback remains for Qt < 6.5, but it is
hacky and less reliable.
2024-11-23 19:53:43 +00:00
Tim Ledbetter
2aee5d7f62 headless-browser: Treat files ending in '.htm' as valid tests 2024-11-21 15:49:48 -05:00
Timothy Flynn
077ae6efa1 headless-browser: Create the expectation directory if it doesn't exist
This is convenient when adding tests to a new folder.
2024-11-17 22:37:45 +01:00
Timothy Flynn
4e1dab477a LibWebView+UI: Handle common WebView client initialization in LibWebView
No need to have every UI manually implement these common steps.
2024-11-14 11:47:32 +01:00