Skip to content

[css-contain] content-visibility and SVG #9466

Open

Description

@rwlbuis

From my current interpretation content-visibility does not apply to most SVG elements since content-visibility applies to
"elements for which [size containment] can apply" (https://drafts.csswg.org/css-contain/#content-visibility)

and (size) contain has a special rule about applying to svg:
"In addition, in the case of [SVG2], the contain property only applies to svg elements that have an associated CSS layout box."
(https://drafts.csswg.org/css-contain/#contain-applies)

So, would that be just outer <svg> and <foreignObject> elements?

I am willing to write some WPT tests for this since I don't think this is actually tested on SVG elements at this time.

Activity

  1. rwlbuis commented on Oct 16, 2023

    @rwlbuis
    Author

    I added a test on an SVG element that has no associated CSS layout box (<g>):
    web-platform-tests/wpt#42552

  2. rwlbuis commented on Oct 16, 2023

    @rwlbuis
    Author

    @vmpstr what is your interpretation? Also feel free to add more people :)

  3. vmpstr commented on Oct 16, 2023

    @vmpstr
    Member

    This interpretation makes sense to me. Size containment is important for the optimization that c-v makes, so if it doesn't apply, then c-v should also not apply.

    To confirm: the spec would not need to change, since it effectively states this, right?

  4. rwlbuis commented on Oct 18, 2023

    @rwlbuis
    Author

    To confirm: the spec would not need to change, since it effectively states this, right?

    Well, one thing I could not find in the specifications is which SVG elements have an associated CSS layout box. Because I kind of know from the implementation to me it sort of is clear, not sure for others.

    I realised we do not really test the root <svg>, so I created web-platform-tests/wpt#42594.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions