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

Highlight API: Don't paint unstyled custom highlights #32759

Merged
merged 1 commit into from
Feb 9, 2022

Conversation

chromium-wpt-export-bot
Copy link
Collaborator

@chromium-wpt-export-bot chromium-wpt-export-bot commented Feb 9, 2022

The custom highlight API spec [1] currently states that an unstyled
custom highlight should inherit the styles of its originating element.
The Blink implementation follows this.

However, this behavior can lead to some unintuitive results where
unstyled highlights can affect the painting of the originating
element, or paint over other highlights. This issue was pointed out
in [2], and spec changes to fix this are pending editor review.
A goal of these changes are that unstyled custom highlights do not
affect rendering at all.

This change updates the custom highlights implementation to achieve
this by giving them a default 'transparent' foreground and background
color.

Some of our tests were validating the earlier unintuitive behavior
involving overlapping ranges. These are updated, along with the
addition of a new test to validate that a single unstyled highlight
doesn't affect rendering.

[1] https://drafts.csswg.org/css-highlight-api-1/#default-styles
[2] w3c/csswg-drafts#6779

Bug: 1295271
Change-Id: Id7dc877c90c08240fbe79edeeeec551cdc5508c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3449336
Reviewed-by: Delan Azabani <dazabani@igalia.com>
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Commit-Queue: Dan Clark <daniec@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#969007}

Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review process for this patch is being conducted in the Chromium project.

The custom highlight API spec [1] currently states that an unstyled
custom highlight should inherit the styles of its originating element.
The Blink implementation follows this.

However, this behavior can lead to some unintuitive results where
unstyled highlights can affect the painting of the originating
element, or paint over other highlights. This issue was pointed out
in [2], and spec changes to fix this are pending editor review.
A goal of these changes are that unstyled custom highlights do not
affect rendering at all.

This change updates the custom highlights implementation to achieve
this by giving them a default 'transparent' foreground and background
color.

Some of our tests were validating the earlier unintuitive behavior
involving overlapping ranges. These are updated, along with the
addition of a new test to validate that a single unstyled highlight
doesn't affect rendering.

[1] https://drafts.csswg.org/css-highlight-api-1/#default-styles
[2] w3c/csswg-drafts#6779

Bug: 1295271
Change-Id: Id7dc877c90c08240fbe79edeeeec551cdc5508c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3449336
Reviewed-by: Delan Azabani <dazabani@igalia.com>
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Commit-Queue: Dan Clark <daniec@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#969007}
@chromium-wpt-export-bot chromium-wpt-export-bot merged commit 40d5e6d into master Feb 9, 2022
@chromium-wpt-export-bot chromium-wpt-export-bot deleted the chromium-export-cl-3449336 branch February 9, 2022 19:05
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.

3 participants