Commit graph

864 commits

Author SHA1 Message Date
Callum Law
8e9753eadb LibWeb: Correctly compute consistent type when simplifying hypot
Previously we would never get a valid `consistent_type` as we were
trying to make the node types consistent with the initial empty type
which isn't possible.

Gains us 7 WPT tests.
2025-06-30 14:53:04 +02:00
Tim Ledbetter
04a3a227c3 LibWeb: Add the border-inline-* shorthand properties 2025-06-30 14:52:18 +02:00
Tim Ledbetter
90da2f5418 LibWeb: Add the border-block-* shorthand properties 2025-06-30 14:52:18 +02:00
Tim Ledbetter
ac25f47e8f LibWeb/SVG: Disallow negative stroke-dasharray values
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / 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-06-27 23:00:13 +02:00
Tim Ledbetter
0c8a90166f LibWeb/SVG: Disallow negative values for SVG radius properties
Some checks are pending
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / 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-06-27 22:16:42 +02:00
Tim Ledbetter
68035a2b8d LibWeb/CSS: Add the text-rendering property 2025-06-27 16:51:30 +01:00
Aliaksandr Kalenik
594194eb60 LibWeb: Skip serialization of implicit grid lines created during layout
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / 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
StyleValues created for grid-template-rows and grid-template-columns by
GFC should not include `-start`/`-end` lines implicitly created by grid
areas.
2025-06-25 20:45:48 +02:00
Tim Ledbetter
7a6e4f5ec8 LibWeb: Treat a CSS declaration with a "--" property name as invalid 2025-06-25 17:09:29 +01:00
Tim Ledbetter
bf37f3400e LibWeb: Don't treat "--" as a valid custom property name
This is reserved for future use by CSS.
2025-06-25 17:09:29 +01:00
Tim Ledbetter
b00e57139f LibWeb/CSS: Treat block at-rules with no block as invalid 2025-06-25 09:02:45 +02:00
Callum Law
536f8c395c LibWeb: Set numeric type of asin, acos, atan calculation results
Previously we were omitting the numeric type which meant these functions
weren't valid in some cases e.g. within rotate() functions.
2025-06-25 05:19:07 +01:00
Aliaksandr Kalenik
8d6f2390f6 LibWeb: Set grid-auto-* to initial values when parsing grid-template
...as `grid` property value.
2025-06-24 19:14:08 +02:00
Callum Law
6584ae0080 LibWeb: Treat CSS selectors containing undeclared namespaces as invalid
Selectors containing undeclared namespaces should be considered invalid,
not just not matching any elements.

Gains us 3 new WPT passes.
2025-06-24 12:51:12 +01:00
Callum Law
5fcf3d0b05 LibWeb: Combine shared stylesheet parsing functionality
No functionality changes
2025-06-24 12:51:12 +01:00
Luiz
da14e072b7 LibWeb: Correctly handle serialization of PseudoElements
Previusly the implementation only was serializing PseudoElements if they
were the last element in the CompoundSelector. This caused bugs on
Javascript code that referenced their selectorText, where it would be
wrong.
2025-06-24 12:44:44 +01:00
Gingeh
b85a8a23a7 LibWeb: Handle percentage font-size values 2025-06-24 12:42:26 +01:00
Tim Ledbetter
b46378085d LibWeb: Absolutize keyframe values before interpolating 2025-06-24 12:36:47 +01:00
Gingeh
4292344729 LibWeb: Don't skip last keyframe 2025-06-23 21:01:26 +02:00
Callum Law
89a08cb7cf LibWeb: Update CSSRule parent style sheet whenever parent rule changes 2025-06-23 15:21:36 +01:00
Callum Law
b0cdc3f03b LibWeb: Respect writing-mode and direction when mapping logical aliases 2025-06-23 15:19:07 +01:00
Callum Law
34a52baeed LibWeb: Add generic functionality for logical alias computed values 2025-06-23 15:19:07 +01:00
Callum Law
cfc8d3031b LibWeb: Map logical aliases at cascade time
Previously we would incorrectly map these in
`CSSStyleProperties::convert_declarations_to_specified_order`, aside
from being too early (as it meant we didn't maintain them as distinct
from their physical counterparts in CSSStyleProperties), this meant
that we didn't yet have the required context to map them correctly.

We now map them as part of the cascade process. To compute the mapping
context we do a cascade without mapping, and extract the relevant
properties (writing-direction and direction).
2025-06-23 15:19:07 +01:00
Callum Law
4e87f85458 LibWeb: Convert logical property shorthands to full-fledged shorthands
No functionality changes. This is just prep work for later commits
around moving logical alias mapping to cascade time
2025-06-23 15:19:07 +01:00
Callum Law
12581fa995 LibWeb: Resolve conflicts in compute_keyframe_values correctly
As conflict resolution depends on whether the property was set directly
or via a shorthand, we have to store the non-expanded values in the
resolved keyframe properties.
2025-06-23 15:19:07 +01:00
Tim Ledbetter
9b6da84fff LibWeb/CSS: Implement the font-kerning property
This sets whether the kerning information stored on the current font is
used.
2025-06-23 13:26:48 +01:00
Callum Law
80ea865b19 LibWeb: Use correct error for invalid rule in nested insertRule
When we try to insert a disallowed (non-nested) statement into a
CSSGroupingRule we should throw a `HierarchyRequestError` as it being
disallowed is a "constraint specified by CSS". Previously we would rely
on `Parser::is_valid_in_the_current_context` and throw a Syntax error.

There are more constraints to be implemented.
2025-06-23 12:52:40 +01:00
Callum Law
ef7ba02842 LibWeb: Throw error in insertRule when rule violates constraints 2025-06-23 12:52:40 +01:00
Callum Law
6144154e4f LibWeb: Ensure valid placement of @import and @namespace rules
These rules should appear before all other rules (excluding @layer
statements and @charset) with @import appearing first.
2025-06-23 12:52:40 +01:00
Aliaksandr Kalenik
6ec6e755b2 LibWeb: Merge consecutive grid lines in GridTrackSizeList
Fixes a bug where consecutively defined grid lines were not merged
during serialization.
2025-06-22 21:15:40 +02:00
Aliaksandr Kalenik
af602b2555 LibWeb: Align CSS Grid properties parsing with the specification
Reimplements `grid`, `grid-template`, `grid-template-rows`, and
`grid-template-columns` in a way that uses a separate function for each
grammar rule defined in the specification. This change results in many
additional passing tests from the already imported WPT suite. Most of
the remaining test failures are related to incorrect serialization of
grid properties.
2025-06-21 22:07:08 +02:00
Callum Law
d7036daa89 LibWeb: Disallow trailing tokens in @supports(<declaration>) 2025-06-21 11:49:43 +01:00
Sam Atkins
c1d4323cf7 LibWeb: Support counter-* properties on pseudo-elements
There are multiple things happening here which are interconnected:

- We now use AbstractElement to refer to the source of a counter, which
  means we also need to pass that around to compute `content`.

- Give AbstractElement new helper methods that are needed by
  CountersSet, so it doesn't have to care whether it's dealing with a
  true Element or PseudoElement.

- The CountersSet algorithms now walk the layout tree instead of DOM
  tree, so TreeBuilder needs to wait until the layout node exists
  before it resolves counters for it.

- Resolve counters when creating a pseudo-element's layout node. We
  awkwardly compute the `content` value up to twice: Once to figure out
  what kind of node we need to make, and then if it's a string, we do
  so again after counters are resolved so we can get the true value of
  any `counter()` functions. This will need adjusting in the future but
  it works for now.
2025-06-19 12:35:31 +01:00
Sam Atkins
498e143687 LibWeb/DOM: Stop including Element.h from AbstractElement.h
We only need the forward declaration here, and this will let us include
AbstractElement from Element.
2025-06-19 12:35:31 +01:00
Sam Atkins
dfce9974b5 LibWeb: Remove GeneratedPseudoElement enum
This doesn't currently provide any value over just using PseudoElement,
and makes it harder to work with PseudoElement in other places.
2025-06-19 12:35:31 +01:00
Sam Atkins
a57595faf5 LibWeb: Make [resolve,inherit]_counters() take AbstractElement
This is one of those cases where the spec says "element" and
means "element or pseudo-element". The easiest way to handle both is to
make these be free functions that take an AbstractElement, and then
give AbstractElement some helper methods so that the caller doesn't
have to care which it's dealing with.

There are some FIXMEs here because PseudoElement doesn't have a
CountersSet yet, and because the CountersSet currently uses a
UniqueNodeID to identify counter sources, which doesn't support
pseudo-elements.
2025-06-19 12:35:31 +01:00
Sam Atkins
ce380a59c7 LibWeb/DOM: Rename ElementReference to AbstractElement
This isn't some kind of identifier, it's a handle on an actual Element
or PseudoElement.
2025-06-19 12:35:31 +01:00
Tim Ledbetter
07b3b70a10 LibWeb: Return the correct computed value for opacity properties
Some checks are pending
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / 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-06-19 10:27:35 +02:00
Tim Ledbetter
269d5bb40e LibWeb: Resolve percentages for opacity properties at parse time 2025-06-19 10:27:35 +02:00
Gingeh
e96338dd63 LibWeb: Don't play initially-paused animations
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / 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-06-18 17:17:29 +02:00
Aliaksandr Kalenik
6169e91994 LibWeb: Delete redundant GridFitContent class from track representation
GridSize already supports the FitContent type, so there is no need to
additionally wrap it in a GridFitContent class.
2025-06-18 15:51:10 +01:00
Tim Ledbetter
e0af205d69 LibWeb/CSS: Implement the empty-cells property
This property sets whether table borders and backgrounds are painted
if a given table cell has no visible content.
2025-06-18 14:55:03 +01:00
Tim Ledbetter
fa1e02e5d7 LibWeb: Allow calc() values in cubic-bezier() easing functions 2025-06-18 08:57:06 +02:00
Tim Ledbetter
c5a3eaaf45 LibWeb: Allow calc() values in steps() easing functions 2025-06-18 08:57:06 +02:00
Veeti Paananen
21b531598d LibWeb/CSS: Fix reference bug when canonicalizing linear easing stops
+2 WPT tests
2025-06-18 08:53:10 +02:00
Aliaksandr Kalenik
b9b6927b85 LibWeb: Fix swapped strings for auto-fill and auto-fit in GridRepeat
...serialization.
2025-06-17 17:43:04 +01:00
Sam Atkins
7fe854c131 LibWeb/CSS: Link CalculationContext to new spec definition
Corresponds to ad244f3413

There's nothing that we need to do differently I think, but it's nice to
have a clear spec definition to refer to. :^)
2025-06-17 12:38:27 +01:00
Sam Atkins
a263ba78ed LibWeb/CSS: Add FIXME that color-mix() now takes 1+ colors, not 2
Corresponds to 83c7bffe51
2025-06-17 12:38:27 +01:00
Sam Atkins
1435480d76 LibWeb/CSS: Add fixme for sRGB color interpolation
Corresponds to a0a9886063
2025-06-17 12:38:27 +01:00
Tim Ledbetter
59a2e10a4e LibWeb: Distinguish between empty block at-rules and statement at-rules 2025-06-17 08:58:00 +01:00
Tim Ledbetter
701fcb9e87 LibWeb: Allow anonymous layer block rule with no declarations 2025-06-17 08:58:00 +01:00