Commit graph

72984 commits

Author SHA1 Message Date
Zaggy1024
0f6f5cd353 LibMedia+Tests: Clear the current block when seeking in MatroskaDemuxer
Otherwise, if the sample iterator resides in a block with multiple
frames before the seek, the demuxer will output all the remaining
frames from that block before moving on to the block at the seeked
position.
2025-11-13 13:48:17 +01:00
Callum Law
d6bb247bf7 LibWeb: Reject non-exclusive none in text-decoration-line
This updates the `parse_text_decoration_line_value` to reject values
which non-exclusively include `none` e.g. `underline none`.

It also simplifies handling by always producing a Vector (except for
`none`) and adding VERIFY_NOT_REACHED in more places which shouldn't be
reachable.
2025-11-13 10:15:02 +01:00
Timothy Flynn
5c0fdd371a LibJS: Mark invocation to ParseMonthCode as infallible
This is an editorial change in the Temporal proposal. See:
c1f7bd5

Note the related assertion here was a bit silly. It was effectively:

    if (!cond) { return; }
    VERIFY(cond);
2025-11-12 16:20:04 -05:00
Timothy Flynn
041c4f4c79 LibJS: Remove unnecessary Temporal month code check
This is an editorial change in the Temporal proposal. See:
9110854

This change actually exposed a bug in our validator for month codes
(which is only used by this same function). We would previously allow
"M00" as a month code, which is invalid (it must be "M00L").
2025-11-12 16:20:04 -05:00
Timothy Flynn
bf3481b301 LibJS: Explicitly state integer limits for UTC offset minutes and ns
This is an editorial change in the Temporal proposal. See:
1fdf09a

Note that the integer limits in the above commit are in spec headers,
which we don't copy to our implementation.
2025-11-12 16:20:04 -05:00
Timothy Flynn
462e7b0c87 LibJS: Introduce Time Zone Identifier Parse Records to Temporal
This is an editorial change in the Temporal proposal. See:
96bb9b0

Note that we already had a struct for this, but now that it has a proper
name and spec link, this renames it to match other Parse Records and
places it alongside them.
2025-11-12 16:20:04 -05:00
Zaggy1024
ae73280178 AK+Tests: Add a formatter for Duration
This will format Duration as seconds, with as much decimal precision as
necessary to fully represent its value. The alternate format specifier
can be used to make it print the units on the end, i.e. "1.23s".
2025-11-12 14:41:46 -06:00
Zaggy1024
c8958c9e7b AK: Simplify calculation of the right padding when formatting u64 2025-11-12 14:41:46 -06:00
Psychpsyo
d284b4c2b8 LibWeb: Clamp any values less than 1 in perspective() transform function 2025-11-12 18:45:09 +01:00
Timothy Flynn
0cb9f4b66f LibWeb: Do not fetch empty CSS URLs
If a CSS rule has a URL like `url("")`, it would resolve to the document
URL itself. There isn't a context in which this would result in a valid
resource, so the spec tells us to drop it.

No test here because there isn't really a way to know when a CSS URL is
fetched. We could use PerformanceResourceTiming, but that is only for
HTTP(S) URLs. There is already an existing test for serialization of
empty URLs, which still passes.
2025-11-12 18:30:16 +01:00
Timothy Flynn
d8ec204be8 LibWeb: Do not return an exception from fetching CSS resources
The exception returned here is never used or logged. Let's just return
a null request, to make it clearer that these are not exceptions shown
to the user (thus not observable).
2025-11-12 18:30:16 +01:00
Jelle Raaijmakers
2811c75031 LibWeb: Use anti-aliasing to draw images and painting surfaces
Fixes the jagged edges on the transformed badge on
https://aaronfrancis.com/backstage.
2025-11-12 17:43:02 +01:00
Jelle Raaijmakers
489dea58ba LibWeb: Make all clip rects anti-aliased
This fixes aliased edges when e.g. applying rotation transforms to
certain shapes or SVGs. Although the clip rects themselves are
rectangular, a non-identity matrix transform can be active for the
canvas.

Fixes #5909.
2025-11-12 17:43:02 +01:00
Jelle Raaijmakers
b9244903fc LibWeb: Undo ScalingMode::None for identical bitmap sizes
We always want to return the mapped scaling mode here, since the bitmap
might end up transformed, scaled, etc. and we do not want to fall back
to nearest neighbour in those cases.
2025-11-12 17:43:02 +01:00
Jelle Raaijmakers
d352c4673c LibWeb: Pass sizes instead of rects to to_gfx_scaling_mode()
Position is irrelevant when determining the right scaling mode. No
functional changes.
2025-11-12 15:59:01 +01:00
Jelle Raaijmakers
3f6cbeb87e LibGfx+LibWeb: Use mipmaps for downscaling images
This changes Gfx::ScalingMode to reflect the three modes of scaling we
support using Skia, which makes it a bit easier to reason about the mode
to select. New is ::BilinearMipmap, which uses linear interpolation
between mipmap levels to produce higher quality downscaled images.

The cubic resampling options Mitchell and its sibling CatmullRom both
produced weird artifacts or resulted in a worse quality than
BilinearMipmap when downscaling. We might not have been using these
correctly, but the new ::BilinearMipmap method seems to mirror what
Chrome uses for downscaled images.
2025-11-12 15:59:01 +01:00
Jelle Raaijmakers
7544066c0c LibWeb: Scale blur filter's radius by device pixel scale
The blur filter's effect was reduced on higher DPI displays.
2025-11-12 15:59:01 +01:00
Psychpsyo
e064fa19d2 LibWeb: Add transform-style and have it make a stacking context 2025-11-12 15:47:36 +01:00
Timothy Flynn
c80b698589 LibWebView+UI: Remove some now-superfluous debug menu items
No need to keep these actions around, users can use the about:settings
page instead.
2025-11-12 09:06:21 -05:00
Timothy Flynn
c34119cb29 LibWebView: Add a settings section to manage browsing data caches
This adds a section to allow users to clear the HTTP disk cache and
cookies / local storage / session storage. There are a few options to
limit this action to a specific time range (e.g. "last hour"). The
user is informed how much disk space is being used currently, and how
much will be removed given the selected time range.

The idea is that in the future, we can add more settings here to auto-
delete data on exit, disable caching altogether, etc.
2025-11-12 09:06:21 -05:00
Timothy Flynn
48aa16d74b LibWebView: Add methods to remove cookies / WebStorage items
This allows removing cookies and local/session storage items last
accessed since a provided timestamp.
2025-11-12 09:06:21 -05:00
Timothy Flynn
c2c269814a LibWebView: Add methods to estimate cookie / WebStorage sizes 2025-11-12 09:06:21 -05:00
Timothy Flynn
23fb68b5a4 LibWebView: Add last access time to the WebStorage database
This will be used to delete entries accessed since a user-provided time.
2025-11-12 09:06:21 -05:00
Timothy Flynn
8a656e1232 LibWebView: Add a metadata table to track WebStorage schema changes
We will soon need to add a column to the WebStorage table. We cannot
blindly issue an ALTER TABLE statement, as that will fail once the
column already exists. The colloquial way to do this is to track a
schema version, then handle version changes explicitly.
2025-11-12 09:06:21 -05:00
Timothy Flynn
0fd1c2af09 LibWebView: Organize StorageJar a little bit
Basically, just define methods in the order they are declared. A bit
easier to read, rather than jumping around.
2025-11-12 09:06:21 -05:00
Timothy Flynn
ced982d631 LibWebView: Move the CookieJar internal struct declarations lower
This will just avoid some awkward declaration order issues in an
upcoming commit.
2025-11-12 09:06:21 -05:00
Timothy Flynn
3f61f0f189 RequestServer: Add a time parameter to the clear cache endpoint
This allows removing cache entries last accessed since a provided
timestamp.
2025-11-12 09:06:21 -05:00
Timothy Flynn
ba49942b6d LibRequests+RequestServer: Add a method to estimate disk cache size
This allows estimating the cache size stored on disk since a provided
time stamp, and in total.
2025-11-12 09:06:21 -05:00
Timothy Flynn
d5c00a493c LibDatabase+RequestServer: Store ByteString data as a BLOB
We currently store ByteString as TEXT, but that is interpreted by SQLite
as UTF-8. All string-related operations will try to operate on the text
as if it is stored with UTF-8. We should use BLOB instead, which does
not make any encoding assumptions.

The only user of ByteString in the database currently is the HTTP disk
cache. So we bump its version here to remove existing data. Again, we
will want to handle changes like this more gracefully eventually.
2025-11-12 09:06:21 -05:00
Timothy Flynn
1c2c9a859a LibCore: Do not require rvalue references to resolve/reject promises
The way these methods were previously defined, we would have to `move`
values into these functions. This was pretty awkward for plain types.
For example, doing a `move` here really doesn't make sense:

    int resolution = 123;
    promise->resolve(move(resolution));

Let's declare these methods in a manner that allows callers to choose
whether values are moved or copied, using perfect forwarding.
2025-11-12 09:06:21 -05:00
Jelle Raaijmakers
cb333c53e7 LibJS: Remove unused NativeFunction::m_name_string 2025-11-12 14:39:14 +01:00
Lorenz A
bd56fdc57b LibWeb: Allow focusable for the first summary child of a detail element 2025-11-12 13:57:05 +01:00
Lorenz A
8ca59e7c7e LibWeb: AnchorElement should be focusable with tabindex 2025-11-12 13:57:05 +01:00
Lorenz A
3bc061d028 LibWeb: Allow all elements with tabindex attribute to be focusable 2025-11-12 13:57:05 +01:00
Tim Ledbetter
154e9db033 LibWeb: Cache the value of Element::lang()
This reduces the time spent in
`SelectorEngine::matches_lang_pseudo_class()` from 1.9% to 0.41% on
https://cloudflare.com
2025-11-12 12:36:16 +01:00
Tim Ledbetter
0ec97eabab LibWeb: Extract device_pixels_per_css_pixel getter from loop
This reduces time spent in StyleComputer::compute_property_values() by
~10% when loading https://html.spec.whatwg.org/
2025-11-12 11:21:17 +01:00
Tim Ledbetter
df23b42b37 LibWeb: Don't store custom name on StyleProperty
This reduces time spent in `~StyleProperty()` from 2.18% to 0.67% on
https://cloudflare.com.
2025-11-12 11:19:37 +01:00
Psychpsyo
eb21ea890c LibWeb: Implement CSS perspective property 2025-11-12 00:41:14 +01:00
Psychpsyo
e44a97e508 LibWeb: Pass 3D transforms to Skia 2025-11-12 00:41:14 +01:00
Psychpsyo
e0b5bd7894 LibWeb: Make transition order return -1 and 1 instead of 0 and 1
The old behavior was plain incorrect for a sorting function.
2025-11-11 21:57:47 +01:00
Psychpsyo
2c4f2a3cb6 LibWeb: Make transition order consider property name
class_specific_composite_order() also has no reason to return an
Optional<int>, since it can just return 0.
2025-11-11 13:46:56 +01:00
Tim Ledbetter
1df94c4513 LibCore: Introduce REPORT_TIME() for per call timing information
This macro outputs the time taken to reach the end of the current scope
to the debug console. It also shows the average time, total cumulative
time and the total number of calls.

It is also possible to limit the amount of debug output using
`REPORT_TIME_EVERY(name, n)` to only print every `n` calls.
2025-11-11 11:47:59 +01:00
Tim Ledbetter
298e934077 AK: Add human_readable_short_time()
This gives a more compact version of `human_readable_time()` to
nanosecond precision.
2025-11-11 11:47:59 +01:00
Jelle Raaijmakers
c845e2cef7 LibWeb: Don't join anonymous pseudo wrappers for block node insertion
This can happen if pseudo elements are absolutely positioned, they need
the nearest non-inline parent to determine their position.
2025-11-11 10:49:49 +01:00
Jelle Raaijmakers
ac829cf60a LibWeb: Hoist anonymous wrappers out of parent inline nodes
When we generate pseudo elements, we create anonymous wrappers that
might end up in an InlineNode, even if they have `display: block` set.
This causes them not to be rendered.

Do not rely on inline continuation logic for these anonymous wrappers,
but rather find the first layout parent that's not an InlineNode and
insert it into that.

Fixes #5042.
2025-11-11 10:49:49 +01:00
Tete17
660e1b8cd2 LibWeb: Add a bunch of eval tests in the trusted-types category 2025-11-11 09:58:34 +01:00
Tete17
6d173d931a LibWeb: Allow eval to execute TrustedScripts 2025-11-11 09:58:34 +01:00
Tete17
fb2062a9db LibWeb: Allow CSP to block eval invocations based on TrustedTypes
This allows trusted types directives to also restrict the contents
passed to eval.
2025-11-11 09:58:34 +01:00
Callum Law
55afa9d37e LibWeb: Avoid unnecessary work when element display property changes
`play_or_cancel_animations_after_display_property_change` is called
whenever an element is inserted or removed, or it's display property
changes, but it is only required to run if we actually have animations
to play or cancel.

Reduces time spent in the aforementioned function from ~2% to ~0.03%
when loading https://en.wikipedia.org/wiki/2023_in_American_television
2025-11-11 08:35:39 +00:00
Callum Law
cfc22a4075 LibWeb: Dont try to transition custom properties
Fixes a crash introduced in dd9d6d2
2025-11-11 07:53:41 +00:00