1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-08 05:27:14 +09:00
Commit graph

69603 commits

Author SHA1 Message Date
Sam Atkins
d9a8349d8c LibWeb/CSS: Parse font-variant and font-weight parts of font properly
These are not the same as parsing their properties, but are limited to a
small set of keywords each. The easiest way to handle these is parsing
them directly here.

Update some comments while I'm here.
2025-05-23 19:39:23 +01:00
Sam Atkins
8c78925dd3 LibWeb/CSS: When dumping CSS tokens, point at the next one
The meaning of m_index changed a while back and this never got updated.
Pointing at the value that was last consumed is confusing.
2025-05-23 19:39:23 +01:00
Timothy Flynn
fc54b9db46 Meta: Update sqlite3 to version 3.49.2 2025-05-23 18:10:51 +02:00
Timothy Flynn
51d189198d Meta: Update skia to version 134 2025-05-23 18:10:51 +02:00
Timothy Flynn
36040d1580 Meta: Update openssl to version 3.5.0 2025-05-23 18:10:51 +02:00
Timothy Flynn
152858fe7c Meta: Update libwebp to version 1.5.0 2025-05-23 18:10:51 +02:00
Timothy Flynn
40d3f925ba Meta: Update libavif to version 1.3.0 2025-05-23 18:10:51 +02:00
Timothy Flynn
b9cbd3436c Meta: Update libpng to version 1.6.47 2025-05-23 18:10:51 +02:00
Timothy Flynn
8232ae2bf3 Meta: Update fontconfig to version 2.15.0 2025-05-23 18:10:51 +02:00
Timothy Flynn
cb7dacc56a Meta: Update ffmpeg to version 7.1.1 2025-05-23 18:10:51 +02:00
Timothy Flynn
726ed55c3f Meta: Update vcpkg baseline 2025-05-23 18:10:51 +02:00
Shannon Booth
cdb249e058 LibWeb/HTML: Set a fetch client for javascript URL navigations
There is an open spec issue for this, and I'm certainly not sure
what the client should be here, but using the source snapshot
from the global from reading the spec issue seems like a reasonable
enough client for now.

This can be reproduced by performing a javascript URL navigation
with any CSP policy set. For simplicity, simply edit an existing
testcase to add such a policy.

Fixes: #4853
2025-05-23 16:39:13 +02:00
Luke Wilde
e364443e60 LibWeb: Support Content-Security-Policy http-equiv state on meta element 2025-05-23 16:39:13 +02:00
Andreas Kling
59e2416b61 LibWeb: Handle format(woff-variations) etc in @font-face src values
"format(woff-variations)" and pals are supposed to expand like so:
"format(woff) tech(variations)".

However, since we don't support tech() yet, this patch just adds a small
hack where we still treat "woff-variations" as "woff" so that fonts
load and get used, even if we don't make use of the variations yet.
2025-05-23 16:36:56 +02:00
Andreas Kling
2d064116ab Tests: Import a WPT test for @font-face format specifiers 2025-05-23 16:36:56 +02:00
Callum Law
9dfce6d14c Meta: Avoid doublequote strings nested in fstrings in ladybird.py
Double quote strings nested within double quoted-fstrings are invalid
syntax prior to Python 3.12 and was causing an error when running
ladybird.py
2025-05-23 10:27:34 -04:00
Aliaksandr Kalenik
bd6750aaa5 LibJS: Skip prototype chain lookup in internal_set() for arrays
...when Array.prototype and Object.prototype are intact.

If `internal_set()` is called on an array exotic object with a numeric
PropertyKey, and:
- the prototype chain has not been modified (i.e., there are no getters
  or setters for indexed properties), and
- the array is not the target of a Proxy object,

then we can directly store the value in the receiver's indexed
properties, without checking whether it already exists somewhere in the
prototype chain.

1.7x improvement on the following program:
```js
function f() {
    let a = [];
    let i = 0;
    while (i < 10_000_000) {
        a.push(i);
        i++;
    }
}

f();
```
2025-05-23 14:51:32 +02:00
Aliaksandr Kalenik
6404f6db57 LibJS: Delete unused Shape::create_for_prototype() 2025-05-23 14:51:32 +02:00
Callum Law
279913a223 LibWeb: Implement the translate attribute 2025-05-23 14:34:06 +02:00
devgianlu
4b3715ccba LibCrypto: Replace {Unsigned,Signed}BigInteger impl with LibTomMath
Replace the implementation of maths in `UnsignedBigInteger`
and `SignedBigInteger` with LibTomMath. This gives benefits in terms of
less code to maintain, correctness and speed.

These changes also remove now-unsued methods and improve the error
propagation for functions allocating lots of memory. Additionally, the
new implementation is always trimmed and won't have dangling zeros when
exporting it.
2025-05-23 11:57:21 +02:00
devgianlu
915c6fdcf8 LibCrypto: Add libtommath vcpkg dependency and link it
An overlay port is required to add the `stdc-iec-559` and `install-pc`
patches.

The `stdc-iec-559` patch is required because Clang doesn't define
`__STDC_IEC_559__`. However, glibc and musl define it if `__GCC_IEC_559`
is not defined. The macro is taken from glibc source code.

The `install-pc` patch is required because libtommath doesn't install
the pkg-config files when building statically compromising our ability
to find it during build.

Clang: https://clang.llvm.org/c_status.html#:~:text=Yes-,
IEC%2060559%20support,-Unknown
glibc: https://sourceware.org/git/?p=glibc.git;a=blob;
f=include/stdc-predef.h
2025-05-23 11:57:21 +02:00
devgianlu
5a4cfd05d0 LibCrypto+LibJS: Move Power to method of {Unsigned,Signed}BigInteger
Having it as a method instead of a free function is necessary for the
next commits and generally allows for optimizations that require deeper
access into the `UnsignedBigInteger` / `SignedBigInteger`.

Also restrict the exponent to 32 bits to avoid huge memory allocations.
2025-05-23 11:57:21 +02:00
devgianlu
a952d000be LibCrypto: Move GCD to method of UnsignedBigInteger
Having it as a method instead of a free function is necessary for the
next commits and generally allows for optimizations that require deeper
access into the `UnsignedBigInteger`.
2025-05-23 11:57:21 +02:00
Sam Atkins
e251b451ef LibWeb/CSS: Reject negative <resolution> values
Gets us 3 more WPT passes.
2025-05-23 10:17:58 +01:00
Sam Atkins
fb975cc156 LibWeb/CSS: Correct how we evaluate boolean media-features
The spec has a general rule for this, which is roughly that "If it's not
a falsey value, it's true". However, a couple of media-features are
always false, apparently breaking this rule. To handle that, we have an
array of false keywords in the JSON, instead of a single keyword. For
those always-false media-features, we can enter all their values into
this array.

Gets us 2 more WPT subtest passes.
2025-05-23 10:17:58 +01:00
Sam Atkins
00617884a6 LibWeb/CSS: Correct our scan media-feature
Despite what the spec suggests, modern displays are not progressive, and
WPT expects `@media (scan: progressive)` to fail. So, return `none`
here to accurately represent that.

I've left a FIXME in case we can detect the display type from the OS
somehow in the future.

Gets us 4 WPT subtest passes.
2025-05-23 10:17:58 +01:00
Sam Atkins
9fe8445946 LibWeb/CSS: Maintain original form of media-feature ranges
Previously, for `foo < 30px` ranges, we'd flip them and store them as
`30px > foo` instead. That worked fine, but means the serialization is
wrong. So instead, keep them in their original form.

I experimented with giving Range two optional sub-structs instead of 4
optional members, thinking it would be smaller - but it's actually
larger, because the two Optional<Comparison>s fit snugly together. So,
the slightly-goofy all-Optionals remains.

This gets us 2 WPT passes that I'm aware of.
2025-05-23 10:17:58 +01:00
Sam Atkins
9b8dc6b8d0 LibWeb/CSS: Parse media-feature values forgivingly
Instead of rejecting invalid media-feature values at parse time, we are
expected to parse them, and then treat them as Unknown when evaluating
their media query. To implement this, we first try to parse a valid
value as before. If that fails, or we have any trailing tokens that
could be part of a value, we then scoop up all the possible
ComponentValues and treat that as an "unknown"-type MediaFeatureValue.

This gets us 66 WPT passes.
2025-05-23 10:17:58 +01:00
Sam Atkins
72f50217b0 LibWeb/CSS: Implement device-aspect-ratio media feature
Gets us 8 WPT passes, and prevents a regression in the following commit.
2025-05-23 10:17:58 +01:00
Sam Atkins
b577302f07 LibWeb/CSS: Make media type and feature evaluation combination explicit
Functionally this is the same before, as result is always True or False
before this point, and `True && Foo` evaluates to `Foo`. But this is
more clearly correct, instead of correct by coincidence.
2025-05-23 10:17:58 +01:00
Sam Atkins
a4d3c62524 LibWeb/CSS: Return a MatchResult from MediaFeature::compare()
This commit on its own has no observable behaviour changes, as we still
only return True or False, but for the next commit, we'll need to be
able to return the Unknown state here, and without this change we'd get
regressions.
2025-05-23 10:17:58 +01:00
Sam Atkins
fe7bac73f0 LibWeb/CSS: Stub out a function for serializing ComponentValue sequences
This is very hacky and wrong, but it means there's one place to fix,
instead of one for UnresolvedStyleValue, and one for invalid
MediaFeatureValues which I'm about to implement.
2025-05-23 10:17:58 +01:00
Sam Atkins
987d510dbb LibWeb/CSS: Allow "picture-in-picture" in "display-mode" media feature
We don't implement detection for this yet, but it gets us a WPT pass.
2025-05-23 10:17:58 +01:00
Sam Atkins
38aca62ef5 LibWeb/CSS: Make media-type more permissive
The current spec defines this simply as `<ident>`, but does apparently
serialize as lowercase.

Because of this change, we no longer need to care about the deprecated
media types, as they all behave the same as unknown ones.

We still keep an enum around for KnownMediaType, to avoid repeated
string comparisons when evaluating it.

Gets us 2 WPT passes.
2025-05-23 10:17:58 +01:00
Sam Atkins
bb035fbfe0 Tests: Import a whole bunch of WPT mediaqueries tests
A lot of these are ref-tests, so I'm skipping the failing ones for now,
and will make as many pass as possible in subsequent commits.
2025-05-23 10:17:58 +01:00
Aziz Berkay Yesilyurt
6711438e0d LibWeb: Ensure anonymous wrappers inherit inline-block display
When restructuring a block node inside an inline parent, if the
nearest block ancestor is `display: inline-block`, ensure that
the generated anonymous wrappers also have `display: inline-block`.
This fixes layout issues with block elements nested
inside inline-block elements.
2025-05-23 11:16:06 +02:00
Ruben
09f5ce42f6 LibWeb: Ensure floats are correctly placed under the preceding float
Previously floats would be placed next to the highest float that
fitted the new float on its line. However, this violates the rule
that floats should be placed under the preceding float if it does
not fit next to it.
2025-05-23 10:58:15 +02:00
Shannon Booth
3bf7f94150 LibJS: Use caller_context to determine strict mode
This is functionaly the same since caller_context is the topmost
execution context on the stack, but makes it more clear that
we are directly inheriting the strict mode from the caller context
when pushing the next context on to the stack.
2025-05-23 03:25:55 +02:00
Shannon Booth
7d44640c0f LibJS: Assume is_strict_mode called with running execution context
This should always be invoked when there is an execution context
on the stack.
2025-05-23 03:25:55 +02:00
Shannon Booth
f2fb86abea LibJS: Always emit value in emit_named_evaluation_if_anonymous_function
There does not appear to be any case that we need to return an
OptionalNone{}.
2025-05-23 03:25:55 +02:00
Shannon Booth
20dba8f1ab LibJS: Make Op::Return value required
It turns out we do not have any scenario where this is not provided.
2025-05-23 03:25:55 +02:00
Timothy Flynn
17364c6d36 Tests: Disable XMLHttpRequest-override-mimetype-blob.html for now
It is extremely slow on macOS.
2025-05-22 18:40:25 -04:00
ayeteadoe
fdd3f35b61 Meta: Localize resource module import to fix ladybird.py on Windows 2025-05-22 17:48:03 -04:00
Timothy Flynn
4c8b5ba9de Tests/LibWeb: Add a screenshot test for acid2
This test has flaked over the years, so let's add a screenshot test to
catch future regressions.

This copy of the test was taken from:
https://www.webstandards.org/files/acid2/test.html#top

Our CI infra does not support navigating to the "#top" anchor out of the
gate. So the intro section was removed from this copy so that we render
the happy face immediately.
2025-05-22 17:44:40 -04:00
Timothy Flynn
8b787020a2 LibWeb: Delay the document load event while re-fetching <object> images
We are required to delay the load event while any fetch is ongoing. We
currently have a very hacky re-fetch for images to go through the shared
resource request infrastructure. We must delay the load event during
this re-fetch.

This becomes an issue in an upcoming commit to import the acid2 test.
2025-05-22 17:44:40 -04:00
Timothy Flynn
1bc7a52587 LibWeb: Keep delaying the load event on concurrent <object> tasks
If we queue the <object> representation task multiple times in a row, we
would end up clearing the delayer after the first task completed. We
must continue delaying the load event until the last task completes.

This becomes an issue in an upcoming commit to import the acid2 test.
2025-05-22 17:44:40 -04:00
Timothy Flynn
874e094ed8 LibWeb: Allow moving document load event delayers
This allows us to store lists of delayers.
2025-05-22 17:44:40 -04:00
Lion Kortlepel
900500c0b3 LibWeb: Remove obsolete font-style Keyword handling
`Parser::parse_font_style_value()` only produces
FontStyleStyleValues now, so we no longer need this
branch.
2025-05-22 17:39:05 +01:00
Lion Kortlepel
b1ee539e9d LibWeb: Fix font-style to slope conversion
In a recent refactor of font styles, the new FontStyleStyleValue was
introduced; however, the `to_font_slope()` function was not changed to
understand this new type. When it tries to convert such a font style to
a keyword, it fails. We then rendered the wrong font-style.
2025-05-22 17:39:05 +01:00
Timothy Flynn
d00d49ba2f Meta+Toolchain: Extract BuildVcpkg to an importable function
This lets ladybird.py import it properly, instead of invoking BuildVcpkg
main().
2025-05-22 12:21:24 -04:00