Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-pseudo] add highlight tests for paired cascade #30688

Closed

Conversation

delan
Copy link
Member

@delan delan commented Sep 13, 2021

Note: these tests were merged in #30813!

This patch adds six reftests for the “paired cascade” rule at the end of #highlight-cascade:

  1. UA default highlight colors are not used when highlight pseudo cascade yields foreground color
  2. UA default highlight colors are not used when highlight pseudo cascade yields background color
  3. UA default highlight colors are used when highlight pseudo cascade yields only properties other than highlight colors
  4. rule includes highlight pseudos other than ::selection (tentative)
  5. UA default highlight colors are not used when highlight pseudo has declared color value of unset (tentative)
  6. UA default highlight colors are used when highlight pseudo has declared color value of revert

The tests and their tentativeness represent the current state of discussion in w3c/csswg-drafts#6386. They are reftests because paired cascade happens in used-value space. We might also want tests asserting that paired cascade applies to non-UA origins like author or animation or transition, but I’ll look into that separately.

Other changes that the UA makes to authors highlight colors (this comment describes three) can still cause unwanted failures in this kind of test. For example, Chromium currently fails 002 because it inverts background-color based on similarity with the foreground color. It might be possible to find clever workarounds for some of these tests, but I don’t know how to solve this problem for all #highlight-styling tests in general, nor do I know how to make these tests impervious to arbitrary UA changes to used highlight colors (rather than specific known changes).

@delan delan changed the title [css-pseudo] add highlight paired cascade tests [css-pseudo] add highlight tests for paired cascade Sep 13, 2021
chromium-wpt-export-bot pushed a commit that referenced this pull request Sep 16, 2021
This patch implements the inheritance-based propagation for highlight
pseudo-elements, as described in css-pseudo’s #highlight-cascade and
introduced in w3c/csswg-drafts#2474.

Highlight pseudos like ::selection were historically implemented such
that only the ::selection selector (*::selection) worked intuitively.
The spec’s processing model essentially makes it possible to define
both general ::selection styles and more specific ::selection styles.

We add a feature (HighlightInheritance) and a new computed style extra
field of type scoped_refptr<StyleHighlightData>, which in turn points
to four refcounted ComputedStyle instances, one for each highlight.
Only a handful of properties are applicable, but reusing ComputedStyle
like this simplifies the applying code, and allows us to share many of
the field groups between instances anyway.

We update the initial style singleton to point to a set of four empty
highlight styles, which we only use when the feature is enabled.

When the feature is disabled (or resolving custom ::highlight styles),
there is no functional change. Highlight styles are lazily computed on
paint’s demand, inherit only from the originating element styles, and
we store the result in the Element’s pseudo cache (StyleCachedData).

When the feature is enabled, we compute highlight styles during the
originating element’s recalc (RecalcOwnStyle), skipping any highlight
pseudos that the element had no matching rules for (a question that
can already be answered thanks to pseudo bits).

Style resolution is largely unchanged: we start with default styles,
then use output of the cascade to change those styles. But defaulting
is much easier for highlight styles: all properties are inherited, so
we can simply clone the whole ComputedStyle.

Relevant test page and screenshots:

• https://bucket.daz.cat/work/igalia/0/8.htmlhttps://bucket.daz.cat/4f37833aa15299a5.png (before)
• https://bucket.daz.cat/67d2abdd9bcda17c.png (after)

WPT already has some tests (css/css-pseudo/cascade-highlight-*), but
more thorough test coverage will land in these patches:

• #30688#30692

Bug: 1024156
Change-Id: I1f54f36ef2ac80165261a3f80d3a21cdf359c199
Cq-Do-Not-Cancel-Tryjobs: true
chromium-wpt-export-bot pushed a commit that referenced this pull request Sep 16, 2021
This patch implements the inheritance-based propagation for highlight
pseudo-elements, as described in css-pseudo’s #highlight-cascade and
introduced in w3c/csswg-drafts#2474.

Highlight pseudos like ::selection were historically implemented such
that only the ::selection selector (*::selection) worked intuitively.
The spec’s processing model essentially makes it possible to define
both general ::selection styles and more specific ::selection styles.

We add a feature (HighlightInheritance) and a new computed style extra
field of type scoped_refptr<StyleHighlightData>, which in turn points
to four refcounted ComputedStyle instances, one for each highlight.
Only a handful of properties are applicable, but reusing ComputedStyle
like this simplifies the applying code, and allows us to share many of
the field groups between instances anyway.

We update the initial style singleton to point to a set of four empty
highlight styles, which we only use when the feature is enabled.

When the feature is disabled (or resolving custom ::highlight styles),
there is no functional change. Highlight styles are lazily computed on
paint’s demand, inherit only from the originating element styles, and
we store the result in the Element’s pseudo cache (StyleCachedData).

When the feature is enabled, we compute highlight styles during the
originating element’s recalc (RecalcOwnStyle), skipping any highlight
pseudos that the element had no matching rules for (a question that
can already be answered thanks to pseudo bits).

Style resolution is largely unchanged: we start with default styles,
then use output of the cascade to change those styles. But defaulting
is much easier for highlight styles: all properties are inherited, so
we can simply clone the whole ComputedStyle.

Relevant test page and screenshots:

• https://bucket.daz.cat/work/igalia/0/8.htmlhttps://bucket.daz.cat/4f37833aa15299a5.png (before)
• https://bucket.daz.cat/67d2abdd9bcda17c.png (after)

WPT already has some tests (css/css-pseudo/cascade-highlight-*), but
more thorough test coverage will land in these patches:

• #30688#30692

Bug: 1024156
Change-Id: I1f54f36ef2ac80165261a3f80d3a21cdf359c199
Cq-Do-Not-Cancel-Tryjobs: true
chromium-wpt-export-bot pushed a commit that referenced this pull request Sep 16, 2021
This patch implements the inheritance-based propagation for highlight
pseudo-elements, as described in css-pseudo’s #highlight-cascade and
introduced in w3c/csswg-drafts#2474.

Highlight pseudos like ::selection were historically implemented such
that only the ::selection selector (*::selection) worked intuitively.
The spec’s processing model essentially makes it possible to define
both general ::selection styles and more specific ::selection styles.

We add a feature (HighlightInheritance) and a new computed style extra
field of type scoped_refptr<StyleHighlightData>, which in turn points
to four refcounted ComputedStyle instances, one for each highlight.
Only a handful of properties are applicable, but reusing ComputedStyle
like this simplifies the applying code, and allows us to share many of
the field groups between instances anyway.

We update the initial style singleton to point to a set of four empty
highlight styles, which we only use when the feature is enabled.

When the feature is disabled (or resolving custom ::highlight styles),
there is no functional change. Highlight styles are lazily computed on
paint’s demand, inherit only from the originating element styles, and
we store the result in the Element’s pseudo cache (StyleCachedData).

When the feature is enabled, we compute highlight styles during the
originating element’s recalc (RecalcOwnStyle), skipping any highlight
pseudos that the element had no matching rules for (a question that
can already be answered thanks to pseudo bits).

Style resolution is largely unchanged: we start with default styles,
then use output of the cascade to change those styles. But defaulting
is much easier for highlight styles: all properties are inherited, so
we can simply clone the whole ComputedStyle.

Relevant test page and screenshots:

• https://bucket.daz.cat/work/igalia/0/8.htmlhttps://bucket.daz.cat/4f37833aa15299a5.png (before)
• https://bucket.daz.cat/67d2abdd9bcda17c.png (after)

WPT already has some tests (css/css-pseudo/cascade-highlight-*), but
more thorough test coverage will land in these patches:

• #30688#30692

Bug: 1024156
Change-Id: I1f54f36ef2ac80165261a3f80d3a21cdf359c199
Cq-Do-Not-Cancel-Tryjobs: true
chromium-wpt-export-bot pushed a commit that referenced this pull request Sep 16, 2021
This patch implements the inheritance-based propagation for highlight
pseudo-elements, as described in css-pseudo’s #highlight-cascade and
introduced in w3c/csswg-drafts#2474.

Highlight pseudos like ::selection were historically implemented such
that only the ::selection selector (*::selection) worked intuitively.
The spec’s processing model essentially makes it possible to define
both general ::selection styles and more specific ::selection styles.

We add a feature (HighlightInheritance) and a new computed style extra
field of type scoped_refptr<StyleHighlightData>, which in turn points
to four refcounted ComputedStyle instances, one for each highlight.
Only a handful of properties are applicable, but reusing ComputedStyle
like this simplifies the applying code, and allows us to share many of
the field groups between instances anyway.

We update the initial style singleton to point to a set of four empty
highlight styles, which we only use when the feature is enabled.

When the feature is disabled (or resolving custom ::highlight styles),
there is no functional change. Highlight styles are lazily computed on
paint’s demand, inherit only from the originating element styles, and
we store the result in the Element’s pseudo cache (StyleCachedData).

When the feature is enabled, we compute highlight styles during the
originating element’s recalc (RecalcOwnStyle), skipping any highlight
pseudos that the element had no matching rules for (a question that
can already be answered thanks to pseudo bits).

Style resolution is largely unchanged: we start with default styles,
then use output of the cascade to change those styles. But defaulting
is much easier for highlight styles: all properties are inherited, so
we can simply clone the whole ComputedStyle.

Relevant test page and screenshots:

• https://bucket.daz.cat/work/igalia/0/8.htmlhttps://bucket.daz.cat/4f37833aa15299a5.png (before)
• https://bucket.daz.cat/67d2abdd9bcda17c.png (after)

WPT already has some tests (css/css-pseudo/cascade-highlight-*), but
more thorough test coverage will land in these patches:

• #30688#30692

Bug: 1024156
Change-Id: I1f54f36ef2ac80165261a3f80d3a21cdf359c199
Cq-Do-Not-Cancel-Tryjobs: true
chromium-wpt-export-bot pushed a commit that referenced this pull request Sep 16, 2021
This patch implements the inheritance-based propagation for highlight
pseudo-elements, as described in css-pseudo’s #highlight-cascade and
introduced in w3c/csswg-drafts#2474.

Highlight pseudos like ::selection were historically implemented such
that only the ::selection selector (*::selection) worked intuitively.
The spec’s processing model essentially makes it possible to define
both general ::selection styles and more specific ::selection styles.

We add a feature (HighlightInheritance) and a new computed style extra
field of type scoped_refptr<StyleHighlightData>, which in turn points
to four refcounted ComputedStyle instances, one for each highlight.
Only a handful of properties are applicable, but reusing ComputedStyle
like this simplifies the applying code, and allows us to share many of
the field groups between instances anyway.

We update the initial style singleton to point to a set of four empty
highlight styles, which we only use when the feature is enabled.

When the feature is disabled (or resolving custom ::highlight styles),
there is no functional change. Highlight styles are lazily computed on
paint’s demand, inherit only from the originating element styles, and
we store the result in the Element’s pseudo cache (StyleCachedData).

When the feature is enabled, we compute highlight styles during the
originating element’s recalc (RecalcOwnStyle), skipping any highlight
pseudos that the element had no matching rules for (a question that
can already be answered thanks to pseudo bits).

Style resolution is largely unchanged: we start with default styles,
then use output of the cascade to change those styles. But defaulting
is much easier for highlight styles: all properties are inherited, so
we can simply clone the whole ComputedStyle.

Relevant test page and screenshots:

• https://bucket.daz.cat/work/igalia/0/8.htmlhttps://bucket.daz.cat/4f37833aa15299a5.png (before)
• https://bucket.daz.cat/67d2abdd9bcda17c.png (after)

WPT already has some tests (css/css-pseudo/cascade-highlight-*), but
more thorough test coverage will land in these patches:

• #30688#30692

Bug: 1024156
Change-Id: I1f54f36ef2ac80165261a3f80d3a21cdf359c199
Cq-Do-Not-Cancel-Tryjobs: true
chromium-wpt-export-bot pushed a commit that referenced this pull request Sep 16, 2021
This patch implements the inheritance-based propagation for highlight
pseudo-elements, as described in css-pseudo’s #highlight-cascade and
introduced in w3c/csswg-drafts#2474.

Highlight pseudos like ::selection were historically implemented such
that only the ::selection selector (*::selection) worked intuitively.
The spec’s processing model essentially makes it possible to define
both general ::selection styles and more specific ::selection styles.

We add a feature (HighlightInheritance) and a new computed style extra
field of type scoped_refptr<StyleHighlightData>, which in turn points
to four refcounted ComputedStyle instances, one for each highlight.
Only a handful of properties are applicable, but reusing ComputedStyle
like this simplifies the applying code, and allows us to share many of
the field groups between instances anyway.

We update the initial style singleton to point to a set of four empty
highlight styles, which we only use when the feature is enabled.

When the feature is disabled (or resolving custom ::highlight styles),
there is no functional change. Highlight styles are lazily computed on
paint’s demand, inherit only from the originating element styles, and
we store the result in the Element’s pseudo cache (StyleCachedData).

When the feature is enabled, we compute highlight styles during the
originating element’s recalc (RecalcOwnStyle), skipping any highlight
pseudos that the element had no matching rules for (a question that
can already be answered thanks to pseudo bits).

Style resolution is largely unchanged: we start with default styles,
then use output of the cascade to change those styles. But defaulting
is much easier for highlight styles: all properties are inherited, so
we can simply clone the whole ComputedStyle.

Relevant test page and screenshots:

• https://bucket.daz.cat/work/igalia/0/8.htmlhttps://bucket.daz.cat/4f37833aa15299a5.png (before)
• https://bucket.daz.cat/67d2abdd9bcda17c.png (after)

WPT already has some tests (css/css-pseudo/cascade-highlight-*), but
more thorough test coverage will land in these patches:

• #30688#30692

Bug: 1024156
Change-Id: I1f54f36ef2ac80165261a3f80d3a21cdf359c199
Cq-Do-Not-Cancel-Tryjobs: true
chromium-wpt-export-bot pushed a commit that referenced this pull request Sep 20, 2021
This patch implements the inheritance-based propagation for highlight
pseudo-elements, as described in css-pseudo’s #highlight-cascade and
introduced in w3c/csswg-drafts#2474.

Highlight pseudos like ::selection were historically implemented such
that only the ::selection selector (*::selection) worked intuitively.
The spec’s processing model essentially makes it possible to define
both general ::selection styles and more specific ::selection styles.

We add a feature (HighlightInheritance) and a new computed style extra
field of type scoped_refptr<StyleHighlightData>, which in turn points
to four refcounted ComputedStyle instances, one for each highlight.
Only a handful of properties are applicable, but reusing ComputedStyle
like this simplifies the applying code, and allows us to share many of
the field groups between instances anyway.

We update the initial style singleton to point to a set of four empty
highlight styles, which we only use when the feature is enabled.

When the feature is disabled (or resolving custom ::highlight styles),
there is no functional change. Highlight styles are lazily computed on
paint’s demand, inherit only from the originating element styles, and
we store the result in the Element’s pseudo cache (StyleCachedData).

When the feature is enabled, we compute highlight styles during the
originating element’s recalc (RecalcOwnStyle), skipping any highlight
pseudos that the element had no matching rules for (a question that
can already be answered thanks to pseudo bits).

Style resolution is largely unchanged: we start with default styles,
then use output of the cascade to change those styles. But defaulting
is much easier for highlight styles: all properties are inherited, so
we can simply clone the whole ComputedStyle.

Relevant test page and screenshots:

• https://bucket.daz.cat/work/igalia/0/8.htmlhttps://bucket.daz.cat/4f37833aa15299a5.png (before)
• https://bucket.daz.cat/67d2abdd9bcda17c.png (after)

WPT already has some tests (css/css-pseudo/cascade-highlight-*), but
more thorough test coverage will land in these patches:

• #30688#30692

Bug: 1024156
Change-Id: I1f54f36ef2ac80165261a3f80d3a21cdf359c199
Cq-Do-Not-Cancel-Tryjobs: true
chromium-wpt-export-bot pushed a commit that referenced this pull request Sep 20, 2021
This patch implements the inheritance-based propagation for highlight
pseudo-elements, as described in css-pseudo’s #highlight-cascade and
introduced in w3c/csswg-drafts#2474.

Highlight pseudos like ::selection were historically implemented such
that only the ::selection selector (*::selection) worked intuitively.
The spec’s processing model essentially makes it possible to define
both general ::selection styles and more specific ::selection styles.

We add a feature (HighlightInheritance) and a new computed style extra
field of type scoped_refptr<StyleHighlightData>, which in turn points
to four refcounted ComputedStyle instances, one for each highlight.
Only a handful of properties are applicable, but reusing ComputedStyle
like this simplifies the applying code, and allows us to share many of
the field groups between instances anyway.

We update the initial style singleton to point to a set of four empty
highlight styles, which we only use when the feature is enabled.

When the feature is disabled (or resolving custom ::highlight styles),
there is no functional change. Highlight styles are lazily computed on
paint’s demand, inherit only from the originating element styles, and
we store the result in the Element’s pseudo cache (StyleCachedData).

When the feature is enabled, we compute highlight styles during the
originating element’s recalc (RecalcOwnStyle), skipping any highlight
pseudos that the element had no matching rules for (a question that
can already be answered thanks to pseudo bits).

Style resolution is largely unchanged: we start with default styles,
then use output of the cascade to change those styles. But defaulting
is much easier for highlight styles: all properties are inherited, so
we can simply clone the whole ComputedStyle.

Relevant test page and screenshots:

• https://bucket.daz.cat/work/igalia/0/8.htmlhttps://bucket.daz.cat/4f37833aa15299a5.png (before)
• https://bucket.daz.cat/67d2abdd9bcda17c.png (after)

WPT already has some tests (css/css-pseudo/cascade-highlight-*), but
more thorough test coverage will land in these patches:

• #30688#30692

Bug: 1024156
Change-Id: I1f54f36ef2ac80165261a3f80d3a21cdf359c199
Cq-Do-Not-Cancel-Tryjobs: true
chromium-wpt-export-bot pushed a commit that referenced this pull request Sep 20, 2021
This patch implements the inheritance-based propagation for highlight
pseudo-elements, as described in css-pseudo’s #highlight-cascade and
introduced in w3c/csswg-drafts#2474.

Highlight pseudos like ::selection were historically implemented such
that only the ::selection selector (*::selection) worked intuitively.
The spec’s processing model essentially makes it possible to define
both general ::selection styles and more specific ::selection styles.

We add a feature (HighlightInheritance) and a new computed style extra
field of type scoped_refptr<StyleHighlightData>, which in turn points
to four refcounted ComputedStyle instances, one for each highlight.
Only a handful of properties are applicable, but reusing ComputedStyle
like this simplifies the applying code, and allows us to share many of
the field groups between instances anyway.

We update the initial style singleton to point to a set of four empty
highlight styles, which we only use when the feature is enabled.

When the feature is disabled (or resolving custom ::highlight styles),
there is no functional change. Highlight styles are lazily computed on
paint’s demand, inherit only from the originating element styles, and
we store the result in the Element’s pseudo cache (StyleCachedData).

When the feature is enabled, we compute highlight styles during the
originating element’s recalc (RecalcOwnStyle), skipping any highlight
pseudos that the element had no matching rules for (a question that
can already be answered thanks to pseudo bits).

Style resolution is largely unchanged: we start with default styles,
then use output of the cascade to change those styles. But defaulting
is much easier for highlight styles: all properties are inherited, so
we can simply clone the whole ComputedStyle.

Relevant test page and screenshots:

• https://bucket.daz.cat/work/igalia/0/8.htmlhttps://bucket.daz.cat/4f37833aa15299a5.png (before)
• https://bucket.daz.cat/67d2abdd9bcda17c.png (after)

WPT already has some tests (css/css-pseudo/cascade-highlight-*), but
more thorough test coverage will land in these patches:

• #30688#30692

Bug: 1024156
Change-Id: I1f54f36ef2ac80165261a3f80d3a21cdf359c199
Cq-Do-Not-Cancel-Tryjobs: true
chromium-wpt-export-bot pushed a commit that referenced this pull request Sep 22, 2021
This patch implements the inheritance-based propagation for highlight
pseudo-elements, as described in css-pseudo’s #highlight-cascade and
introduced in w3c/csswg-drafts#2474.

Highlight pseudos like ::selection were historically implemented such
that only the ::selection selector (*::selection) worked intuitively.
The spec’s processing model essentially makes it possible to define
both general ::selection styles and more specific ::selection styles.

We add a feature (HighlightInheritance) and a new computed style extra
field of type scoped_refptr<StyleHighlightData>, which in turn points
to four refcounted ComputedStyle instances, one for each highlight.
Only a handful of properties are applicable, but reusing ComputedStyle
like this simplifies the applying code, and allows us to share many of
the field groups between instances anyway.

We update the initial style singleton to point to a set of four empty
highlight styles, which we only use when the feature is enabled.

When the feature is disabled (or resolving custom ::highlight styles),
there is no functional change. Highlight styles are lazily computed on
paint’s demand, inherit only from the originating element styles, and
we store the result in the Element’s pseudo cache (StyleCachedData).

When the feature is enabled, we compute highlight styles during the
originating element’s recalc (RecalcOwnStyle), skipping any highlight
pseudos that the element had no matching rules for (a question that
can already be answered thanks to pseudo bits).

Style resolution is largely unchanged: we start with default styles,
then use output of the cascade to change those styles. But defaulting
is much easier for highlight styles: all properties are inherited, so
we can simply clone the whole ComputedStyle.

Relevant test page and screenshots:

• https://bucket.daz.cat/work/igalia/0/8.htmlhttps://bucket.daz.cat/4f37833aa15299a5.png (before)
• https://bucket.daz.cat/67d2abdd9bcda17c.png (after)

WPT already has some tests (css/css-pseudo/cascade-highlight-*), but
more thorough test coverage will land in these patches:

• #30688#30692

Bug: 1024156
Change-Id: I1f54f36ef2ac80165261a3f80d3a21cdf359c199
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2850068
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Reviewed-by: Mason Freed <masonf@chromium.org>
Commit-Queue: Delan Azabani <dazabani@igalia.com>
Cr-Commit-Position: refs/heads/main@{#923485}
chromium-wpt-export-bot pushed a commit that referenced this pull request Sep 22, 2021
This patch implements the inheritance-based propagation for highlight
pseudo-elements, as described in css-pseudo’s #highlight-cascade and
introduced in w3c/csswg-drafts#2474.

Highlight pseudos like ::selection were historically implemented such
that only the ::selection selector (*::selection) worked intuitively.
The spec’s processing model essentially makes it possible to define
both general ::selection styles and more specific ::selection styles.

We add a feature (HighlightInheritance) and a new computed style extra
field of type scoped_refptr<StyleHighlightData>, which in turn points
to four refcounted ComputedStyle instances, one for each highlight.
Only a handful of properties are applicable, but reusing ComputedStyle
like this simplifies the applying code, and allows us to share many of
the field groups between instances anyway.

We update the initial style singleton to point to a set of four empty
highlight styles, which we only use when the feature is enabled.

When the feature is disabled (or resolving custom ::highlight styles),
there is no functional change. Highlight styles are lazily computed on
paint’s demand, inherit only from the originating element styles, and
we store the result in the Element’s pseudo cache (StyleCachedData).

When the feature is enabled, we compute highlight styles during the
originating element’s recalc (RecalcOwnStyle), skipping any highlight
pseudos that the element had no matching rules for (a question that
can already be answered thanks to pseudo bits).

Style resolution is largely unchanged: we start with default styles,
then use output of the cascade to change those styles. But defaulting
is much easier for highlight styles: all properties are inherited, so
we can simply clone the whole ComputedStyle.

Relevant test page and screenshots:

• https://bucket.daz.cat/work/igalia/0/8.htmlhttps://bucket.daz.cat/4f37833aa15299a5.png (before)
• https://bucket.daz.cat/67d2abdd9bcda17c.png (after)

WPT already has some tests (css/css-pseudo/cascade-highlight-*), but
more thorough test coverage will land in these patches:

• #30688#30692

Bug: 1024156
Change-Id: I1f54f36ef2ac80165261a3f80d3a21cdf359c199
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2850068
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Reviewed-by: Mason Freed <masonf@chromium.org>
Commit-Queue: Delan Azabani <dazabani@igalia.com>
Cr-Commit-Position: refs/heads/main@{#923485}
@wpt-pr-bot
Copy link
Collaborator

There are no reviewers for this pull request. Please reach out on W3C's irc server (irc.w3.org, port 6665) on channel #testing (web client) to get help with this. Thank you!

@delan
Copy link
Member Author

delan commented Sep 22, 2021

@frivoal these tests were also merged as part of #30813, but might be worth merging this for the commit message anyway. Of course, let me know if you have any concerns about the tests.

@delan
Copy link
Member Author

delan commented Sep 23, 2021

Closing for now, because adding tests in two places causes problems like #30905.

@delan delan closed this Sep 23, 2021
@delan delan deleted the add-highlight-inheritance-tests branch September 23, 2021 07:23
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Oct 3, 2021
Automatic update from web-platform-tests
CSS highlight processing model

This patch implements the inheritance-based propagation for highlight
pseudo-elements, as described in css-pseudo’s #highlight-cascade and
introduced in w3c/csswg-drafts#2474.

Highlight pseudos like ::selection were historically implemented such
that only the ::selection selector (*::selection) worked intuitively.
The spec’s processing model essentially makes it possible to define
both general ::selection styles and more specific ::selection styles.

We add a feature (HighlightInheritance) and a new computed style extra
field of type scoped_refptr<StyleHighlightData>, which in turn points
to four refcounted ComputedStyle instances, one for each highlight.
Only a handful of properties are applicable, but reusing ComputedStyle
like this simplifies the applying code, and allows us to share many of
the field groups between instances anyway.

We update the initial style singleton to point to a set of four empty
highlight styles, which we only use when the feature is enabled.

When the feature is disabled (or resolving custom ::highlight styles),
there is no functional change. Highlight styles are lazily computed on
paint’s demand, inherit only from the originating element styles, and
we store the result in the Element’s pseudo cache (StyleCachedData).

When the feature is enabled, we compute highlight styles during the
originating element’s recalc (RecalcOwnStyle), skipping any highlight
pseudos that the element had no matching rules for (a question that
can already be answered thanks to pseudo bits).

Style resolution is largely unchanged: we start with default styles,
then use output of the cascade to change those styles. But defaulting
is much easier for highlight styles: all properties are inherited, so
we can simply clone the whole ComputedStyle.

Relevant test page and screenshots:

• https://bucket.daz.cat/work/igalia/0/8.htmlhttps://bucket.daz.cat/4f37833aa15299a5.png (before)
• https://bucket.daz.cat/67d2abdd9bcda17c.png (after)

WPT already has some tests (css/css-pseudo/cascade-highlight-*), but
more thorough test coverage will land in these patches:

• web-platform-tests/wpt#30688web-platform-tests/wpt#30692

Bug: 1024156
Change-Id: I1f54f36ef2ac80165261a3f80d3a21cdf359c199
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2850068
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Reviewed-by: Mason Freed <masonf@chromium.org>
Commit-Queue: Delan Azabani <dazabani@igalia.com>
Cr-Commit-Position: refs/heads/main@{#923485}

--

wpt-commits: 4eb26e6225ed30a6cfc73eb743eaf9f59086521c
wpt-pr: 30813
jamienicol pushed a commit to jamienicol/gecko that referenced this pull request Oct 4, 2021
Automatic update from web-platform-tests
CSS highlight processing model

This patch implements the inheritance-based propagation for highlight
pseudo-elements, as described in css-pseudo’s #highlight-cascade and
introduced in w3c/csswg-drafts#2474.

Highlight pseudos like ::selection were historically implemented such
that only the ::selection selector (*::selection) worked intuitively.
The spec’s processing model essentially makes it possible to define
both general ::selection styles and more specific ::selection styles.

We add a feature (HighlightInheritance) and a new computed style extra
field of type scoped_refptr<StyleHighlightData>, which in turn points
to four refcounted ComputedStyle instances, one for each highlight.
Only a handful of properties are applicable, but reusing ComputedStyle
like this simplifies the applying code, and allows us to share many of
the field groups between instances anyway.

We update the initial style singleton to point to a set of four empty
highlight styles, which we only use when the feature is enabled.

When the feature is disabled (or resolving custom ::highlight styles),
there is no functional change. Highlight styles are lazily computed on
paint’s demand, inherit only from the originating element styles, and
we store the result in the Element’s pseudo cache (StyleCachedData).

When the feature is enabled, we compute highlight styles during the
originating element’s recalc (RecalcOwnStyle), skipping any highlight
pseudos that the element had no matching rules for (a question that
can already be answered thanks to pseudo bits).

Style resolution is largely unchanged: we start with default styles,
then use output of the cascade to change those styles. But defaulting
is much easier for highlight styles: all properties are inherited, so
we can simply clone the whole ComputedStyle.

Relevant test page and screenshots:

• https://bucket.daz.cat/work/igalia/0/8.htmlhttps://bucket.daz.cat/4f37833aa15299a5.png (before)
• https://bucket.daz.cat/67d2abdd9bcda17c.png (after)

WPT already has some tests (css/css-pseudo/cascade-highlight-*), but
more thorough test coverage will land in these patches:

• web-platform-tests/wpt#30688web-platform-tests/wpt#30692

Bug: 1024156
Change-Id: I1f54f36ef2ac80165261a3f80d3a21cdf359c199
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2850068
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Reviewed-by: Mason Freed <masonf@chromium.org>
Commit-Queue: Delan Azabani <dazabani@igalia.com>
Cr-Commit-Position: refs/heads/main@{#923485}

--

wpt-commits: 4eb26e6225ed30a6cfc73eb743eaf9f59086521c
wpt-pr: 30813
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Oct 4, 2021
Automatic update from web-platform-tests
CSS highlight processing model

This patch implements the inheritance-based propagation for highlight
pseudo-elements, as described in css-pseudo’s #highlight-cascade and
introduced in w3c/csswg-drafts#2474.

Highlight pseudos like ::selection were historically implemented such
that only the ::selection selector (*::selection) worked intuitively.
The spec’s processing model essentially makes it possible to define
both general ::selection styles and more specific ::selection styles.

We add a feature (HighlightInheritance) and a new computed style extra
field of type scoped_refptr<StyleHighlightData>, which in turn points
to four refcounted ComputedStyle instances, one for each highlight.
Only a handful of properties are applicable, but reusing ComputedStyle
like this simplifies the applying code, and allows us to share many of
the field groups between instances anyway.

We update the initial style singleton to point to a set of four empty
highlight styles, which we only use when the feature is enabled.

When the feature is disabled (or resolving custom ::highlight styles),
there is no functional change. Highlight styles are lazily computed on
paint’s demand, inherit only from the originating element styles, and
we store the result in the Element’s pseudo cache (StyleCachedData).

When the feature is enabled, we compute highlight styles during the
originating element’s recalc (RecalcOwnStyle), skipping any highlight
pseudos that the element had no matching rules for (a question that
can already be answered thanks to pseudo bits).

Style resolution is largely unchanged: we start with default styles,
then use output of the cascade to change those styles. But defaulting
is much easier for highlight styles: all properties are inherited, so
we can simply clone the whole ComputedStyle.

Relevant test page and screenshots:

• https://bucket.daz.cat/work/igalia/0/8.htmlhttps://bucket.daz.cat/4f37833aa15299a5.png (before)
• https://bucket.daz.cat/67d2abdd9bcda17c.png (after)

WPT already has some tests (css/css-pseudo/cascade-highlight-*), but
more thorough test coverage will land in these patches:

• web-platform-tests/wpt#30688web-platform-tests/wpt#30692

Bug: 1024156
Change-Id: I1f54f36ef2ac80165261a3f80d3a21cdf359c199
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2850068
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Reviewed-by: Mason Freed <masonf@chromium.org>
Commit-Queue: Delan Azabani <dazabani@igalia.com>
Cr-Commit-Position: refs/heads/main@{#923485}

--

wpt-commits: 4eb26e6225ed30a6cfc73eb743eaf9f59086521c
wpt-pr: 30813
jamienicol pushed a commit to jamienicol/gecko that referenced this pull request Oct 6, 2021
Automatic update from web-platform-tests
CSS highlight processing model

This patch implements the inheritance-based propagation for highlight
pseudo-elements, as described in css-pseudo’s #highlight-cascade and
introduced in w3c/csswg-drafts#2474.

Highlight pseudos like ::selection were historically implemented such
that only the ::selection selector (*::selection) worked intuitively.
The spec’s processing model essentially makes it possible to define
both general ::selection styles and more specific ::selection styles.

We add a feature (HighlightInheritance) and a new computed style extra
field of type scoped_refptr<StyleHighlightData>, which in turn points
to four refcounted ComputedStyle instances, one for each highlight.
Only a handful of properties are applicable, but reusing ComputedStyle
like this simplifies the applying code, and allows us to share many of
the field groups between instances anyway.

We update the initial style singleton to point to a set of four empty
highlight styles, which we only use when the feature is enabled.

When the feature is disabled (or resolving custom ::highlight styles),
there is no functional change. Highlight styles are lazily computed on
paint’s demand, inherit only from the originating element styles, and
we store the result in the Element’s pseudo cache (StyleCachedData).

When the feature is enabled, we compute highlight styles during the
originating element’s recalc (RecalcOwnStyle), skipping any highlight
pseudos that the element had no matching rules for (a question that
can already be answered thanks to pseudo bits).

Style resolution is largely unchanged: we start with default styles,
then use output of the cascade to change those styles. But defaulting
is much easier for highlight styles: all properties are inherited, so
we can simply clone the whole ComputedStyle.

Relevant test page and screenshots:

• https://bucket.daz.cat/work/igalia/0/8.htmlhttps://bucket.daz.cat/4f37833aa15299a5.png (before)
• https://bucket.daz.cat/67d2abdd9bcda17c.png (after)

WPT already has some tests (css/css-pseudo/cascade-highlight-*), but
more thorough test coverage will land in these patches:

• web-platform-tests/wpt#30688web-platform-tests/wpt#30692

Bug: 1024156
Change-Id: I1f54f36ef2ac80165261a3f80d3a21cdf359c199
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2850068
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Reviewed-by: Mason Freed <masonf@chromium.org>
Commit-Queue: Delan Azabani <dazabani@igalia.com>
Cr-Commit-Position: refs/heads/main@{#923485}

--

wpt-commits: 4eb26e6225ed30a6cfc73eb743eaf9f59086521c
wpt-pr: 30813
Gabisampaio pushed a commit to Gabisampaio/wpt that referenced this pull request Nov 18, 2021
This patch implements the inheritance-based propagation for highlight
pseudo-elements, as described in css-pseudo’s #highlight-cascade and
introduced in w3c/csswg-drafts#2474.

Highlight pseudos like ::selection were historically implemented such
that only the ::selection selector (*::selection) worked intuitively.
The spec’s processing model essentially makes it possible to define
both general ::selection styles and more specific ::selection styles.

We add a feature (HighlightInheritance) and a new computed style extra
field of type scoped_refptr<StyleHighlightData>, which in turn points
to four refcounted ComputedStyle instances, one for each highlight.
Only a handful of properties are applicable, but reusing ComputedStyle
like this simplifies the applying code, and allows us to share many of
the field groups between instances anyway.

We update the initial style singleton to point to a set of four empty
highlight styles, which we only use when the feature is enabled.

When the feature is disabled (or resolving custom ::highlight styles),
there is no functional change. Highlight styles are lazily computed on
paint’s demand, inherit only from the originating element styles, and
we store the result in the Element’s pseudo cache (StyleCachedData).

When the feature is enabled, we compute highlight styles during the
originating element’s recalc (RecalcOwnStyle), skipping any highlight
pseudos that the element had no matching rules for (a question that
can already be answered thanks to pseudo bits).

Style resolution is largely unchanged: we start with default styles,
then use output of the cascade to change those styles. But defaulting
is much easier for highlight styles: all properties are inherited, so
we can simply clone the whole ComputedStyle.

Relevant test page and screenshots:

• https://bucket.daz.cat/work/igalia/0/8.htmlhttps://bucket.daz.cat/4f37833aa15299a5.png (before)
• https://bucket.daz.cat/67d2abdd9bcda17c.png (after)

WPT already has some tests (css/css-pseudo/cascade-highlight-*), but
more thorough test coverage will land in these patches:

• web-platform-tests#30688web-platform-tests#30692

Bug: 1024156
Change-Id: I1f54f36ef2ac80165261a3f80d3a21cdf359c199
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2850068
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Reviewed-by: Mason Freed <masonf@chromium.org>
Commit-Queue: Delan Azabani <dazabani@igalia.com>
Cr-Commit-Position: refs/heads/main@{#923485}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants