Andreas Kling
2aa6d7636c
LibWeb: Invalidate sheet owners after mutating cssText of its rules
...
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 fixes one source of flakiness on WPT (of many) where we wouldn't
recompute style after programmatically altering the contents of a style
sheet, but instead had to wait for something else to cause invalidation.
2025-04-12 14:15:57 +01:00
Aliaksandr Kalenik
6507d23e29
LibWeb: Save ScrollState snapshot in DisplayList to avoid race condition
...
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
With this change we save a copy of of scroll state at the time of
recording a display list, instead of actual ScrollState pointer that
could be modifed by the main thread while display list is beings
rasterized on the rendering thread, which leads to a frame painted with
inconsistent scroll state.
Fixes https://github.com/LadybirdBrowser/ladybird/issues/4288
2025-04-12 02:55:18 +02:00
Sam Atkins
d855adf767
LibWeb: Add slider- prefix to slider pseudo-element names
...
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
Corresponds to 9549bb8951
2025-04-11 21:27:47 +01:00
Tim Ledbetter
f07a3fe6da
LibWeb: Use discrete interpolation for degenerate ratios
...
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
Degenerate ratios cannot be interpolated.
2025-04-11 11:38:05 +01:00
Tim Ledbetter
b3980d40f7
LibWeb: Round to the nearest integer when interpolating integer values
2025-04-11 11:31:54 +01:00
Sam Atkins
8beade51e0
LibWeb/CSS: Make it clear that StyleSheet::media() is never null
2025-04-09 18:45:57 +01:00
Sam Atkins
848a250b29
LibWeb/CSS: Mark CSSImportRule.media as nullable
...
See the linked spec issue for more details. The MediaList can be null
internally, and this was upsetting GCC as it meant our bindings code
was dereferencing a null pointer.
2025-04-09 18:45:57 +01:00
Sam Atkins
0f42d5ec3e
LibWeb/CSS: Don't resolve @import
URLs until they are used
...
The regression in the "conditional-CSSGroupingRule" test is we now fail
the "inserting an `@import`" subtests differently and the subtests
aren't independent. Specifically, we don't yet implement the checks in
`CSSRuleList::insert_a_css_rule()` that reject certain rules from being
inserted. Previously we didn't insert the `@import` rule because we
failed to parse its relative URL. Now we parse it correctly, we end up
inserting it.
2025-04-09 18:45:57 +01:00
Sam Atkins
ca0890ce16
LibWeb/CSS: Only try to fetch @import
s with a parent style sheet
...
When `CSSRuleList::remove_a_css_rule()` is called, the removed rule has
its parent style sheet set to null. We shouldn't try to fetch an import
in this case.
2025-04-09 18:45:57 +01:00
Sam Atkins
c679643391
LibWeb/CSS: Extract CSSStyleSheet's ParsingParams code into a method
...
This repeated code is a bit unwieldy.
2025-04-09 18:45:57 +01:00
Sam Atkins
1abc628cd8
LibWeb/CSS: Allow CSSImportRule's document to be null on construction
...
It's possible to parse an `@import` rule that isn't attached to a
document. We only actually need it to have one when fetching the linked
style sheet, and that should only happen when the CSSImportRule is
attached to a document. So, we can just accept a null pointer when
constructing it.
We relied on that Document to get the Realm, so pass that in as a
separate parameter.
2025-04-09 18:45:57 +01:00
Sam Atkins
bc02e3e9a9
LibWeb/CSS: Pass location to parse_a_stylesheet()
2025-04-09 18:45:57 +01:00
Sam Atkins
7216c6b050
LibWeb/CSS: Parse <url>
as a new CSS::URL type
...
Our previous approach to `<url>` had a couple of issues:
- We'd complete the URL during parsing, when we should actually keep it
as the original string until it's used.
- There's nowhere for us to store `<url-modifier>`s on a `URL::URL`.
So, `CSS::URL` is a solution to this. It holds the original URL string,
and later will also hold any modifiers. This commit parses all `<url>`s
as `CSS::URL`, but then converts it into a `URL::URL`, so no user code
is changed. These will be modified in subsequent commits.
For `@namespace`, we were never supposed to complete the URL at all, so
this makes that more correct already. However, in practice all
`@namespace`s are absolute URLs already, so this should have no
observable effects.
2025-04-09 18:45:57 +01:00
Sam Atkins
c82f4b46a2
LibWeb/CSS: Qualify uses of LibURL
...
To prepare for introducing a CSS::URL type, we need to qualify any use
of LibURL as `::URL::foo` instead of `URL::foo` so the compiler doesn't
get confused.
Many of these uses will be replaced, but I don't want to mix this in
with what will likely already be a large change.
2025-04-09 18:45:57 +01:00
Sam Atkins
da1ff1ba40
LibWeb/CSS: Store CSSStyleSheet location as a URL
...
We already have a URL when we construct these, and we want a URL later,
so avoid serializing and re-parsing it.
2025-04-09 18:45:57 +01:00
Viktor Szépe
5cc371d54c
LibWeb: Fix typos - act II
2025-04-09 15:05:20 +01:00
Sam Atkins
86be8abfbf
LibWeb/CSS: Const-correct ComputedProperties::set_computed_font_list()
...
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, 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 (arm64, Sanitizer_CI, false, macos-15, macOS, 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 shouldn't be const, and that means the two members don't have to be
mutable.
2025-04-09 15:32:04 +02:00
mkljczk
79c22e0d86
LibWeb: Use font with space in range for first_available_computed_font
2025-04-09 12:14:04 +01:00
Tim Ledbetter
55769be9c6
LibWeb: Don't resolve color components when serializing color functions
...
Previously, we were incorrectly replacing color components with `None`
values with 0.
2025-04-09 12:11:33 +01:00
Tim Ledbetter
a97fe3123d
LibWeb: Don't convert color functions to RGB when resolving color values
2025-04-09 12:11:33 +01:00
Tim Ledbetter
02d34dd021
LibWeb: Rename CSSColor
to ColorFunctionStyleValue
...
This gives a better idea of what the class represents.
2025-04-09 12:11:33 +01:00
Gingeh
972547635f
LibWeb: Dispatch pointer events to ::backdrop originating element
2025-04-09 12:10:42 +01:00
Gingeh
4b9f5c6fb8
LibWeb: Generate ::backdrop pseudo-elements
2025-04-09 12:10:42 +01:00
Tim Ledbetter
2a17d6d449
LibWeb: Set clip-path
animation type to by-computed-value
2025-04-09 09:02:59 +01:00
Timothy Flynn
f070264800
Everywhere: Remove sv
suffix from format string literals
...
This prevents the compile-time checks that would catch errors in the
format invocation (which would usually lead to a runtime crash).
2025-04-08 20:00:18 -04:00
Sam Atkins
a80408fea6
LibWeb/CSS: Store @property
initial value as a style value
...
For now, it's the "raw" UnresolvedStyleValue. Later, we'll need to try
to parse it into a "real" style value using the property's syntax.
2025-04-08 09:59:41 +01:00
Sam Atkins
9292b769ef
LibWeb/CSS: Use descriptor parsing for @property
2025-04-08 09:59:41 +01:00
Tim Ledbetter
408f9f3dde
LibWeb: Disallow "default" as a <family-name>
identifier
...
This commit disallows "default" as a font-family name, when the name is
not quoted because unquoted names are treated as custom-idents, for
which the name "default" is not allowed.
2025-04-07 12:14:29 +01:00
Tim Ledbetter
263cb3f8ca
LibWeb/CSS: Remove unnecessary shorthand serialization special cases
...
The serialization of these properties is improved by using the new
default behavior.
2025-04-07 11:38:56 +01:00
Tim Ledbetter
63228477a4
LibWeb/CSS: Specify list-style
subproperties in canonical order
2025-04-07 11:38:56 +01:00
Tim Ledbetter
3186adeaa1
LibWeb/CSS: Don't serialize longhands which match their initial values
...
Shorthand subproperties that match their initial values are now
excluded from serialization, by default.
Properties where this behavior is not desired, like `gap`, are
special-cased.
2025-04-07 11:38:56 +01:00
Sam Atkins
e8213bb86b
LibWeb/CSS: Remove unnecessary note about unicode-range parsing
...
I wrote this before implementing the parsing, and it ended-up not being
true.
2025-04-07 10:00:21 +01:00
Sam Atkins
5aeaeb3097
LibWeb/CSS: Remove redundant font-face src parsing code
...
We now always parse this as a descriptor.
2025-04-07 10:00:21 +01:00
Sam Atkins
5f6972fc31
LibWeb/CSS: Parse FontFace parameters as descriptors
...
This also rearranges the code to follow the spec better: We create an
empty FontFace first and then fill it in, instead of creating it
fully-formed at the end.
2025-04-07 10:00:21 +01:00
Sam Atkins
0121e7028f
LibWeb/CSS: Make "CSSStyleValue -> list of font sources" code accessible
...
We'll want this in FontFace.
2025-04-07 10:00:21 +01:00
Sam Atkins
1e132d9f87
LibWeb/CSS: Use descriptor parsing in FontFace setters
2025-04-07 10:00:21 +01:00
Sam Atkins
ce56ac9159
LibWeb/CSS: Correct include style in CSSFontFaceDescriptors.cpp
2025-04-07 10:00:21 +01:00
Sam Atkins
775efd01e2
LibWeb/CSS: Use initial values for @font-face
descriptors
2025-04-07 10:00:21 +01:00
Sam Atkins
ee647616b2
LibWeb/CSS: Serialize @font-face
closer to spec
...
Read the descriptor style values instead of producing a ParsedFontFace
first, as this means we know if a descriptor is actually present, or
has been defaulted to an initial value. This lets us correctly skip the
unicode-range if it was not explicitly set.
Firefox and Chromium both serialize using the "font-stretch" name,
(which is an alias for font-width) which follows the outdated cssom
spec, so I've done so too to match them.
The one thing that we still do differently in this test is that those
browsers check explicitly if `font-stretch` was set, and ignore when
`font-width` is.
I've also inlined the `serialize_a_local()` function to the one place
it's used. The style value to_string() method was already wrapping the
string in quotes, so calling serialize_a_string() on it was producing
`local("\this mess\"")`. It's clearer what's happening when the code
isn't split up.
2025-04-07 10:00:21 +01:00
Sam Atkins
a7f7c2a821
LibWeb/CSS: Teach OpenTypeTaggedStyleValue to serialize without "1"
2025-04-07 10:00:21 +01:00
Tim Ledbetter
026bc91d6c
LibWeb/CSS: Extract border width values directly
...
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
There's no need to keep a copy of a `BorderData` object in this case.
This makes the variable names used a bit less confusing.
2025-04-05 12:54:22 +02:00
Tim Ledbetter
32812f5db0
LibWeb: Return absolutized computed value for outline width property
2025-04-05 12:54:22 +02:00
Andreas Kling
de424d6879
LibJS: Make Completion.[[Value]] non-optional
...
Instead, just use js_undefined() whenever the [[Value]] field is unused.
This avoids a whole bunch of presence checks.
2025-04-05 11:20:26 +02:00
Tim Ledbetter
8738987e44
LibWeb: Return absolutized computed value for border width properties
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
2025-04-04 23:45:06 +02:00
Andrew Kaster
8fd81c3338
LibGC+LibWeb+LibJS: Remove workaround for Swift boolean bitfield issue
...
We're using a main snapshot everywhere, so we can yeet the workaround.
2025-04-04 13:06:53 -06:00
Tim Ledbetter
e73438e82c
LibWeb: Clamp grayscale, invert, filter and opacity filter values to 1
2025-04-04 17:12:47 +01:00
Tim Ledbetter
e5f21b2f9c
LibWeb: Set blur filter radius to 0px if omitted
2025-04-04 17:12:47 +01:00
Tim Ledbetter
2ee86d1e18
LibWeb: Set hue-rotate angle to 0 degrees if omitted
2025-04-04 17:12:47 +01:00
Tim Ledbetter
61f76c7ec5
LibWeb: Set color filter value to 1 if omitted
2025-04-04 17:12:47 +01:00
Tim Ledbetter
46411295d6
LibWeb: Serialize drop-shadow filter properties in canonical order
2025-04-04 17:12:47 +01:00