Commit graph

37 commits

Author SHA1 Message Date
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
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
cf704cfbfc LibWeb: Implement interpolation for CSS scale values
Some checks are pending
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
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
1f8f3804a3 LibWeb: Allow transition-property with multiple values 2025-04-23 21:02:59 +01:00
Andrew Kaster
6d11414957 LibWeb: Make storage of CSS::StyleValues const-correct
Now we consistently use `RefPtr<StyleValue const>` for all StyleValues.
2025-04-16 10:41:44 -06:00
Sam Atkins
a7f7c2a821 LibWeb/CSS: Teach OpenTypeTaggedStyleValue to serialize without "1" 2025-04-07 10:00:21 +01: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
61f76c7ec5 LibWeb: Set color filter value to 1 if omitted 2025-04-04 17:12:47 +01:00
Sam Atkins
79093291b5 LibWeb/CSS: Un-template parse_comma_separated_value_list()
This doesn't need to be a template. Changing it means we can use it from
any FooParsing.cpp file, and also move it ValueParsing.cpp where it
belongs.
2025-04-04 10:40:32 +01:00
Glenn Skrzypczak
9973b01848 LibWeb/CSS: Improved implementation of background-blend-mode
This is a improved version of a73cd88f0c
The old commit was reverted in 552dd18696

The new version only paints an element into a new layer if background
blend modes other than normal are used. The rasterization performance
of most websites should therefore not suffer.

Co-Authored-By: Alexander Kalenik <kalenik.aliaksandr@gmail.com>
2025-04-01 13:38:00 +02:00
Aliaksandr Kalenik
552dd18696 Revert "LibWeb/CSS: Implement 'background-blend-mode'"
This reverts commit a73cd88f0c.

Emitting SaveLayer for each paintable made rasterization a lot slower
on every website because now Skia has to allocate enormous amounts of
temporary surfaces. Let's revert it for now and figure how to implement
it with less aggressive SaveLayer usage.
2025-03-28 16:48:03 +00:00
Glenn Skrzypczak
a73cd88f0c LibWeb/CSS: Implement 'background-blend-mode'
This implements the 'background-blend-mode' CSS property.
2025-03-28 09:41:06 +00:00
Sam Atkins
ef3a2bf907 LibWeb/CSS: Move functions for detecting var()/attr() into Token types
This makes them accessible outside of PropertyParsing.cpp (which will be
useful if/when descriptors can include them). I've also renamed them to
use the correct term: "arbitrary substitution function".
2025-03-28 09:15:02 +00:00
Sam Atkins
f8536fc48a LibWeb/CSS: Split out <family-name> parsing
This type is used individually elsewhere in the spec. This also lets us
separate out the `<generic-family>` type.
2025-03-25 07:53:59 +00:00
Tim Ledbetter
2672fe99b7 LibWeb: Set correct longhands if grid-area subproperties are omitted 2025-03-20 16:59:27 +00:00
Tim Ledbetter
18cccd7633 LibWeb/CSS: Don't allow negative values in border-radius property 2025-03-14 15:07:57 +00:00
Tim Ledbetter
632fc73643 LibWeb/CSS: Don't allow negative border radius in box-shadow property 2025-03-14 15:07:57 +00:00
Tim Ledbetter
dc58c11217 LibWeb: Reject invalid background-position-* property values 2025-03-14 15:07:57 +00:00
Tim Ledbetter
5559c3cb4f LibWeb/CSS: Parse <single-transition-property> as a <custom-ident>
The specification also treats a transition name of `none` as invalid.
2025-03-14 08:52:25 +01:00
Tim Ledbetter
6298ec6be4 LibWeb: Validate time values when parsing transition value 2025-03-14 08:52:25 +01:00
Tim Ledbetter
b80c0d2114 LibWeb/CSS: Reject invalid grid track placement property values 2025-03-14 08:50:04 +01:00
Tim Ledbetter
ad4ade3f07 LibWeb/CSS: Disallow invalid <counter-name> values
We now parse `<counter-name>` values as a `<custom-ident>`. This
disallows `default` and CSS-wide keywords as counter names. The
specification additionally disallows `none` as a counter name.
2025-03-13 05:23:19 +00:00
Tim Ledbetter
249de20343 LibWeb/CSS: Don't allow negative values in filter functions 2025-03-12 09:06:16 +00:00
Sam Atkins
532c01c388 LibWeb: Implement text-decoration: spelling-error and grammar-error 2025-02-28 16:34:08 +00:00
Sam Atkins
bfd7ac1204 LibWeb+WebContent+UI: Support image cursors
The `cursor` property accepts a list of possible cursors, which behave
as a fallback: We use whichever cursor is the first available one. This
is a little complicated because initially, any remote images have not
loaded, so we need to use the fallback standard cursor, and then switch
to another when it loads.

So, ComputedValues stores a Vector of cursors, and then in EventHandler
we scan down that list until we find a cursor that's ready for use.

The spec defines cursors as being `<url>`, but allows for `<image>`
instead. That includes functions like `linear-gradient()`.

This commit implements image cursors in the Qt UI, but not AppKit.
2025-02-28 13:50:13 +01:00
Andreas Kling
8ab61843be LibWeb: Parse CSS fit-content(<length-percentage>) values
Before this change, we only parsed fit-content as a standalone keyword,
but CSS-SIZING-3 added it as a function as well. I don't know of
anything else in CSS that is overloaded like this, so it ends up looking
a little awkward in the implementation.

Note that a lot of code had already been prepped for fit-content values
to have an argument, we just weren't parsing it.
2025-02-27 00:44:14 +01:00
Sam Atkins
ab4b46f990 LibWeb/CSS: Automate parsing view-transition-name 2025-02-26 11:22:47 +00:00
Sam Atkins
c6c607884b LibWeb/CSS: Take custom-ident blacklist as a Span
Using std::initializer_list here was a bit of a hack, and makes it
awkward to pass those blacklists around.
2025-02-26 11:22:47 +00:00
Psychpsyo
c0eb072645 LibWeb: Add CSS view-transition-name 2025-02-22 14:52:13 +00:00
Sam Atkins
8236022152 LibWeb/CSS: Parse font-variant properties closer to spec
The spec wants these keywords to appear in a particular order when
serialized, so let's just put them in that order during parsing.

This also fixes a bug where we didn't reject `font-variant-east-asian`
that contains `normal` alongside another value.

Also, rather than always parsing them as a StyleValueList, parse single
values on their own, and then support that in the to_font_variant_foo()
methods.
2025-02-12 16:00:42 +00:00
Sam Atkins
cda3fe7a4b LibWeb/CSS: Reject trailing unparseable tokens in property values
Without this, we'd happily parse `font-variant-caps: small-caps potato`
as just `small-caps` and ignore the fact that unused tokens were left
over.

This fix gets us some WPT subtest passes, and removes the need for a
bespoke parsing function for font-variant-caps.
2025-02-12 16:00:42 +00:00
Sam Atkins
531b92d467 LibWeb/CSS: Make font implicitly reset some properties
This is a weird behaviour specific to `font` - it can reset some
properties that it never actually sets. As such, it didn't seem worth
adding this concept to the code generator, but just manually stuffing
the ShorthandStyleValue with them during parsing.
2025-02-12 16:00:42 +00:00
Sam Atkins
0ac133d73b LibWeb/CSS: Replace is_generic_font_family() with a CSS enum
Also add the missing "math" value to it.
2025-02-06 16:47:25 +00:00
Sam Atkins
1413760047 LibWeb/CSS: Split up Parser.cpp
This file has been a pain to edit for a while, even with the previous
splits. So, I've divided it up into 3 parts:
- Parser.cpp has the "base" code. It's the algorithms and entry-points
  defined in the Syntax spec.
- ValueParsing.cpp contains code for parsing single values, such as a
  length, or a color, or a calculation.
- PropertyParsing.cpp contains code for parsing an entire property's
  value. A few of these sit in a grey area between being a property's
  value and a value in their own right, but the rule I've used is "is
  this useful outside of a single property and its shorthands?"

This only moves code, with as few modifications as possible to make that
work. I did add explicit instantiations for the template implementations
as part of this, which revealed a few that are actually only compatible
with a single type, so I'll clear those up in a subsequent commit.
2025-02-06 16:47:25 +00:00