Commit graph

68626 commits

Author SHA1 Message Date
Andreas Kling
414e0cc930 LibWeb: Use optimized invalidation for focus-related pseudo classes 2025-04-17 19:45:55 +02:00
Andreas Kling
e1777f6e79 LibWeb: Make :hover invalidation logic reusable for all pseudo classes
We achieve this by keeping track of all checked pseudo class selectors
in the SelectorEngine code. We also give StyleComputer per-pseudo-class
rule caches.
2025-04-17 19:45:55 +02:00
Andreas Kling
ed35f9e7c2 LibWeb: Remove unused MatchingRule::must_be_hovered flag
This was a vestige from an earlier version of hover selector work
avoidance optimizations.
2025-04-17 19:45:55 +02:00
Timothy Flynn
60f667fc5a LibWeb: Use (de)serialization with transfer AOs for structured cloning
This is important, for example, to detach transferred array buffers.
2025-04-17 12:13:13 -04:00
Timothy Flynn
5eab109d85 LibWeb: Update structured deserialization to accept its target realm
This is a formal parameter to this AO in the spec.
2025-04-17 12:13:13 -04:00
Timothy Flynn
0c309d4660 LibWeb: Import detached ReadableStream buffer tests 2025-04-17 12:13:13 -04:00
Timothy Flynn
cef714732e Documentation: Remove now-obsolete patch from Servo's DevTools parser
They have fixed the exception mentioned here, but the script still has
trouble displaying all live-captured packets.
2025-04-17 12:12:50 -04:00
Timothy Flynn
83b6803b32 Documentation: Expand DevTools notes on creating a new Firefox profile
Add a command to create a new Firefox profile, and add `--new-instance`
to the command line when using it.
2025-04-17 12:12:50 -04:00
Vishal Biswas
eb165554e1 LibWeb: Use double type in ProgressEvent
loaded and total should be double as per spec
https://xhr.spec.whatwg.org/#progressevent
2025-04-17 08:28:47 -04:00
Vishal Biswas
d56f6805d3 LibWeb: Mimic if-condition from spec
https://xhr.spec.whatwg.org/#dom-xmlhttprequest-abort
2025-04-17 08:28:47 -04:00
Timothy Flynn
5e9a11b13d LibWebView: Respect autocomplete response Content-Encoding headers
For example, Google uses ISO-8859-1 encoding. This patch allows us to
decode such responses, falling back to UTF-8 if a Content-Type was not
specified or could not be parsed. We should also now handle if decoding
fails, rather than crashing inside JsonParser.
2025-04-17 07:51:43 -04:00
Tim Ledbetter
ca200142e9 LibWeb: Don't construct stylesheet when modifying CSSStyleSheet rules
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, 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
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Previously, `CSSStyleSheet.replace()` and `CSSStyleSheet.replaceSync()`
parsed the given CSS text into a temporary stylesheet object, from
which a list of rules was extracted. Doing this had the unintended
side-effect that a fetch request would be started if the given CSS text
referenced any external resources. This fetch request would cause a
crash, since the temporary stylesheet object didn't set the constructed
flag, or constructor document. We now parse the given CSS text as a
list of rules without constructing a temporary stylesheet.
2025-04-16 22:03:12 +01:00
Timothy Flynn
955f6fc9cb LibWeb: Fulfill TransformStream promises with the correct "reason"
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, 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
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
We need to use the reason provided to the abort algorithm, not the one
from the resolved cancel promise (which will be undefined).
2025-04-16 13:15:33 -04:00
Timothy Flynn
f6438e83b8 LibWeb: Import TransformStreams reentrant strategies tests 2025-04-16 13:15:33 -04:00
Timothy Flynn
1673f6783c LibWeb: Import TransformStream error tests 2025-04-16 13:15:33 -04:00
Andrew Kaster
ad00306daf AK: Disallow constness laundering in RefPtr and NonnullRefPtr
This is a re-application of 3c7a0ef1ac

Co-Authored-By: Andreas Kling <andreas@ladybird.org>
2025-04-16 10:41:44 -06:00
Andrew Kaster
5e1b3cdeb9 LibGfx: Pass MetalContext in an NNRP in SkiaBackendContext
Previously we were move()-ing an lvalue reference, which causes
issues with upcoming RefPtr const correctness changes.
2025-04-16 10:41:44 -06:00
Andrew Kaster
02afbf3285 WebDriver: Access global sessions mutably when finding sessions
We grab RefPtr to non-const for the sessions within, so we can't call
const get() on the global maps. That would return a const reference.
2025-04-16 10:41:44 -06:00
Andrew Kaster
ea68944149 LibWeb: Store LibGfx objects in RefPtr to const for draw commands 2025-04-16 10:41:44 -06:00
Andrew Kaster
c36c7ed67b LibWeb: Launder const in CSS::Selector::absolutized when returning self
This const method tries to return a RefPtr to non-const self. That's
not kosher, but fixing it needs some architecture work.
2025-04-16 10:41:44 -06:00
Andrew Kaster
16e764ddb6 LibWasm: Store function references' source module in RefPtr to const 2025-04-16 10:41:44 -06:00
Andrew Kaster
c471faee10 LibJS: Launder const in the parser where required with strict RefPtrs
These places should be updated to not require this hackery, but pulling
on this thread involves touching almost every method in the parser.
2025-04-16 10:41:44 -06:00
Andrew Kaster
59b1fb23a9 LibJS: Remove unused InstructionStreamIterator::source_code getter 2025-04-16 10:41:44 -06:00
Andrew Kaster
703abac9c8 AK: Add const_cast escape hatch for converting const T& to RefPtr<T>
There are parts of the codebase where properly const-correctifying the
the code would be a giant spaghetti mess, so add this loud workaround
to defer the refactoring for later.
2025-04-16 10:41:44 -06:00
Andrew Kaster
6ff0373556 UI: Pass parent WebView by non-const ref when creating children
We need to call non-const methods on this guy and access its members in
a non-const way.
2025-04-16 10:41:44 -06:00
Andrew Kaster
5c4b65996e UI/Qt: Store TVG Image Data in a RefPtr to const
We don't need to mutate this data after it's loaded.
2025-04-16 10:41:44 -06:00
Andrew Kaster
4b7f4aef10 LibWeb: Pass RefPtr to const to ClippableAndScrollable setters
We were already storing the ClipFrame and ScrollFrame in RefPtr to const
but we were passing them as RefPtr to non-const to the setters.
2025-04-16 10:41:44 -06:00
Andrew Kaster
280ae45210 LibWeb: Pass ImageData as non-const to CanvasImageData mixin methods
CRC2D needs to manipulate the ImageData object in put_image_data()
2025-04-16 10:41:44 -06:00
Andrew Kaster
91b549f797 LibGfx+LibWebView+UI: Store Gfx::Bitmap in RefPtr to const 2025-04-16 10:41:44 -06:00
Andrew Kaster
be2dd91289 LibGfx+LibWeb: Store Typeface and Font-related types in RefPtr to const 2025-04-16 10:41:44 -06:00
Andrew Kaster
ffd0259bef LibGfx: Store Core::Resources in RefPtr to const 2025-04-16 10:41:44 -06:00
Andrew Kaster
d1f6f5649e LibWeb: Make storage of CSS::CalculationNodes const-correct
Now we consistently use `RefPtr<CalculationNode const>` for all
CalculationNodes.
2025-04-16 10:41:44 -06:00
Andrew Kaster
6d11414957 LibWeb: Make storage of CSS::StyleValues const-correct
Now we consistently use `RefPtr<StyleValue const>` for all StyleValues.
2025-04-16 10:41:44 -06:00
Timothy Flynn
3fdad8fe22 LibWeb: Update spec steps for closing TransformStreams
This was actually an older change to the Streams spec that we missed
when we implemented TransformStreams. This fixes a crash in the imported
WPT tests.

See: https://github.com/whatwg/streams/commit/007d729
2025-04-16 11:39:25 -04:00
Andrew Kaster
8cfac6ed71 LibWeb: Store a SpeculativeHTMLParser on the HTML Parser
The parser was previously added, but unused. Actually attaching one to
the HTML Parser will let us test the limits of Swift interop.
2025-04-16 09:02:27 -06:00
Andrew Kaster
3c45d155a6 CI: Bump swiftly toolchain version to main-snapshot-2025-04-12
The latest snapshot includes some bug fixes that are required in order
to include LibWeb-Swift.h in our C++ files.
2025-04-16 09:02:27 -06:00
Gingeh
bbf4f546af LibWeb: Only create backdrop when originating element is invalidated 2025-04-16 09:01:08 -06:00
Timothy Flynn
6dd2a4c945 LibWeb: Do not create a RootVector to invoke IDL callbacks
These callbacks are evaluated synchronously via JS::Call. We do not need
to construct an expensive RootVector container just to immediately
invoke the callbacks.

Stylistically, this also helps indicate where the actual arguments start
at the call sites, by wrapping the arguments in braces.
2025-04-16 07:32:02 -04:00
Andreas Kling
ca2f0141f6 LibRegex: Remove unused "simple substring search" optimization
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, 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
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
This is not relevant for LibJS since it only works when the input is
UTF-8, and LibJS always provides UTF-16.
2025-04-16 10:04:50 +02:00
Andreas Kling
0c93a07fb1 AK: Shrink Utf16View
Use a sentinel value instead of Optional for the cached length in code
points, shrinking Utf16View from 32 to 24 bytes.
2025-04-16 10:04:50 +02:00
Andreas Kling
7628ddfaf7 AK: Remove endianness override from Utf16View
Utf16View is now always in "host" endian mode. This makes it smaller
and less branchy for everyone!
2025-04-16 10:04:50 +02:00
Andreas Kling
0e9480b944 AK+LibTextCodec: Stop using Utf16View endianness override
This is preparation for removing the endianness override, since it was
only used by a single client: LibTextCodec.

While here, add helpers and make use of simdutf for fast conversion.
2025-04-16 10:04:50 +02:00
Andreas Kling
96f1f15ad6 LibRegex: Remove unused Utf8View/Utf32View support in RegexStringView 2025-04-16 10:04:50 +02:00
Timothy Flynn
b1a189acfa LibWeb: Use WebIDL::invoke_promise_callback in Streams where appropriate
Some checks are pending
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, 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
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
This avoids an issue where rejected JS::Promise types were converted to
a resolved WebIDL::Promise type.
2025-04-15 20:33:30 -04:00
Timothy Flynn
525343ba79 LibWeb: Add an alternative to WebIDL::invoke_callback to return promises
When we need the callback to return a promise, we can use this alternate
invoker to construct the WebIDL::Promise for us. Currently, the Streams
API will use WebIDL::invoke_callback to create a JS::Promise, and then
wrap that result in a resolved WebIDL::Promise. This results in rejected
JS::Promise instances not being propagated.
2025-04-15 20:33:30 -04:00
Timothy Flynn
b324b876f2 LibWeb: Import ReadableStreamTee tests 2025-04-15 20:33:30 -04:00
Timothy Flynn
df1e51b80b LibWeb: Use the correct realm when initializing streams
There is an open issue to clarify exactly what realm is to be used when
creating promises. There are surely many more places we will need to
update to use the correct realm (which will be the realm of `this`'s
relevant global object).
2025-04-15 20:33:11 -04:00
Timothy Flynn
1abf5ce843 LibWeb: Import ReadableStream global tests 2025-04-15 20:33:11 -04:00
Sam Atkins
9f333c424c LibWeb/CSS: Ensure a font source format() only contains one string/ident 2025-04-15 21:40:41 +02:00
Sam Atkins
52a4259ef2 LibWeb/CSS: Make @font-face src parsing more forgiving
As noted in the spec, an invalid (or unsupported) font source should not
make the `src` declaration invalid.
2025-04-15 21:40:41 +02:00