Commit graph

64568 commits

Author SHA1 Message Date
Andreas Kling
037c034468 Tests: Remove an imported WPT test we can't run without WebDriver
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, 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
We can bring this back if we gain the necessary faculties later.
2024-10-27 18:40:20 +01:00
Andreas Kling
6c75a93ec0 LibWeb: Fix select element state update in three ways
1. We were not propagating selectedness updates from option to select
   if the option was inside an optgroup.

2. When two or more options were selected, we were always favoring the
   last one in tree order, instead of the last one that got checked.

3. We were neglecting to return in the `display size is 1` case when
   all elements were disabled.

This was covered by some of the :has() selector tests. :^)
2024-10-27 18:40:20 +01:00
Andreas Kling
6dad8ea584 LibWeb: Move pessimistic :has() invalidation hack to invalidate_style()
We basically need to do this for every invocation of invalidate_style()
right now, so let's just do it inside invalidate_style() itself.

Fixes one missing invalidation issue caught by a WPT test. :^)
2024-10-27 18:40:20 +01:00
Jonne Ransijn
22a66bb1c2 AK: Pass (Deprecated)FlyString::is_one_of arguments by reference
This avoid unnecessairy reference counting.
2024-10-27 12:03:04 -04:00
Jonne Ransijn
7f3269fb02 AK: Add ASCII fast path for Utf8View::contains
This also makes `Utf8View::trim` significantly faster, since most
strings start and end with ASCII.
2024-10-27 16:13:36 +01:00
Kostya Farber
b953b5cc71 Documentation: Change in name from Serenity to Ladybird
Probably a remnant from Ladybird being in Serenity :^).
2024-10-27 14:33:24 +01:00
Andreas Kling
85bf1d6033 Meta: Ignore LibWeb text tests for newline-at-eof check 2024-10-27 13:33:46 +01:00
Andreas Kling
a640fcc693 LibWeb: Import a bunch of :has() selector tests from WPT 2024-10-27 13:33:46 +01:00
Andreas Kling
9e080e197c LibWeb: Make :has() actually work for non-descendant relative selectors
The traversal for these was incorrect and awkward. Now it's less
incorrect but still very awkward. We should find better ways to
implement this, but for now this at least passes many more WPT tests.
2024-10-27 13:33:46 +01:00
Andreas Kling
f24b91b01e LibWeb: Invalidate whole document style on attr change if :has() present
This sucks, and we're gonna have to do better, but for now let's
invalidate the whole document's style, so that we get correct behavior
if there are :has() selectors present.
2024-10-27 13:33:46 +01:00
Andreas Kling
690d9c8752 LibWeb: Be more thorough when marking selectors as "contains :has()"
We were missing this flag on a lot of selectors, which led to
insufficient invalidation in some cases.
2024-10-27 13:33:46 +01:00
Jonne Ransijn
07cd7d479f LibWeb: Remove reference counting for CSS::StyleProperties
`AK::CopyOnWrite` already does reference counting, so there is no need
to do it again.
2024-10-27 13:26:30 +01:00
Jonne Ransijn
e636f3976d AK: Fix ambiguity in AK::Optional specialization
The specialization for the destructor of `AK::Optional` is ambiguous
when `T` is neither TriviallyDestructible nor Destructible.
The fix adds an additional check for `Destructible` when generating the
destructor of `AK::Optional`, since it calls the destructor of `T`, and
therefore already required `T` to be `Destructible` anyway.
2024-10-27 13:26:30 +01:00
Jonne Ransijn
e76064e67f AK: Allow Optional<T&> to be constructed from Optional<T>&
Attempting this resulted in an error because the `m_pointer` field does
not exist on `Optional<T>`. Creating a shared `ptr()` function and
adding the necessairy overloads solves this issue.
2024-10-27 13:26:30 +01:00
Andreas Kling
be03002780 Headless: Allow overriding the test timeout with a CLI parameter
Also bump the test timeout when running ctest to 120 seconds,
to accommodate the slow GCC CI.
2024-10-27 12:10:28 +01:00
Andreas Kling
ec0838b84e LibWeb: Implement HTMLElement.innerText closer to spec
And here's the wild part: instead of cloning WPT tests, import the
relevant WPT tests that this fixes into our own test suite.

This works by adding a small Ladybird-specific callback in
resources/testharnessreport.js (which is what that file is meant for!)

Note that these run as text tests, and so they must signal the runner
when they are done. Tests using the "usual" WPT harness should just
work, but tests that do something more freestyle will need manual
signaling if they are to be imported.

I've also increased the test timeout here from 30 to 60 seconds,
to accommodate the larger WPT-style tests.
2024-10-27 12:10:28 +01:00
Jonne Ransijn
afe74afa9e LibWeb/Fetch: Do not clone stored responses
Some checks are pending
Push notes / build (push) Waiting to run
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, 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
Reading the RFC9111 spec makes it clear that the stored response was
not intended to be cloned. This is because there is a "clone response"
operation that is used in other places, but never for stored responses.
2024-10-27 11:28:37 +01:00
Jonne Ransijn
c7a51ed297 LibWeb/Fetch: Update cached responses when revalidating
Responses returned from `http_network_or_cache_fetch` were copied
directly from the cache, which is incorrect, since revalidation may
later modify the response, or even invalidate it, such as when the
`Access-Control-Allow-Origin` header is changed.

This fixes WPT test [wpt/cors/304.htm](http://wpt.live/cors/304.htm)
2024-10-27 11:28:37 +01:00
stelar7
96c053b36e LibCrypto: Remove some debug spam from RSA generation 2024-10-27 11:26:12 +01:00
stelar7
37f2818e90 LibWeb: Fix modulus length being wrong for RSA-OAEP key import 2024-10-27 11:26:12 +01:00
stelar7
23fc04d264 LibWeb: Implement RSAOAEP.decrypt() 2024-10-27 11:26:12 +01:00
stelar7
378808f6ba LibCrypto: Implement OAEP decode from newer spec 2024-10-27 11:26:12 +01:00
stelar7
3b423f1852 LibWeb: Add and use new name() helper on HashAlgorithmIdentifier 2024-10-27 11:26:12 +01:00
stelar7
48bd094712 LibWeb: Implement RSAOAEP.encrypt() 2024-10-27 11:26:12 +01:00
stelar7
6fc268f588 LibCrypto: Implement OAEP encode from newer spec 2024-10-27 11:26:12 +01:00
stelar7
b2b500ba82 LibCrypto: Extend OAEP test with RSA example 2024-10-27 11:26:12 +01:00
Kostya Farber
2dc788df00 LibWeb: Bring tab-size closer to the spec
When the css tab-size property is a number, we need to add
the associated letter-spacing and word-spacing to it's width.
2024-10-27 11:03:35 +01:00
Magnus Johansson
c6f77f4818 LibWeb: Fallback to auto when aspect ratio is degenerate as per spec
When aspect-ratio is degenerate (e.g. 0/1 or 1/0) we should
fallback to the same behaviour as `aspect-ratio: auto` according to spec
This commit explicitly handles this case and fixes five WPT test in
css/css-sizing/aspect-ratio (zero-or-infinity-[006-010])
2024-10-27 10:56:17 +01:00
Chase Knowlden
20376adbc3 LibWeb/HTML: Start implementing the download attribute 2024-10-27 10:23:45 +01:00
Ankush Chatterjee
85356094b5 LibWeb/CSS: Add math expression support for transform-origin 2024-10-27 10:21:22 +01:00
Lucas CHOLLET
3406b69614 LibGfx+LibWeb/CSS: Add support for the lab() color function
The support in LibWeb is quite easy as the previous commits introduced
helpers to support lab-like colors.

Now for the methods in Color:
 - The formulas in `from_lab()` are derived from the CIEXYZ to CIELAB
   formulas the "Colorimetry" paper published by the CIE.
 - The conversion in `from_xyz50()` can be decomposed in multiple steps
   XYZ D50 -> XYZ D65 -> Linear sRGB -> sRGB. The two first conversion
   are done with a singular matrix operation. This matrix was generated
   with a Python script [1].

This commit makes us pass all the `css/css-color/lab-00*.html` WPT
tests (0 to 7 at the time of writing).

[1] Python script used to generate the XYZ D50 -> Linear sRGB
conversion:

```python
import numpy as np

# http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html
# First let's convert from D50 to D65 using the Bradford method.
m_a = np.array([
    [0.8951000, 0.2664000, -0.1614000],
    [-0.7502000, 1.7135000, 0.0367000],
    [0.0389000, -0.0685000, 1.0296000]
])

# D50
chromaticities_source = np.array([0.96422, 1, 0.82521])
# D65
chromaticities_destination = np.array([0.9505, 1, 1.0890])

cone_response_source = m_a @ chromaticities_source
cone_response_destination = m_a @ chromaticities_destination

cone_response_ratio = cone_response_destination / cone_response_source
m = np.linalg.inv(m_a) @ np.diagflat(cone_response_ratio) @ m_a

D50_to_D65 = m

# https://en.wikipedia.org/wiki/SRGB#From_CIE_XYZ_to_sRGB
# Then, the matrix to convert to linear sRGB.
xyz_65_to_srgb = np.array([
    [3.2406, - 1.5372, - 0.4986],
    [-0.9689, + 1.8758, 0.0415],
    [0.0557, - 0.2040, 1.0570]
])

# Finally, let's retrieve the final transformation.
xyz_50_to_srgb = xyz_65_to_srgb @ D50_to_D65

print(xyz_50_to_srgb)
```
2024-10-27 10:20:03 +01:00
Lucas CHOLLET
8efa046e0c LibWeb/CSS: Make CSSOKLab inherit from a new CSSLabLike class
This class provides the common base for both CSSOKLab and the future
CSSLab classes.
2024-10-27 10:20:03 +01:00
Lucas CHOLLET
707bcaf604 LibWeb/CSS: Extract code to parse a lab-like color value
This is currently only used for `oklab()` but will soon be also used for
`lab()` as well.
2024-10-27 10:20:03 +01:00
Simek
c9c67a6f24 LibWeb: Correct default ARIA Roles for few tags 2024-10-27 10:17:12 +01:00
Jonne Ransijn
551b72b018 Documentation: Add one more option for getting started
Using a profiler is another great way to find issues
2024-10-27 09:43:04 +01:00
Jonne Ransijn
8409178a11 LibWeb: Return Web::CSS::Selector::pseudo_element by reference
This avoids many allocations and deallocations.
2024-10-27 09:33:17 +01:00
Shannon Booth
5d7a7a43c4 LibWeb: Add temp execution context for resolving promise in AudioContext
Fixes a crash seen on twitter.com, namely from the 'resume' function.
2024-10-27 08:10:11 +01:00
Timothy Flynn
6cd224bb88 Meta: Use release builds as the basis for Sanitizer builds
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, 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
LLVM recommends compiling with at least -O1 to have decent performance
with sanitizers enabled. Indeed, this improves CI performance of LibWeb
tests as follows:

    GCC on Linux:   160.61s to 119.68s (40.93s faster)
    Clang on Linux:  65.56s to  55.64s ( 9.92s faster)
2024-10-26 22:58:40 +02:00
Ben Wiederhake
ff3d78f369 LibWeb: Integration test for WebCrypto AES-CBC
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, 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
2024-10-26 17:50:22 +02:00
Ben Wiederhake
b1056121f2 LibWeb: Implement WebCrypto AES-CBC decrypt operation
This lets us pass an additional (roughly) 15 WPT tests:
WebCryptoAPI/encrypt_decrypt/aes_cbc.https.any
2024-10-26 17:50:22 +02:00
Ben Wiederhake
eb193251b8 LibWeb: Implement WebCrypto AES-CBC encrypt operation
This lets us pass an additional (roughly) 20 WPT tests:
WebCryptoAPI/encrypt_decrypt/aes_cbc.https.any
2024-10-26 17:50:22 +02:00
Ben Wiederhake
d86dcac4f7 LibWeb: Implement WebCrypto AES-CBC generateKey operation
This is progress towards passing more WPT tests, although none of them
gets green due to this commit.
2024-10-26 17:50:22 +02:00
Ben Wiederhake
9255a1ac2e LibWeb: Implement WebCrypto AES-CBC exportKey operation
This lets us pass an additional (roughly) 40 WPT tests:
WebCryptoAPI/import_export/symmetric_importKey.https.any
2024-10-26 17:50:22 +02:00
Ben Wiederhake
6f88376e24 LibWeb: Implement WebCrypto AES-CBC importKey operation
This alone lets us pass around 40 WPT tests:
WebCryptoAPI/import_export/symmetric_importKey.https.any
2024-10-26 17:50:22 +02:00
Ben Wiederhake
92d4cb7b09 LibCrypto: Fix and test CBC with CMS and ZeroLen padding 2024-10-26 17:50:22 +02:00
Kostya Farber
3e7faae647 Qt: Add box icon to line box debug menu action 2024-10-26 17:41:16 +02:00
Jonne Ransijn
6e86ad65e9 LibGfx: Use FlyString for family name
This value gets converted to FlyString a lot, so let's just make it
a FlyString in the first place!
2024-10-26 17:40:56 +02:00
samu698
7865fbfe6d LibJS: Don't generate useless jumps for if statement
If statements without an else clause generated jumps to the next
instruction, this commit fixes the if statement generation so that it
dosen't produce them anymore.

This is an example of JS code that generates the useless jumps
(a => if(a){}) ();
2024-10-26 17:39:37 +02:00
Andreas Kling
257ebea364 LibJS: Store RegExp flags as a bitmask
This avoids having to do O(n) contains() in the various flag accessors.

Yields a ~20% speed-up on the following microbenchmark:

    const re = /foo/dgimsvy;
    for (let i = 0; i < 1_000_000; ++i)
        re.flags;
2024-10-26 15:42:57 +02:00
sideshowbarker
6b82ab06fd Meta: Make WPT.sh echo the “wpt run” invocation
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, 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
To help people in troubleshooting problems when running the WPT.sh
script, this change makes the script echo to stdout the complete
“wpt run” invocation (including all the flags and path args).
2024-10-26 11:27:33 +02:00