Bastiaan van der Plaat
832bb978f5
LibWeb: Reject CSS values with unprocessed tokens / extra semicolons
2025-05-02 11:10:02 +01:00
Bastiaan van der Plaat
b99f4872d1
LibWeb: Allow transform calculated length properties
2025-05-02 11:10:02 +01:00
Tim Ledbetter
542c3cbe51
LibWeb: Implement the transition-behavior
CSS property
...
This specifies whether transitions should be started for transitions
whose animation behavior is discrete.
2025-05-02 11:07:19 +01:00
Psychpsyo
82387e2127
LibWeb: Avoid changing button border color on disable/hover
2025-04-30 20:13:14 +01:00
Tim Ledbetter
c72d5943e6
LibWeb: Support interpolating translate
values
2025-04-30 19:36:56 +02:00
Tim Ledbetter
27baaa13e9
LibWeb: Support parsing and serializing 3D translate values
2025-04-30 19:36:56 +02:00
Tim Ledbetter
d804f1311c
LibWeb: Don't serialize scale
z value if it is 1
2025-04-30 19:36:56 +02:00
Sam Atkins
326933cd93
LibWeb/CSS: Use CSS::URL for <url>
and <paint>
types
2025-04-30 17:38:38 +01:00
Sam Atkins
d301510ab2
Everywhere: Correct "FIMXE" typo
2025-04-30 17:38:38 +01:00
Tim Ledbetter
e7ae9c8ebf
LibWeb: Parse all
as keyword in transition
shorthand
...
This ensures that the parsing of the `transition` shorthand property
behaves in the same way as the `transition-property` longhand.4
2025-04-28 20:51:36 +02:00
Tim Ledbetter
04fde1c550
LibWeb: Ensure lang
pseudoclass matches multiple segment subcodes
2025-04-28 11:29:30 +01:00
Tim Ledbetter
74c803c87b
LibWeb: Ensure |=
value selector handles multiple segments correctly
...
Previously, the `|=` would not compare strings containing `-`
characters correctly because it would only compare the element
attribute up to the first `-` character.
2025-04-28 11:29:30 +01:00
Tim Ledbetter
f854f644a7
LibWeb: Don't crash when interpolating non <number>
scale values
2025-04-28 11:46:34 +02:00
Tim Ledbetter
8a398e7a88
LibWeb: Parse all
transition-property value as keyword
...
We were previously parsing this value, as a custom-ident, meaning that
the code path for handling the `all` case wasn't being followed.
2025-04-27 09:49:00 +01:00
Andreas Kling
d8ea16d94e
LibWeb: Don't assume calc() simplification worked on invalid tree
...
Fixes #4469
2025-04-25 16:55:05 +02:00
Timothy Flynn
ad34fdad48
LibWeb: Convert trivial attributes to FrozenArray
2025-04-25 16:43:43 +02:00
Andreas Kling
cf704cfbfc
LibWeb: Implement interpolation for CSS scale
values
...
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
And let's handle the 3rd (Z) scale parameter as well, while we're here.
At least 242 new passes on WPT.
2025-04-25 14:08:12 +02:00
Timothy Flynn
fe6d8131ae
LibWeb: Return correct type from CSSNestedDeclarations::style
...
We implement CSSStyleProperties so let's use it.
2025-04-25 08:48:29 +02:00
Andreas Kling
0553bcb35b
LibWeb: Simplify standalone CSS math functions when used outside calc()
...
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
Math functions like abs(), clamp(), round(), etc, can be used by
themselves in property values, without wrapping them in calc().
Before this change, we were neglecting to run calc simplification on the
generated calculation node trees. By doing that manually after parsing a
standalone math function, we score at least a couple hundred WPT points.
2025-04-24 20:38:00 +02:00
Andreas Kling
cf34a7bb32
LibWeb: Invalidate owner sheet on add/remove in CSSStyleProperties
...
Fixes at least 2 WPT subtests.
2025-04-24 18:26:54 +02:00
Andreas Kling
1772adb600
LibWeb: Don't crash on non-finite values in CSS clamp() function
...
Stops a WPT test from crashing, giving us 29 new subtest passes. :^)
2025-04-24 18:26:54 +02:00
Andreas Kling
2f76b24b89
LibWeb: Throw on deleting CSS @namespace rule in disallowed conditions
...
Fixes one(!) WPT test :^)
2025-04-24 18:26:54 +02:00
Tim Ledbetter
fc1026984c
LibWeb: Don't crash when processing a transition with value none
2025-04-24 00:00:23 +02:00
Tim Ledbetter
64577ad704
LibWeb: Allow multiple values for the transition-duration
property
2025-04-23 21:02:59 +01:00
Tim Ledbetter
1ca9f2a44d
LibWeb: Allow multiple values for the transition-delay
property
2025-04-23 21:02:59 +01:00
Tim Ledbetter
c5f1f36119
LibWeb: Allow multiple values for transition-timing-function
property
2025-04-23 21:02:59 +01:00
Tim Ledbetter
7a391f419a
LibWeb: Handle single value properties when normalizing transition lists
...
Previously, if a transition property was not wrapped in a list, it
would be replaced with the default value in
`StyleComputer::compute_transitioned_properties`.
2025-04-23 21:02:59 +01:00
Tim Ledbetter
1f8f3804a3
LibWeb: Allow transition-property
with multiple values
2025-04-23 21:02:59 +01:00
Sam Atkins
658569b533
LibWeb/CSS: Use CSSRule's context to parse new child rules
...
Keep track of which CSSRule owns a CSSRuleList, and then use that to
produce a stack of RuleContexts for the CSS Parser to use.
There are certainly other places we should do this!
2025-04-23 10:55:45 +01:00
Sam Atkins
763b1b0ee2
LibWeb/CSS: Move RuleContext type out of Parser.h
...
This was previously internal to the Parser, but we'd like to pass it in
from outside.
2025-04-23 10:55:45 +01:00
Sam Atkins
9465492edf
LibWeb/CSS: Combine the CSSRuleList constructors
2025-04-23 10:55:45 +01:00
Sam Atkins
3d1665cc80
LibWeb/CSS: Parse nested declarations in insert_a_css_rule()
...
The spec algorithm changed at some point to support nested declarations,
but I only just noticed. The subtest regression is one we were passing
incorrectly.
2025-04-23 10:55:45 +01:00
Sam Atkins
fa8bbfa6a5
LibWeb/CSS: Align declaration block parsing with the spec
...
We have two different code paths that implement the "parse a CSS
declaration block" algorithm, for properties and descriptors. COmbining
them isn't straightforward, and doesn't seem especially useful.
2025-04-23 10:55:45 +01:00
Tim Ledbetter
8a20899382
LibWeb: Canonicalize color space when parsing color-mix()
function
...
This amounts to replacing the "xyz" color space with "xyz-d65".
2025-04-23 11:26:27 +02:00
Tim Ledbetter
04d7228c51
LibWeb: Implement interpolation of repeatable lists
2025-04-23 09:13:45 +01:00
Tim Ledbetter
0beb22f19e
LibWeb: Implement interpolation of edge values
2025-04-23 09:13:45 +01:00
Tim Ledbetter
6f5b107fcc
LibWeb: Resolve absolute calc()
values in color functions
...
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
Currently, `calc()` values with relative units are not handled
correctly and will output an error to the console.
2025-04-22 12:20:26 +02:00
Tim Ledbetter
9cf04f40f6
LibWeb: Implement the color-mix()
function
...
This takes 2 color values and returns the result of mixing them by a
given amount.
2025-04-22 12:19:51 +02:00
Aliaksandr Kalenik
8e2d1559ec
LibGfx: Join ScaledFont into Font
...
Since ScaledFont is the only class inherited from Font we could simply
merge them.
2025-04-21 09:51:16 +02:00
Andreas Kling
a6dfc74e93
LibWeb: Only set prototype once for object with IDL interface
...
Before this change, we were going through the chain of base classes for
each IDL interface object and having them set the prototype to their
prototype.
Instead of doing that, reorder things so that we set the right prototype
immediately in Foo::initialize(), and then don't bother in all the base
class overrides.
This knocks off a ~1% profile item on Speedometer 3.
2025-04-20 18:43:11 +02:00
Tim Ledbetter
4283c73d02
LibWeb: Return correct computed value for lab-like and lch-like colors
2025-04-20 16:51:20 +02:00
Tim Ledbetter
e860dd4f65
LibWeb: Implement serialization of lch-like color values
2025-04-20 16:51:20 +02:00
Tim Ledbetter
5074d90888
LibWeb: Implement serialization of lab-like color values
2025-04-20 16:51:20 +02:00
Shannon Booth
f48b760011
LibWeb/CSS: Avoid URL validity check parsing CSS URLs
2025-04-19 07:18:43 -04:00
Andreas Kling
5df3838a80
LibWeb: Evaluate style sheet media rules immediately on insertion
...
Before this change, we were waiting for Document to lazily evaluate
sheet media and media rules. This often meant that we'd get two
full-document style invalidations: one from adding a new style sheet,
and one from the media queries changing state.
By evaluating the rules eagerly on insertion, we coalesce the two
invalidations into one. This reduces the number of full-document
invalidations on Speedometer 3 from 51 to 34.
2025-04-19 01:14:02 +02:00
Andreas Kling
57809b1100
LibWeb: Skip dynamic_cast in CSSRGB after we already did a type check
2025-04-18 14:45:56 +02:00
Shannon Booth
3e17b1c9ae
LibWeb: Make Node::parent_element return GC::Ptr
...
This is useful for people like myself who run with debug mode to
more reliably get stacktraces without spinning up a debugger.
2025-04-18 10:49:02 +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
Tim Ledbetter
ca200142e9
LibWeb: Don't construct stylesheet when modifying CSSStyleSheet
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
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