Commit graph

64959 commits

Author SHA1 Message Date
Aliaksandr Kalenik
4b93e27698 LibGfx+LibWeb: Create PaintingSurface snapshot without GPU->RAM readback
...by constructing ImmutableBitmap directly from SkImage.

This is a huge optimization for the case when content of canvas is
painted onto another canvas, as it allows pixels to remain in GPU memory
throughout the process.

Fixes performance regression on https://playbiolab.com/ introduced by
switching to GPU-backend for canvas.
2024-11-09 20:51:24 +01:00
Aliaksandr Kalenik
1a01a71568 LibWeb: Delete DrawScaledBitmap display list item type
It's possible to replaces all uses of this item by wrapping Gfx::Bitmap
in Gfx::ImmutableBitmap.
2024-11-09 20:51:24 +01:00
Aliaksandr Kalenik
698bca686e LibGfx+LibWeb: Cache SkImage in ImmutableBitmap
By caching the SkImage that is reused across repaints, we allow Skia t
optimize GPU texture caching.

ImmutableBitmap is chosen to own the SkImage because it guarantees that
the underlying pixels cannot be modified. This is not the case for
Gfx::Bitmap, where invalidating the SkImage would be challenging since
it exposes pointers to underlying data through methods like scanline().
2024-11-09 20:51:24 +01:00
Aliaksandr Kalenik
460803d2da LibGfx: Delete unused id property from ImmutableBitmap 2024-11-09 20:51:24 +01:00
Aliaksandr Kalenik
a2c33ea4e1 LibWeb: Return ImmutableBitmap from PaintingSurface::create_snapshot()
This is a preparation for upcoming changes where ImmutableBitmap will
own SkImage allowing Skia to cache GPU textures across repaints.
2024-11-09 20:51:24 +01:00
stasoid
31bf40b659 AK: Make LexicalPath::relative_path() fallible 2024-11-09 12:42:27 -07:00
stasoid
f026d495cd AK: Port LexicalPath to Windows
Supported:
* Normal absolute and relative paths: C:\Windows\Fonts, AK\LexicalPath.h
* Forward slashes and multiple separators: C:/Windows///\\\notepad.exe

Not supported:
* Paths starting with two backslashes: \\?\C:\Windows, \\server\share
* Unusual relative paths like C:, C:a\b, \, \a\b

More on Windows path formats: https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats
2024-11-09 12:42:27 -07:00
stasoid
9ebed7d8d5 AK: Add StringBuilder::append_repeated(StringView, size_t)
By analogy with append_repeated(char, size_t)
2024-11-09 12:42:27 -07:00
stasoid
e6749eb6b7 LibCore: Port AnonymousBuffer to Windows 2024-11-09 12:40:35 -07:00
Shannon Booth
457cdd0cc3 LibWeb: Wire up UniversalGlobalScopeMixin to ShadowRealmGlobalScope 2024-11-09 12:36:12 -07:00
Shannon Booth
2ea31fad32 LibWeb: Add support for interfaces being exposed for shadow realm 2024-11-09 12:36:12 -07:00
Shannon Booth
fc2104f099 LibWeb: Add support for intrinsics on a synthetic realm 2024-11-09 12:36:12 -07:00
Shannon Booth
9ba68c5776 LibWeb: Move host_defined_intrinsics out of line 2024-11-09 12:36:12 -07:00
Andreas Kling
107b20e84d LibWeb: Restrict CSS gap properties to values allowed by the spec
Gap values are now represented by Variant<LengthPercentage, NormalGap>.
NormalGap is just an empty struct to represent the `normal` keyword.

This fixes a long-standing issue where we were incorrectly storing gaps
as CSS::Size, which led to us allowing a bunch of invalid gap values.
2024-11-09 19:21:00 +01:00
Andreas Kling
2a741f81c7 Tests: Import some WPT tests for the CSS gap properties 2024-11-09 19:21:00 +01:00
sideshowbarker
98b223b9df Docs: Beef up the FAQ 2024-11-09 11:07:55 -07:00
Jonne Ransijn
0080f399c7 LibJS: Remove PropertyKey::is_valid() method
Some checks failed
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.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-24.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
Build Dev Container Image / build (push) Has been cancelled
This method was being used to check for invalid `PropertyKey`s.
Since invalid `PropertyKey`s are no longer created, and since the
associated method has also been removed in the latest edition of
ECMA-262, the method can now be removed here as well.

While we are removing all its calls, lets also update any surrounding
spec comments to the current latest edition, where possible.
2024-11-09 17:55:03 +01:00
Jonne Ransijn
bc05f6303f LibJS: Add PutBySpread instruction
This object property kind had completely different behaviour.
By adding an instruction for it, we can remove a bunch of special
casing, and avoid creating dummy `PropertyKey` values.
2024-11-09 17:55:03 +01:00
Jonne Ransijn
27859c17b4 LibJS: Remove default constructor of PropertyKey
This constructor was creating an "invalid" `PropertyKey`, but every
code path constructing such a `PropertyKey` was either never used or
immediately `VERIFY`ing that the `PropertyKey` was valid.

The `VERIFY` call has been moved to the `PropertyKey::from_value(...)`
call, and the array/object literal spreading code could be refactored
to not take a `PropertyKey` but creates dummy values for now.

The default constructor for `Reference` has similairly be deleted,
because it was never used.
2024-11-09 17:55:03 +01:00
Jonne Ransijn
1d8e62926f AK: Remove clang-tidy warnings for VERIFY(a || b) lines
Lines like these were getting a warning to simplify the expanded
boolean expression from `!(a || b)` to `(a && b)`, but since the
`!(...)` is part of the macro, that is never going to happen.
2024-11-09 17:55:03 +01:00
Timothy Flynn
ed6431a0b1 WebWorker: Move all WebWorker configuration to Services 2024-11-09 17:54:21 +01:00
Timothy Flynn
20bdd34696 WebContent: Move all WebContent configuration to Services 2024-11-09 17:54:21 +01:00
Timothy Flynn
528dd4fcbe RequestServer: Move all RequestServer configuration to Services 2024-11-09 17:54:21 +01:00
Timothy Flynn
6208abc221 ImageDecoder: Move all ImageDecoder configuration to Services 2024-11-09 17:54:21 +01:00
Timothy Flynn
19fb790dc6 WebDriver: Move all WebDriver configuration to Services 2024-11-09 17:54:21 +01:00
Timothy Flynn
d5c2d11ac7 Services: Remove unused main.cpp and CMakeLists.txt files
We will be moving the variants of these files from Ladybird to the
Userland/Services directory. To make the diffs in those commits actually
make sense, let's remove these unsused variants ahead of time.
2024-11-09 17:54:21 +01:00
Lucas CHOLLET
d0dfc0c3e1 Tests: Import WPT tests from css-color
Specifically, they are related to parsing the `lab()`, `lch()` and
`color(xyz-d50 ...)` color functions.
2024-11-09 17:53:53 +01:00
sideshowbarker
0a773b408a Tests: Allow wpt.live URLs for both “WPT.sh run” and “WPT.sh import”
This change allows you to give http[s]://wpt.live/ URLs to the WPT.sh
script for both the “WPT.sh run” and “WPT.sh import” commands.

That facilitates the use case where you’ve navigated to a wpt.live URL
in a browser, and you want to just directly copy-paste the URL in order
to either run the test in Ladybird, or import the test into the repo.

Otherwise, without this change, when using WPT.sh, you’re limited to
needing to specify either a WPT path fragment or filesystem pathname —
which doesn’t allow for easy copy-paste directly from wpt.fyi.
2024-11-09 15:32:51 +01:00
Sam Atkins
b0e58054aa LibWeb: Add pseudoElement parameter to GetAnimationsOptions
This corresponds to: https://github.com/w3c/csswg-drafts/pull/11050

For now, we don't do anything useful with this parameter, because we
don't yet support animating pseudo-elements.
2024-11-09 15:32:03 +01:00
Sam Atkins
c5c5d97544 LibWeb: Match spec changes to "apply the history step"
Corresponds to https://github.com/whatwg/html/pull/10704
2024-11-09 15:18:37 +01:00
Sam Atkins
0a578ee345 LibWeb/HTML: Update spec comments for "URL and history update steps"
Corresponds to:
https://github.com/whatwg/html/pull/10587
2024-11-09 15:18:37 +01:00
Sam Atkins
36f8dfaed0 LibWeb/HTML: Dispatch toggle and beforetoggle events from dialogs
Corresponds to https://github.com/whatwg/html/pull/10091
2024-11-09 15:18:00 +01:00
Lucas CHOLLET
10dc7ff042 LibWeb/CSS: Support the xyz-d65 colorspace in the color() function
This also adds support for `xyz` as it defaults to `xyz-d65`. We now
pass the following WPT tests:
 - css/css-color/xyz-001.html
 - css/css-color/xyz-002.html
 - css/css-color/xyz-004.html
 - css/css-color/xyz-d65-001.html
 - css/css-color/xyz-d65-002.html
 - css/css-color/xyz-d65-004.html
2024-11-09 15:15:36 +01:00
Lucas CHOLLET
ff6102430e LibGfx: Add Color::from_linear_srgb()
This will be usefully on its own later on when supporting this color
space directly, but it also allows us to do some factorization in the
current codebase.
2024-11-09 15:15:36 +01:00
Gingeh
47992f7b39 LibWeb: Compute mimetype when loading a document
computed type != supplied type
2024-11-09 14:30:38 +01:00
Sam Atkins
7a104fef66 LibWeb/CSS: Make non-nested & selector have 0 specificity
If a & simple selector is on a style rule with no parent style rule,
then it behaves like :scope - but notably, :scope provides 1
specificity in the class category, but & is supposed to provide 0.

To solve this, we stop replacing it directly, and just handle the & like
any other simple selector. We know that if the selector engine ever
sees one, it's equivalent to :scope, because the nested ones will have
been replaced with :is() before that point.

This gets us one more subtest pass. :^)
2024-11-09 14:29:37 +01:00
Sam Atkins
219346011b LibWeb/CSS: Require that tag-name simple selectors go first
This fixes 1 subtest.
2024-11-09 14:29:37 +01:00
Sam Atkins
a0403ac427 LibWeb: Add & when setting nested style rule's selector text
When we first parse a nested CSSStyleRule's selectors, we treat them as
relative selectors and then patch them up with an `&` as needed.
However, we weren't doing this when assigning the `cssText` attribute.
So, let's do that!

This gives us a couple of subtest passes. :^)
2024-11-09 14:29:37 +01:00
Andrew Kaster
3e0c182344 DevContainer: Use correct path for vcpkg binary
Now more correct than 7ae7b9b695
2024-11-09 08:18:41 -05:00
Andrew Kaster
85515c0096 LibWeb: Queue the task for MessagePort receive in targetPort's realm
We were delaying sending an IPC message until the HTML PortMessage
task was run, but we were not queuing the task in on the receiver
side. The result of this was that message port posting was
needlessly creating an HTML task just to send an IPC message.

On the flip side, we were directly calling dispatch_event from the
socket notifier of the target port's message queue. This is a huge
problem, because it means that we were effectively running
javascript-aware code from an 'in parallel' context.

By switching around which side of the IPC interface is responsible
for queuing a task, we can avoid problems where a document is
destroyed from a port message-attached callback and crashes.
2024-11-09 08:18:41 -05:00
Pavel Shliak
6709905656 IPC: Remove Gfx::Bitmap encoder and decoder
The Gfx::Bitmap encoder and decoder have been replaced
by BitmapSequence in #1435, making them redundant and safe to remove.

Additionally, the base IPC::encode and IPC::decode implementations
will trigger a compiler error if these methods are called.

.ipc files already exclude references to Gfx::Bitmap.
2024-11-09 08:11:51 -05:00
Shannon Booth
45537efcef LibWeb: Enable callbacks for ByteStreamTeeBYOBReadRequest::on_chunk
Fixes a crash running the imported WPT test.
2024-11-09 08:10:57 -05:00
Shannon Booth
d31014d135 LibWeb: Reorder step to get chunk size after checking for aborted stream
This fixes a crash seen on:

http://wpt.live/streams/writable-streams/aborting.any.html

I believe this is a spec bug, which has been reported to the Streams
spec.
2024-11-09 08:09:54 -05:00
sideshowbarker
3594cdf948 LibWeb: Fix accessible-name computation for “tooltip” & empty-alt cases
This change fixes accessible-name computation for:

- an element that has empty text content but that also has a title
  attribute (“tooltip”) with a non-empty value
- an img element whose alt attribute is the empty string but that also
  has a “title” attribute with a non-empty value

Otherwise, without this change, the accessible name unexpectedly isn’t
computed correctly for those cases.
2024-11-09 08:08:05 -05:00
Timothy Flynn
4ae1bca67d UI/AppKit: Handle window resize events during live resizing
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Build Dev Container Image / build (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-24.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 lets us redraw the WebView while live resize events are ongoing. By
doing so, we can also update the window rect from within the WebView,
rather than requiring a separate method invocation (which the Inspector
and Task Manager windows were missing).
2024-11-08 15:31:08 -05:00
Timothy Flynn
3bbe1b0c62 UI/AppKit: Register socket notifiers in the common run loop mode
When the user resizes the browser window, AppKit will spin the current
run loop in the common mode. This patch allows socket events from IPC to
be processed while the resize is ongoing. This includes the WebView hook
to repaint.

Co-Authored-By: Andreas Kling <andreas@ladybird.org>
2024-11-08 15:31:08 -05:00
Timothy Flynn
52c828be2b LibWeb: Disable slow imported CSS animation tests 2024-11-08 15:02:30 -05:00
Andrew Kaster
7ae7b9b695 DevContainer: Update path to vcpkg 2024-11-08 11:29:31 -07:00
Timothy Flynn
f9df95af50 CI: Use clang for js artifacts on Linux
We have optimizations that only work with clang (namely, our use of
FLATTEN in the bytecode interpreter).
2024-11-08 11:29:18 -07:00
Timothy Flynn
74fe899d79 CI: Use the distribution release configuration for js artifacts 2024-11-08 11:29:18 -07:00