Commit Graph

649 Commits

Author SHA1 Message Date
Timothy Flynn
05c8d5ba57 Base+Ladybird: Move Ladybird-related HTML files to their own folder
Pages like the new tab page, error page, etc. all belong solely to
Ladybird, but are scattered across a couple of subfolders in Base. This
moves them all to Base/res/ladybird.
2023-12-04 19:46:35 -05:00
Bastiaan van der Plaat
980e32b4fe Ladybird/AppKit: Remove theme color changing background color 2023-12-04 14:56:03 -05:00
Timothy Flynn
c55d8a9971 Ladybird/Qt: Make the Inspector widget owned by its parent tab
This ensures the Inspector is closed when the BrowserWindow which owns
the tab is closed.
2023-12-04 12:03:48 -07:00
Timothy Flynn
4653733a0d Ladybird/Qt: Do not "share" ownership of Qt objects
When a QObject subclass (widgets, etc.) are provided a parent, then
ownership of that object is passed to the parent. Similarly, objects
added to a QLayout are owned by the layout.

Thus, do not store these objects in an OwnPtr.
2023-12-04 12:03:48 -07:00
Timothy Flynn
a21998003c Ladybird/Qt: Make String allocation infallible 2023-12-04 12:03:48 -07:00
Timothy Flynn
82c827fc56 Ladybird/Qt: Support non-ASCII when converting a QString to a String
QString is UTF-16, thus QString::size returns the number of UTF-16 code
units. Thus, we would fail to perform, for example:

    ak_string_from_qstring(QString("😀"));

Which is 2 UTF-16 code units, but 4 UTF-8 code units.
2023-12-04 12:03:48 -07:00
Timothy Flynn
1aedb0ae5a Ladybird/Qt: Replace the QString-from-AK helpers with a single method
There's no need for 2 overloads for String and DeprecatedString, we can
just use a StringView. This also avoids some cases of needlessly
allocating a DeprecatedString from a StringView when calling this
method.
2023-12-04 12:03:48 -07:00
Timothy Flynn
b10934af27 Ladybird/AppKit: Implement cursor images for row-resize and col-resize 2023-12-02 22:54:06 +01:00
Timothy Flynn
582f19ba24 Ladybird: Allow opening the Inspector with both ctrl+shift+I and F12
Ladybird on Serenity currently only uses F12, and on other platforms
only uses ctrl+shift+I. Most browsers support both hotkeys, so let's do
the same for consistency.

Note that the AppKit chrome cannot support both shortcuts. macOS does
not allow setting multiple "key equivalent" strings on an action. There
are some questionable hacks we could do to support this eventually, but
for now, just ctrl+shift+I is supported on macOS.
2023-12-02 22:54:06 +01:00
Timothy Flynn
dc04385465 Ladybird/AppKit: Remove the standalone JavaScript console 2023-12-02 10:34:22 +01:00
Timothy Flynn
c4daaa9902 Ladybird/Qt: Remove the standalone JavaScript console 2023-12-02 10:34:22 +01:00
Timothy Flynn
4c145fdb12 Ladybird/AppKit: Support enabling the GPU painter 2023-12-01 20:07:27 -05:00
Timothy Flynn
07e9a8f79b Ladybird+LibWebView: Move options used to launch WebContent to a struct
It is currently a bit messy to pass these options along from main() to
where WebContent is actually launched. If a new flag were to be added,
there are a couple dozen files that need to be updated to pass that flag
along. With this change, the flag can just be added to the struct, set
in main(), and handled in launch_web_content_process().
2023-12-01 20:07:27 -05:00
Andrew Kaster
fbfb70f81a LibWeb+WebContent: Plumb ability for WebContent process to hold N pages
In order for same-origin NavigableContainers (iframe, frame, embed, ...)
and window.open() WindowProxies to have the proper JS access to their
embedder/opener, we need to host multiple top level traversables in the
same WebContent process. As a first step, make WebContent::PageHost hold
a HashMap of PageClient objects, each holding their own Web::Page that
represents a TraversableNavigable's API surface with the UI process.
2023-12-01 20:47:44 +01:00
Bastiaan van der Plaat
b21ec0afac Ladybird/AppKit: Select all text of location search field on focus 2023-12-01 09:26:37 -05:00
Timothy Flynn
cd0f5087a7 Ladybird/AppKit: Port the Inspector to the WebView property tables 2023-11-29 13:56:35 +01:00
Timothy Flynn
b5d5e48ffc Ladybird/Qt: Port the Inspector to the WebView property tables 2023-11-29 13:56:35 +01:00
Timothy Flynn
aa4dcda5dc LibWeb+LibWebView+Ladybird: Scale scroll-to CSS positions in PageHost
The `page_did_request_scroll_to` API takes a CSS position, and thus
callers should not scale to device pixels before invoking it. Instead,
align this API with (most) other PageHost APIs which scale to device
pixels before sending the corresponding IPC message.

In the AppKit chrome, convert the provided device pixel position to a
widget position.
2023-11-24 17:19:08 -05:00
Timothy Flynn
fb1845f294 Ladybird/AppKit: Invert the horizontal delta scroll value
This matches the negation of the vertical scroll delta value. This makes
the scroll events behave as follows on macOS:

Natural scrolling enabled:
* Scrolling up on the trackpad scrolls down on the page.
* Scrolling right on the trackpad scrolls left on the page.

Natural scrolling disabled:
* Scrolling up on the trackpad scrolls up on the page.
* Scrolling right on the trackpad scrolls right on the page.
2023-11-24 11:22:17 -05:00
Timothy Flynn
c03b69e664 LibWebView+Ladybird: Remove now-unused WebView TreeModel
This was used to provided base functionality for model-based chromes for
viewing the DOM and accessibility trees. All chromes now use the WebView
inspector model for those trees, thus this class is unused.
2023-11-24 08:37:19 +01:00
Timothy Flynn
84c4eef565 Ladybird/AppKit: Port the Inspector to the WebView InspectorClient 2023-11-24 08:37:19 +01:00
Timothy Flynn
52b5bcdb6d Ladybird/Qt: Port the Inspector to the WebView InspectorClient 2023-11-24 08:37:19 +01:00
Sam Atkins
edaa5061c4 headless-browser: Add flag to dump screenshots of failing ref-tests
When the `--dump-failed-ref-tests` flag is provided, screenshots of the
actual and reference pages will be placed in
`Build/lagom/ladbybird/test-dumps`. This makes it a lot easier to spot
what's wrong with a failing test. :^)
2023-11-18 07:49:59 -05:00
Timothy Flynn
72e5b10b30 Ladybird/AppKit: Remove explicit application activation
We call [NSApp activateIgnoringOtherApps:YES] to ensure the application
is brought into view and focused when launched from a terminal. But in
a macOS environment, we're better off using the `open` command to launch
the application (in which case, it does take foreground focus).
2023-11-17 19:14:53 +01:00
Andrew Kaster
124c378472 LibWeb+WebWorker: Move worker execution into a new WebWorker process
We now create a WorkerAgent for the parent context, which is currently
only a Window. Note that Workers can have Workers per the spec.

The WorkerAgent spawns a WebWorker process to hold the actual
script execution of the Worker. This is modeled with the
DedicatedWorkerHost object in the WebWorker process.
A start_dedicated_worker IPC method in the WebWorker IPC creates the
WorkerHost object. Future different worker types may use different IPC
messages to create their WorkerHost instance.

This implementation cannot yet postMessage between the parent and the
child processes.

Co-Authored-By: Andreas Kling <kling@serenityos.org>
2023-11-15 12:56:33 +01:00
Timothy Flynn
0415d03b4f Ladybird: Register Ladybird as a browser-type application on macOS
This allows Ladybird to be the default browser on macOS, and allows for
opening some file types (.html, .svg, .md, etc.) with Ladybird.

Note this currently only works in the GN build (and thus the Qt chrome).
The CMake build does not set up the Resources directory properly for
macOS to run the Ladybird app without $SERENITY_SOURCE_DIR set.
2023-11-14 09:36:36 -05:00
Timothy Flynn
9e637de58a Ladybird/AppKit: Implement pasting Web data to the clipboard 2023-11-11 08:54:37 +01:00
Timothy Flynn
6732a38cf8 Ladybird/Qt: Implement pasting Web data to the clipboard 2023-11-11 08:54:37 +01:00
Tim Schumacher
a2f60911fe AK: Rename GenericTraits to DefaultTraits
This feels like a more fitting name for something that provides the
default values for Traits.
2023-11-09 10:05:51 -05:00
Timothy Flynn
9249f8bda8 Ladybird: Convert theme configuration to resource URIs 2023-11-06 09:39:59 +01:00
Timothy Flynn
818471b7a7 BrowserSettings+Ladybird: Convert home / new tab page to resource URIs 2023-11-06 09:39:59 +01:00
Timothy Flynn
1b30b510b9 Ladybird: Load all icons uses Core::Resource URIs 2023-11-06 09:39:59 +01:00
Daniel Bertalan
63a2039b51 Ladybird/AppKit: Fix -Wmissing-field-initializers with Clang 18+
Clang now warns about missing field initializers even when using
designated initializers.
2023-11-05 13:41:13 -07:00
Timothy Flynn
bb43bd2dee Ladybird: Remove the now-unused ModelTranslator 2023-11-05 09:11:23 +01:00
Timothy Flynn
55b53e98d7 Ladybird/Qt: Convert the inspector widget to the WebView model class
This creates a Qt-specific wrapper around the WebView model classes and
uses it for the inspector widget tree / table view models.
2023-11-05 09:11:23 +01:00
Timothy Flynn
c72b42ebb2 Ladybird/Qt: Add a couple of missing header includes
These are currently included implicitly, but this will no longer be the
case after upcoming refactoring.
2023-11-05 09:11:23 +01:00
Timothy Flynn
bbdd624d50 Ladybird: Do not require Qt6 Multimedia if PulseAudio is available
If PulseAudio is available, the Qt6 audio plugin will never be used. So
let's remove it from the build.

Note that on macOS, the Qt6 audio plugin will be used if the Qt chrome
is enabled. Otherwise, Audio Unit will be used for the AppKit chrome.
2023-11-04 08:36:34 -04:00
Andrew Kaster
bc6f19da0e Ladybird: Disable Qt autogeneration for ImageDecoder
This fixes the macOS Qt build.
2023-11-02 12:34:02 -06:00
Andrew Kaster
c990db0913 Ladybird/Android: Create a service for ImageDecoder
This follows the pattern for the other services spawned by WebContent.
The notable quirk about this service is that it's actually spawned by
the ImageCodecPlugin rather than in main.cpp in the non-Android port.

As a result we needed to do some ifdef surgery to get all the pieces
in place. But we can now load images in the Android port again :^).
2023-11-01 14:30:30 -06:00
Andrew Kaster
a54baa2c34 Ladybird/Android: Use new capitalized name for main Ladybird shlib 2023-11-01 14:30:30 -06:00
Andrew Kaster
4956514dfb Ladybird/Android: Make bind_service helper public in WebContentService
We'll need to call this from other Ladybird files for future services.
2023-11-01 14:30:30 -06:00
Andrew Kaster
5b03135c46 Ladybird/Android: Set up a Core::Resource implementation in services
Use the File implementation until we get around to creating one that
uses AssetManager
2023-11-01 14:30:30 -06:00
Andrew Kaster
c9499a9755 Ladybird: Install ImageDecoder 2023-11-01 14:30:30 -06:00
Andrew Kaster
40363f54d8 WebContent: Use the accelerated_graphics CMake helper
Instead of relying on AK_OS_LINUX, actually use the more accurate
HAS_ACCELERATED_GRAPHICS define to figure out if we should try to use
the generic LibAccelGfx GPU painter.
2023-11-01 14:30:30 -06:00
networkException
31a17b42d0 Ladybird: Use gcc13 in ladybird.nix 2023-10-31 18:09:14 +01:00
networkException
2cf3c3913a Ladybird: Use pkg-config instead of pkgconfig in ladybird.nix
pkgconfig was renamed to pkg-config in nixpkgs.

See e773b9abe9
2023-10-31 18:09:14 +01:00
Aliaksandr Kalenik
b6732b0234 Ladybird+WebContent: Add option to use GPU painter
Adds `--enable-gpu-painting` param to enable painting command executor
that uses LibAccelGfx.
2023-10-29 17:13:23 +01:00
Andrew Kaster
810bbeaed1 Ladybird: Set Settings org to SerenityOS to load proper plist on macOS 2023-10-27 16:51:03 -06:00
Timothy Flynn
f52e4fa5c2 Ladybird: Install the ImageDecoder binary to the macOS app bundle 2023-10-27 10:08:59 -04:00
Lucas CHOLLET
5c7e5cc738 Ladybird: Decode images out of process
This patch brings a service to handle image decompression. With it comes
security enhancement due to the process boundary. Indeed, consequences
of a potential attack is reduced as only the decoder will crash without
perturbing the WebContent process.
It also allows us to display pages containing images that we claim to
support but still make us crash, like for not-finished-yet decoders.

As an example, we can now load https://jpegxl.info/jxl-art.html without
crashing the WebContent process.
2023-10-27 07:26:32 +02:00