Commit Graph

40 Commits

Author SHA1 Message Date
Cameron Youell
1d24f394c6 Everywhere: Use LibFileSystem where trivial 2023-03-21 19:03:21 +00:00
Timothy Flynn
11fe34ce0f headless-browser: Re-implement headless-browser using an OOPWV
headless-browser currently uses its own PageClient to load web pages
in-process. Due to this, it also needs to set up a whole bunch of other
objects needed to run LibWeb, e.g. image decoders, request servers, etc.

This changes headless-browser to instead implement a WebView to launch
WebContent out-of-process. This implementation is almost entirely empty,
but can be filled in as-needed. For example, we may want to print
JavaScript console messages.
2023-03-13 07:21:00 +00:00
Andrew Kaster
3d33217d60 Ladybird+CI: Move layout_test.sh test runner from CI yml into CMake
We should be able to run this locally, as long as ENABLE_LAGOM_LADYBIRD
is true, or if building ladybird from the ladybird source directory.

This removes a special case from the Lagom CI yml file.
2023-03-10 23:01:55 +00:00
Andrew Kaster
3e6d790cf0 Ladybird: Abstract spawning helper processes into separate methods
This will let us use the same path discovery methods for WebContent,
SQLServer, and any other helper processes we need to launch.
2023-02-02 05:35:44 -07:00
Timothy Flynn
ad8183beb4 Meta: Support running ladybird with arguments from serenity.sh
You may now, for example, run:

    ./Meta/serenity.sh run lagom ladybird https://serenityos.org
2023-01-27 08:14:24 -05:00
Cameron Youell
b97f9f5809 Ladybird: Make LocationEdit its own class
Also make return key behave more like other browsers when editing
2023-01-22 21:15:22 -07:00
MacDue
aa85a88158 Ladybird: Reimplement the DOM inspector :^)
This has been broken since the switch to the multiprocess architecture
(and even before then was very limited).

This restores the previous functionally and also implements the ability
to inspect individual elements (by selecting them in the tree view).
The inspector also now correctly updates when navigating between pages.
2022-12-25 15:30:08 -07:00
Andrew Kaster
b4d80f92ec Ladybird: Support building Ladybird as a non-top-level project
The implementation assumes that Lagom is either the top level project,
or included before Ladybird is.
2022-12-25 07:58:58 -07:00
Timothy Flynn
2cb3ae132a Ladybird: Implement SQLServer for Ladybird :^)
This adds a SQLServer binary for Ladybird to make use of Serenity's SQL
implementation. This has to use the same IPC socket handling that was
used to make WebContent and WebDriver work out-of-process.

Unlike Serenity, Ladybird creates a new SQLServer instance for each
Ladybird instance. In the future, we should try to make sure there is
only one SQLServer instance at a time, and allow multiple Ladybird
instances to communicate with it.
2022-12-25 07:58:58 -07:00
Timothy Flynn
9e0db602ca Ladybird: Implement WebDriver for Ladybird :^)
This adds a WebDriver binary for Ladybird to make use of Serenity's
WebDriver implementation. This has to use the same IPC socket handling
that was used to make WebContent work out-of-process. Besides that, we
are able to reuse almost everything from Serenity.
2022-12-25 07:58:58 -07:00
Linus Groh
216192143e Ladybird: Clean up linked libraries
- Add Qt::Core, Qt::Gui, LibGfx, LibIPC, and LibJS to the ladybird
  target, remove LibGL, LibSoftGPU, and LibWebSocket
- Add LibJS to the WebContent target, remove LibWebView
- Order them properly :^)

Regressed in https://github.com/SerenityOS/serenity/pull/15746.
Fixes #108.
2022-12-25 07:58:58 -07:00
Linus Groh
11b730fccb Ladybird: Use Browser's History.{cpp,h}
There are no custom changes for Ladybird in the current copies of those
files, so we just need to ensure to keep Ladybird up to date for any
changes made upstream.
2022-12-25 07:58:58 -07:00
Linus Groh
c91978baa6 Ladybird: Use Browser's CookieJar.{cpp,h}
There are no custom changes for Ladybird in the current copies of those
files, so we just need to ensure to keep Ladybird up to date for any
changes made upstream.

This fixes a build issue introduced by https://github.com/SerenityOS/serenity/pull/15736.
2022-12-25 07:58:58 -07:00
networkException
fb71dc5141 Ladybird/CMake: Launch gdb with follow fork mode to debug WebContent 2022-12-25 07:58:58 -07:00
networkException
d1b2c2977e Ladybird/CMake: Add options for enabling {A,M,UB}SAN
This patch adds convenient flags for enabling ASAN, MSAN and UBSAN.
2022-12-25 07:58:58 -07:00
Andrew Kaster
6fff03713c Ladybird: Ensure that installed ladybird can launch WebContent process
Always call platform_init after there's a QApplication, because in the
installed configuration that's how we find the resources.

Try QCoreApplication::applicationDirPath() after looking in ./WebContent
for the WebContent process. In an installed configuration, ladybird and
WebContent will both be in $PREFIX/bin.

Add install rules for WebContent and its linked libraries, for if they
ever differ from ladybird's.
2022-12-25 07:58:58 -07:00
Luke Wilde
e9135583bd Ladybird: Make ladybird depend on WebContent
This causes CMake to output a WebContent build, without this it would
not build WebContent and Ladybird would be unusable since it couldn't
find the WebContent executable.
2022-12-25 07:58:58 -07:00
Andreas Kling
1298baa9ad Ladybird: Port over ConsoleWidget from the SerenityOS Browser
While this adds a fair bit of widget code, we're also increasing code
sharing by using the same bits in WebContentClient for interacting with
the JS console.

That said, we should look for more ways to share code here.
2022-12-25 07:58:58 -07:00
Andreas Kling
26a7ea0e0f Ladybird: Render web content in a separate process :^)
This patch brings over the WebContent process over from SerenityOS
to Ladybird, along with a new WebContentView widget that renders
web content in a separate process.

There's a lot of jank and FIXME material here, notably I had to re-add
manually pumped Core::EventLoop instances on both sides, in order to get
the IPC protocol running. This introduces a lot of latency and we should
work towards replacing those loops with improved abstractions.

The WebContent process is built separately here (not part of Lagom) and
we provide our own main.cpp for it. Like everything, this can be better
architected, it's just a starting point. :^)
2022-12-25 07:58:58 -07:00
Andrew Kaster
0bf79b1f3b Ladybird/CMake: Enable compile_commands.json by default
This should help IDEs have an easier time indexing serenity files.
2022-12-25 07:58:58 -07:00
Andreas Kling
5ac5fef468 Ladybird: Add a very simple DOM inspector
We use a ModelTranslator to expose a DOMTreeModel from LibWebView :^)
It allows you to select the currently inspected node, which causes
the engine to render a little box model overlay above the web content.
2022-12-25 07:58:58 -07:00
Andreas Kling
2a021084e5 Ladybird: Rename WebView to SimpleWebView
This will allow us to share code with LibWebView from SerenityOS.
(This would otherwise not work, since its "WebView" namespace collides
with our "WebView" class.)

Also, we should eventually move towards a more sophisticated
multi-process WebView like OOPWV.
2022-12-25 07:58:58 -07:00
Andreas Kling
e73c2c7029 Ladybird/WebView: Move WebSocket stuff to its own files 2022-12-25 07:58:58 -07:00
Andreas Kling
4cc82ac638 Ladybird/WebView: Move our PageClient to its own file
And rename it to PageClientLadybird while we're at it, it's not
"headless" by any means.
2022-12-25 07:58:58 -07:00
Andrew Kaster
488da351c0 Ladybird/CMake: Install resources and Lagom libraries alongside ladybird
This setup should allow the package maintainers who are looking to
distribute ladybird on their distributions to use CMake to install
ladybird using cmake install rules rather than having to write their own
2022-12-25 07:58:58 -07:00
Andreas Kling
ef757f33da Ladybird: Implement the Web::Platform::ImageCodecPlugin interface
...and move it to separate files while we're at it.
2022-12-25 07:58:58 -07:00
Andrew Kaster
4334929323 Ladybird/CMake: Link against LibSoftGPU to fix WebGL with serenity LibGL
In the future, ladybird should probably use a QOpenGLWidget or similar
platform plugin to use the native GL implementation instead of the one
in serenity.
2022-12-25 07:58:58 -07:00
Andreas Kling
8a657eaa34 Ladybird: Add a FontPlugin and try much harder to find suitable fonts
Instead of only looking at the SerenityOS default fonts, we now also
look recursively in /usr/share/fonts for suitable fonts that we can
load and use.
2022-12-25 07:58:58 -07:00
Andreas Kling
37d844fd66 Ladybird: Use only the Qt event loop to speed everything up :^)
This patch removes the dual-event-loop setup, leaving only the Qt event
loop. We teach LibWeb how to drive Qt by installing an EventLoopPlugin.

This removes the 50ms latency on all UI interactions (and network
requests, etc.)
2022-12-25 07:58:58 -07:00
Filiph Sandström
91e5b6d4f5 Ladybird: Add SettingsDialog stub 2022-12-25 07:58:58 -07:00
Filiph Sandström
a838004725 Ladybird: Add Settings class 2022-12-25 07:58:58 -07:00
Andrew Kaster
261f078a28 Ladybird/Meta: Add Android build
Build an Android APK file that, when configured properly in Qt Creator,
can be used to deploy the browser to an Android device.

The current build requires NDK 24, targets no less than Android API 30,
and Qt Creator 6.4.0.
2022-12-25 07:58:58 -07:00
Andreas Kling
aa5f886128 Ladybird: Add quick & dirty port of the JS console from Browser :^) 2022-12-25 07:58:58 -07:00
Daniel Bertalan
af5250b2cb Ladybird: Fix compilation on macOS/Clang
- Silences the -Wuser-defined-literals warning which is triggered by our
  use of the `sv` suffix for StringView
- Removes an unused captured `this` pointer [-Wunused-lambda-capture]
- Changes a JSONArray.h include to JSONObject.h to get the definition
  for `JSONValue::serialize`. This is needed because template functions
  are not exported for dylibs on macOS. This is a hack; the JSON headers
  should be refactored so that each one includes the definition of
  the template functions it sees. -- Maybe we should build with
  -fvisibility-inlines-hidden on Linux to catch issues like this?
2022-12-25 07:58:58 -07:00
Andreas Kling
80636d6779 Ladybird: Implement basic cookie support
We import the CookieJar class from Browser to do the work. Long-term
we should look for a way to share this code with Browser.
2022-12-25 07:58:58 -07:00
Matthew Costa
7681ef25da Ladybird: Expanded toolbar with browser history and home button
This patch takes the browser history code from the Serenity browser and
wires it up to the QT interface. This is tied in with a few extra
toolbar buttons associated with each tab.
2022-12-25 07:58:58 -07:00
Matthew Costa
8af5b49cba Ladybird: Rudimentary tabbed browsing support
This patch removes the browser WebView from the window and places it
inside a Tab object, all wrapped up in a QT tab control. So far you can
create tabs, but can't close them.
2022-12-25 07:58:58 -07:00
Andreas Kling
f96b53f118 Ladybird: Stop using deprecated Qt API and re-enable deprecated warnings 2022-12-25 07:58:58 -07:00
Andreas Kling
419d3ec646 Ladybird: Use QtNetwork for HTTP and HTTPS requests
Until we can get our own RequestServer infrastructure up and running,
running the TLS and HTTP code in-process was causing lots of crashes
due to unexpected reentrancy via nested event loops.

This patch adds a simple backend for HTTP and HTTPS requests that simply
funnels them through QNetworkAccessManager.
2022-12-25 07:58:58 -07:00
Andrew Kaster
74fda4aff5 Ladybird/Meta: Convert to CMake build 2022-12-25 07:58:58 -07:00