Commit Graph

3 Commits

Author SHA1 Message Date
Andreu Botella
f4307334dc script: Make link elements set ElementState::UNVISITED (#41478)
In Servo, the `:link` and `:any-link` pseudo-classes correctly match
link elements when they are part of a compound selector whose last
simple selector does not start with them (e.g. `a:link` or `:link b`),
but they do not match when the last simple selector starts with `:link`.

The reason for this seems to be that Stylo uses two methods to determine
whether an element is an (unvisited) link: to call the `is_link()`
method on the `selectors::Element` trait, and to check if the element's
state has `ElementState::UNVISITED` set.

In a browser like Servo which does not support visited styles, these two
checks should be equivalent. However, they turn out not to be, because
Servo never actually sets `ElementState::UNVISITED`.

Since per the HTML spec the `:link` selector applies to all `<a>` and
`<area>` elements that have an `href` attribute, this patch fixes this
by setting `ElementState::UNVISITED` on such elements when the `href`
attribute is set, and by unsetting it when it is removed.

Testing: There are two invalidation-related WPT tests about the
`:any-link` selector that now pass with this patch.

Fixes: servo/stylo#282

---------

Signed-off-by: Andreu Botella <andreu@andreubotella.com>
2025-12-24 08:00:40 +00:00
Martin Robinson
0eda2de19f style: Add support for is() and where() selectors (#34066)
Additionally, changes now need to be made to `servo.css` in order to
ensure that `<button>` text is centered the same way that it is for
`<input type=button>`. In the past the rule for centering text for the
latter was ignored because it used `:is()`.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-11-19 14:05:46 +00:00
Oriol Brufau
2b1d342102 Enable more css tests (#31469)
* Enable more css tests

In particular, these directories are no longer skipped:
 - CSS1 (has no tests)
 - css-box (except margin-trim)
 - css-cascade
 - css-display (except run-in)
 - css-easing
 - css-env
 - css-lists
 - css-namespaces
 - css-overflow
 - css-pseudo
 - css-sizing (except aspect-ratio and contain-intrinsic-size)
 - css-syntax
 - reference
 - support (has no tests)

* Sort list properly

* Explicitly list skipped directories

* Do not skip css tests by default

* Add expectations
2024-03-01 07:49:39 +00:00