Commit Graph

106 Commits

Author SHA1 Message Date
Timothy Flynn
edec5b1d91 Ladybird+LibWebView: Migrate input completions to LibWebView callbacks 2023-08-23 12:07:02 -04:00
Timothy Flynn
5116e97a9d Ladybird+LibWebView: Migrate tooltip changes to LibWebView callbacks 2023-08-23 12:07:02 -04:00
Timothy Flynn
78d9339aa9 Ladybird+LibWebView: Migrate scrolling changes to LibWebView callbacks 2023-08-23 12:07:02 -04:00
Timothy Flynn
00fe122b0a Ladybird+LibWebView: Migrate cursor changes to LibWebView callbacks 2023-08-23 12:07:02 -04:00
Timothy Flynn
bf464665a7 Ladybird+LibWebView: Migrate layout notification to LibWebView callbacks 2023-08-23 12:07:02 -04:00
Timothy Flynn
682a5f9b70 Ladybird+LibWebView: Move APIs which only repaint to LibWebView
We can easily add hooks to notify the browsers of these events if any
implementation-specific handling is needed in the future, but for now,
these only repaint the client, which we can do in ViewImplementation.
2023-08-23 09:59:04 -04:00
Timothy Flynn
ea7e1b5f53 Ladybird+LibWebView: Move most of paint handling to LibWebView
Storing the backup bitmap is the same across Browser and Ladybird. Just
peform that work in LibWebView, and handle only the implementation-
specific nuances within the browsers.
2023-08-23 09:59:04 -04:00
Timothy Flynn
15da77f4c4 Ladybird+LibWebView: Migrate file APIs to LibWebView callbacks
This also sets the default callback to do what every non-Serenity
browser is doing, rather than copy-pasting this callback into every
implementation. The callback is still available for any platform which
might want to override the default behavior. For example, OOPWV now
overrides this callback to use FileSystemAccessClient.
2023-08-23 09:59:04 -04:00
Timothy Flynn
ebdcba8b3b Ladybird+LibWebView: Migrate dialog APIs to LibWebView callbacks 2023-08-23 09:59:04 -04:00
Aliaksandr Kalenik
0d66a80a0f headless-browser: Add ref tests support
The ref tests runner takes screenshots of both the input page and the
expected page, then compares them. Ref testing allows us to catch
painting bugs, which cannot be detected with the layout and text tests
we already have.

With ref tests, we'll likely want to reuse the same expectation page
for multiple inputs. Therefore, there's a `manifest.json` file that
describes the relationship between inputs and expected outputs.
2023-08-14 07:28:22 +02:00
Andreas Kling
99ac34eeae Ladybird+LibWebView+Browser: Remove ability to run with AST interpreter 2023-08-08 13:07:13 +02:00
Andreas Kling
e7e52f95ec headless-browser: Remove ability to run with AST interpreter 2023-08-08 13:07:13 +02:00
Andrew Kaster
391beef707 Ladybird: Move Qt-specific classes and functions to a Qt subdirectory
This will help a lot with developing chromes for different UI frameworks
where we can see which helper classes and processes are really using Qt
vs just using it to get at helper data.

As a bonus, remove Qt dependency from WebDriver.
2023-08-07 14:58:04 -06:00
Andreas Kling
09eed8eea2 LibWeb+headless-browser: Include paint tree in layout test output
This will give us a more comprehensive look at what actually gets
rendered in the end, and also allows us to catch more behavior changes.
2023-08-03 13:21:26 +02:00
Andrew Kaster
506b03740c Ladybird: Move classes and types into the Ladybird namespace
We were super inconsistent about this, with most "new" classes living in
the Ladybird namespace, while "old" ones were in the global namespace,
or even sitting in the Browser namespace.
2023-08-03 09:55:20 +02:00
Andrew Kaster
b5bfe732d7 Ladybird: Add RequestServer process to optionally replace Qt Networking
LibTLS still can't access many parts of the web, so let's hide this
behind a flag (with all the plumbing that entails).

Hopefully this can encourage folks to improve LibTLS's algorithm support
:^).
2023-08-02 05:44:43 +02:00
Andrew Kaster
5062ba347b Ladybird+LibWebView: Move Lagom code to Ladybird, Qt code to Utilities
Re-organize our helper files here a bit, to make a clearer distinction
between Qt-specific helpers and generic non-serenity helpers.

A future commit will move Lagom specific code from LibSQL to ladybird
as well, so that we can see about future generic apis for spawning
helper procesess.
2023-08-02 05:44:43 +02:00
Shannon Booth
25153703c9 headless-browser: Improve error on failure to open expectation file
Mostly to output the path of the file which failed to open. This is
mostly helpful if you create a test, but forget to 'touch' the
expectation path.
2023-07-31 14:48:24 +02:00
Andreas Kling
c3e5487f00 headless-browser: Run with the JavaScript bytecode VM by default
The AST interpreter is still available behind a new `--ast` flag.
2023-07-25 20:00:46 +02:00
Andreas Kling
5d6169793a Ladybird+LibWebView: Respawn with same JS interpreter after crash
WebView::ViewImplementation now remembers which JS interpreter it
started with, and uses the same setting if the WebContent process
crashes and we have to spawn a new one.
2023-07-22 08:49:59 -04:00
Sebastian Zaha
88872ca42d LibIPC: Do not leak the Core::File fd by default
This prevents fd leaks when the user of the API forgets to pass
CloseAfterSending to IPC::File. Since we are calling leak_fd in the
constructor, we want it to also take care of closing.
2023-07-12 18:22:18 -04:00
Sebastian Zaha
d77986f01c headless-browser: Ensure IPC::File is closed after sending
On systems with the default ulimit for open files <= 256 (default
on some systems) the LibWeb tests were crashing because the
input file handles are not closed in headless-browser.
2023-07-08 06:11:08 +02:00
Shannon Booth
ff23426b6e headless-browser: Write failed diffs in unified format with context 2023-07-02 11:18:11 -06:00
Shannon Booth
ee92378b80 LibDiff: Make Diff::from_text fallible 2023-06-26 19:26:34 +02:00
Shannon Booth
f2881f4662 headless-browser: Use Diff::write_normal to output hunks
Saving a bunch of code :^)

The "Hunk:" text is preserved as there is no real need for the browser
test harness to be producing valid patch files.
2023-06-24 18:34:08 +02:00
Andreas Kling
a0b4987e92 headless-browser: Paint while running layout tests (but discard results)
If we don't paint, SVG-as-image documents don't get laid out, and so
have 0x0 size throughout.

This change is also generally nice, as it makes the painting code run
on all the layout tests, increasing coverage. :^)
2023-06-20 11:34:09 +02:00
Andreas Kling
9c568282dc Ladybird+LibJS: Add CLI option to run browser with LibJS bytecode VM
This required quite a bit of plumbing, but now you can run

    ladybird --use-bytecode
2023-06-17 14:16:45 +02:00
Andreas Kling
58478d572f headless-browser: Bump test timeout from 5s to 15s
We're seeing occasional timeouts on the very first test when running
on CI. Let's try giving it more time to see if it goes away. :^)
2023-06-16 17:43:14 +02:00
Andreas Kling
b86ca27692 headless-browser: Improve output for failing tests a bit
- Colorize the "Test failed" part when stdout is a TTY
- Add missing newlines in the output
2023-06-12 11:52:58 +02:00
Andreas Kling
549260d311 headless-browser: Disable content filtering when running tests
URL filtering was taking up a huge amount of time when burning through
the tests. We're not gonna have a bunch of ads to block in our local
tests, so let's just turn it off when running them.
2023-05-28 22:03:57 +02:00
Andreas Kling
ad6027433d headless-browser: Print a diff when a test failure occurs
This will make it a lot easier to understand what went wrong, especially
when the failure occurs on CI but not at home.

And of course, use LibDiff to generate the diff! :^)
2023-05-28 22:03:57 +02:00
Andreas Kling
097b5e4803 WebContent+headless-browser: Use document.body.innerText for text tests
This should be less fickle than the "select all & copy selected text"
trick we were doing earlier.
2023-05-28 22:03:57 +02:00
Andreas Kling
6c81b90e5a headless-browser: Call fflush() between tests when running on TTY
This allows us to see the full test name without getting cut off by
stdio buffering. :^)
2023-05-28 08:03:52 +02:00
Andreas Kling
f7eb8eed34 Ladybird: Run all layout & text tests in the same process
Instead of starting a new headless-browser for every layout & text test,
headless-browser now gets a mode where it runs all the tests in a single
process.

This is massively faster on my machine, taking a full LibWeb test run
from 14 seconds to less than 1 second. Hopefully it will be a similarly
awesome improvement on CI where it has been soaking up more and more
time lately. :^)
2023-05-27 21:28:05 +02:00
Andreas Kling
3389eed59c headless-browser: Add a --dump-text mode for simplified run & dump tests
This dumps the text content of the page (via a cheesy "select all" +
"get selected text" maneuver) :^)
2023-05-27 14:03:49 +02:00
Ben Wiederhake
0420e12dad headless-browser: Prefer FileSystem over DeprecatedFile 2023-05-21 07:50:52 +02:00
Timothy Flynn
6970f1b6c1 Browser+Ladybird+LibWebView: Handle trivial content APIs in LibWebView
The goal here is to reduce the amount of WebContent client APIs that are
duplicated across every ViewImplementation. Across our three browsers,
we currently:

    Ladybird - Mix some AK::Function callbacks and Qt signals to notify
    tabs of WebContent events.

    Browser - Use only AK::Function callbacks.

    headless-browser - Drop most events on the floor.

Instead, let's only use AK::Function callbacks across all three browsers
to propagate events to tabs. This allows us to invoke those callbacks
directly from LibWebView instead of all three browsers needing to define
a trivial `if (callback) callback();` override of a LibWebView virtual
function. For headless-browser, we can simply not set these callbacks.

As a first pass, this only converts WebContent events that are trivial
to this approach. That is, events that were simply passed onto the tab
or handled without much fuss.
2023-05-17 19:47:05 +02:00
Timothy Flynn
2d51b8c286 Browser+Ladybird+LibWebView: Virtualize computing content/widget points
This will allow moving some copy-pasted functionality from web view
implementations to the base LibWebView class.
2023-05-17 19:47:05 +02:00
Timothy Flynn
d8f03dda08 Browser+LibWeb+WebContent: Broadcast video element context menu requests
This just sets up the IPC to notify the browser process of context menu
requests on video elements. The IPC contains a few pieces of information
about the state of the video element.
2023-05-16 12:48:39 +02:00
Andreas Kling
85c542ab00 Ladybird+LibWebView: Move backing store management code to LibWebView
This lets us share this code on all platforms, and makes resizing the
window much faster on SerenityOS as well. :^)
2023-05-15 12:13:34 +02:00
Andreas Kling
def37e65f3 Ladybird+LibWebView: Remember the size of the last paint
This will allow us to change the size of the backing store bitmap
without conflating the size of the bitmap and the size of the paint.
2023-05-15 10:04:29 +02:00
martinfalisse
c719a542c5 LibWeb: Add --layout-test-mode flag to HeadlessBrowser
The `layout-test-mode` flag changes the font to be SerenitySans as this
is the font used for layout tests for cross-platform compatibility of
tests.
2023-05-08 14:47:52 +02:00
Timothy Flynn
8fe846eb7f Ladybird: Define AK_DONT_REPLACE_STD via CMake rather than in every file 2023-04-24 14:49:04 +02:00
MacDue
0329ddf46a Ladybird+LibWebView: Add -P/--enable-callgrind-profiling option
This adds a -P option to run Ladybird under callgrind. It starts with
instrumentation disabled. To start capturing a profile (once Ladybird
has launched) run `callgrind_control -i on` and to stop it again run
`callgrind_control -i off`.

P.s. This is pretty much stolen from Andreas (and is based on the patch
everyone [that wants a profile] have been manually applying).
2023-04-15 06:37:51 +02:00
Andreas Kling
71bdee2837 headless-browser: Don't print extra newline after layout tree dumps
The layout tree dump text already contains a final newline, so we don't
need to use outln() and add an extra one.
2023-03-25 19:41:31 +01:00
Lucas CHOLLET
496b7ffb2b LibGfx: Move all image loaders and writers to a subdirectory 2023-03-21 22:39:25 +01:00
Cameron Youell
1d24f394c6 Everywhere: Use LibFileSystem where trivial 2023-03-21 19:03:21 +00:00
Timothy Flynn
f8b6369c23 WebContent+Everywhere: Add a WebContent IPC to activate a tab 2023-03-21 09:39:49 +00:00
Timothy Flynn
e6fc35897f WebContent+Everywhere: Add an option to not activate new tabs over IPC
WebDriver, for example, will want to create new tabs without activating
them.
2023-03-21 09:39:49 +00:00
Aliaksandr Kalenik
a9f8d4eada LibWeb+LibWebView+WebContent+Ladybird: Add IPC call that opens new tab 2023-03-16 13:17:37 -04:00