Commit graph

64981 commits

Author SHA1 Message Date
rmg-x
c1ec2ddb63 AK: Add 16-bit float type 2024-11-10 14:48:20 -07:00
Shannon Booth
653c8f231d LibWeb: Implement HTMLElement.innerText setter 2024-11-10 21:31:30 +01:00
Shannon Booth
a1a740bb3e LibWeb: Make rendered_text_fragment return a DocumentFragment
This closer matches the spec and is needed in the implementation of the
innerText setter.
2024-11-10 21:31:30 +01:00
Aliaksandr Kalenik
dd11d48a1d LibWeb: Use available space to resolve sizes in FFC
If available space is definite it should always match the size of the
containing block. Therefore, there is no need to do containing block
node lookup.
2024-11-10 19:14:54 +01:00
Andreas Kling
5aa1d7837f LibJS: Don't leak class field initializers
We were storing these in Handle (strong GC roots) hanging off of
ECMAScriptFunctionObject which effectively turned into world leaks.
2024-11-10 19:12:59 +01:00
Andreas Kling
8c809fa5ee LibCore: Don't reserve 2 KiB of stack memory when processing event queue
The inline capacity on ThreadEventQueue::Private::queued_events caused
us to reserve (and importantly, not initialize!) 2 KiB of stack memory
when entering ThreadEventQueue::process().

This was causing any leftover pointers to GC-allocated objects within
that memory range to keep those objects alive, even when all other
references were gone.
2024-11-10 19:12:59 +01:00
Andreas Kling
11458f0d91 AK: Use getrlimit() to find the correct main thread stack size on macOS
This is what JavaScriptCore does as well.
2024-11-10 19:12:59 +01:00
Andreas Kling
1510c1876c WebContent: Try to run manual GC with less stuff on the stack
This makes it more likely to succeed in collecting stuff that's actually
dead, by reducing the memory range scanned for possible pointers.
2024-11-10 19:12:59 +01:00
Andreas Kling
08ae305dc5 UI/AppKit: Make "Dump GC Graph" menu action actually work again
This was originally implemented as a debug request, but later changed.
The Qt UI already did the right thing, so just copy the logic over.
2024-11-10 19:12:59 +01:00
Aliaksandr Kalenik
68f58b23ce LibWeb: Save Gfx::ImmutableBitmap in ApplyBitmapMask display list item
Some checks are pending
Lint Code / lint (push) Waiting to run
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
Push notes / build (push) Waiting to run
This allows to delete duplicated code between DisplayListPlayerSkia.cpp
and ImmutableBitmap.cpp responsible for wrapping Gfx::Bitmap in SkImage.
2024-11-10 17:20:34 +01:00
Shannon Booth
e02ca0480f LibJS: Allow unpaired surrogates in String.prototype.replace
This was resulting in a crash for the WPT test case:

https://wpt.live/xhr/send-data-string-invalid-unicode.any.html
2024-11-10 09:14:03 -05:00
Timothy Flynn
db47cc41f8 Everywhere: Move the Ladybird folder to UI 2024-11-10 12:50:45 +01:00
Timothy Flynn
93712b24bf Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
Timothy Flynn
950e819ee7 Everywhere: Hoist the Utilities folder to the top-level 2024-11-10 12:50:45 +01:00
Timothy Flynn
22e0eeada2 Everywhere: Hoist the Services folder to the top-level 2024-11-10 12:50:45 +01:00
Aliaksandr Kalenik
a7dc40eff3 LibWeb: Delete unused LineBoxFragment::absolute_rect()
Some checks are pending
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
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
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
2024-11-10 01:27:49 +01:00
Andreas Kling
72320be124 LibWeb: Stub out SVGGraphicsElement.getScreenCTM()
This allows us to run Speedometer 3.0 to completion. :^)
2024-11-10 00:35:32 +01:00
Cory Virok
39f844f77c LibWeb/Tests: Added example test for how to use http-test-server.py
The example shows how to write a test that depends on custom HTTP
headers in the response. This will be useful for testing browser JS
that depends on how Ladybird processes response headers, eg CORS
headers like Access-Control-Allow-Origin and others.
2024-11-09 13:08:31 -07:00
Andrew Kaster
3fdb2b081f Ladybird: Add a test fixture for the HTTP echo server 2024-11-09 13:08:31 -07:00
Andrew Kaster
ba78b294a0 Ladybird: Add ability to add test fixtures for LibWeb tests
This will be used to add test fixtures that use external
resources or require a specific setup.
2024-11-09 13:08:31 -07:00
Cory Virok
97d47a38c9 Meta: Add an HTTP echo server to help with testing Browser JS
This allows us to simulate HTTP responses from Browser JS tests.
Instead of using hacks like data URLs to "load" external data,
we can now generate an actual HTTP response that contains
arbitrary headers, body, and has a defined response delay.
2024-11-09 13:08:31 -07:00
Shannon Booth
e4891af970 LibJS: Implement Error.isError
Implementing the stage 2.7 proposal:

https://github.com/tc39/proposal-is-error
2024-11-09 13:04:54 -07:00
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