Skip to content

[css-highlight-api-1] Don't paint highlights that cross contain boundaries #6734

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

Closed
wants to merge 3 commits into from

Conversation

dandclark
Copy link
Contributor

If a StaticRange crosses a contain boundary and the boundary point inside the contained element is removed, UAs would have to stop painting the full extent of the range. This would violate the contain invariant, since a change inside the element with contain would have affected the appearance of content outside of that element.

To eliminate this problem, never paint ranges that cross contain boundaries.

A slightly more scoped solution would be to apply this limitation only for highlights specified with StaticRange, but since there doesn't seem to be any use case for applying highlights across contain boundaries, the limitation is applied to live Ranges as well for consistency's sake.

This PR changes the range-painting criteria into an algorithm, since precisely expressing the concept of "crossing a contain boundary" is clumsy in prose.

Resolves #4598.

@ffiori
Copy link
Member

ffiori commented Oct 18, 2021

Just a comment about style, when running Bikeshed to get a preview, it shows a fatal error:

FATAL ERROR: Line 514 isn't indented enough (needs 2 indents) to be valid Markdown:
"	   then return false."
 ✘ Did not generate, due to fatal errors

I think it can be fixed by using two tabs instead of tab+spaces.

@dandclark
Copy link
Contributor Author

Just a comment about style, when running Bikeshed to get a preview, it shows a fatal errorm

@ffiori Thanks for pointing that out! Without noticing, I had been including a command line argument that was suppressing errors. Should be fixed now.

@dandclark dandclark requested a review from sanketj October 18, 2021 22:47
@sanketj
Copy link
Member

sanketj commented Oct 19, 2021

@dandclark These changes LGTM, so I went ahead and approved. However, we should get consensus from the working group on this before merging.

@dandclark
Copy link
Contributor Author

Abandoning this since we resolved in #4598 to ignore contain boundaries.

@dandclark dandclark closed this Feb 3, 2022
@frivoal frivoal added Closed Rejected as Wontfix by CSSWG Resolution Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. labels Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed Rejected as Wontfix by CSSWG Resolution Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. css-highlight-api-1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[css-highlight-api][css-contain] static ranges and css-contain
4 participants