Skip to content

[css-overflow-4] overflow-clip-margin's ommited default box #13185

@emilio

Description

@emilio

overflow-clip-margin has a very weird special behavior for the default visual box, which doesn't match implementations:

https://drafts.csswg.org/css-overflow-4/#propdef-overflow-clip-margin:

If omitted, defaults to padding-box on non-replaced elements, or content-box on replaced elements.

Test-case would be:

<!doctype html>
<style>
.image {
  border-radius: 100%;
  height: 100px;
  width: 100px;
  position: absolute;
  top: 100px;
  left: 100px;
  object-fit: cover;
  padding: 10px;
  border: 10px solid;
  overflow-clip-margin: 0px;
}
</style>
<img src="https://picsum.photos/id/237/200/300" class="image" />

Per spec, that should behave the same as if overflow-clip-margin: 0px wasn't there, but the Blink behavior is that it behaves as if padding-box was specified.

That's a bit weird but I think it makes sense if you specify the default overflow-clip-margin box in a UA sheet like https://drafts.csswg.org/css-overflow-4/#overflow-control:

Host languages should define UA style sheet rules that apply a default value of clip to such elements and set their overflow-clip-margin to content-box.

It seems Blink's behavior is just defaulting to padding-box unless otherwise specified, and that makes sense to me I think? Having the omitted implicit behavior is rather weird, and if we do we should probably add some sort of auto keyword or something?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions