Sam Atkins
bc1d323ba0
LibWeb/CSS: Remove URL parameter to the CSS Parser
...
We no longer complete any URLs during parsing.
2025-05-03 12:01:43 +01:00
Sam Atkins
9e2e796f2d
LibWeb/CSS: Use CSS::URL for font-fetching
...
ParsedFontFace and FontLoader now both keep track of which
CSSStyleSheet (if any) was the source of the font-face, so the URLs can
be completed correctly.
2025-05-03 12:01:43 +01:00
Sam Atkins
14fb567a0f
LibWeb/CSS: Stop overwriting style sheet location after construction
2025-05-03 12:01:43 +01:00
Sam Atkins
7a4854732a
LibWeb/CSS: Make CSS::URL formattable
2025-05-03 12:01:43 +01:00
Sam Atkins
efad6e96aa
LibWeb/CSS: Set CSSFontFaceDescriptors' parent rule
2025-05-03 12:01:43 +01:00
Sam Atkins
ffc01626f7
LibWeb/CSS: Load fonts using fetch
...
Convert FontLoader to use fetch_a_style_resource(). ResourceLoader used
to keep its downloaded data around for us, but fetch doesn't, so we use
Gfx::Typeface::try_load_from_temporary_memory() so that the font has a
permanent copy of that data.
2025-05-03 12:01:43 +01:00
Sam Atkins
f76f8dcce1
LibWeb/CSS: Return the FetchController from fetch_a_style_resource()
2025-05-03 12:01:43 +01:00
Sam Atkins
6b762331df
LibGfx: Rename WOFF[2]::try_load_from_externally_owned_memory()
...
Typeface::try_load_from_externally_owned_memory() relies on that
external owner keeping the memory around. However, neither WOFF nor
WOFF2 do so - they both create separate ByteBuffers to hold the TTF
data. So, rename them to make it clearer that they don't have any
requirements on the byte owner.
2025-05-03 12:01:43 +01:00
Tim Ledbetter
23009779e1
LibWeb: Interpolate font-style
values correctly
...
These are interpolated by computed value, except a value of `normal` is
treated as `oblique 0deg`.
2025-05-03 12:05:22 +02:00
Tim Ledbetter
c0f9b11070
LibWeb: Parse oblique font-style
with an angle value
2025-05-03 12:05:22 +02:00
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