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

border-radius does not respect overflow: hidden #253

Closed
RWD-Biggs opened this issue Nov 14, 2021 · 5 comments · Fixed by #594
Closed

border-radius does not respect overflow: hidden #253

RWD-Biggs opened this issue Nov 14, 2021 · 5 comments · Fixed by #594
Labels
enhancement New feature or request
Milestone

Comments

@RWD-Biggs
Copy link

RWD-Biggs commented Nov 14, 2021

As per the CSS specifications, setting border-radius and overflow: hidden on an element should cause all child elements to be clipped to the border curve. This currently does not happen (at least not with the SDL2 renderer).

Expected result:
border_radius_expected

Actual result:
border_radius_real

Fiddle showing border-radius and overflow: hidden working in the browser: http://jsfiddle.net/d31hpo5j/7/

@mikke89
Copy link
Owner

mikke89 commented Nov 14, 2021

Thanks for posting, and yes, you're right, we deviate from the CSS specs in this regard.

If we want to support this we would need to add additional API to the render interface, so that clients can generate appropriate stencil buffers and use that as a clipping mask. This adds quite a lot of complexity, not only for the library but also for all users implementing a render interface.

At this stage I don't believe the usefulness of this functionality outweigh that complexity. In most use cases there should be workarounds too. Thus, I will consider this a wontfix at least for now.

@mikke89 mikke89 added enhancement New feature or request wontfix This will not be worked on labels Nov 14, 2021
@RWD-Biggs
Copy link
Author

RWD-Biggs commented Nov 15, 2021

I would argue that excluding this feature severely limits the usability of border-radius, and that implementing it should be fairly straight forward and should only require an extra render pass for the parent element to render to the stencil buffer (besides the calls to enable/disable the stencil buffer). I'd be more than happy to look into a solution if I get the time, if that helps.

@mikke89
Copy link
Owner

mikke89 commented Nov 15, 2021

I'm worried things can get hairy when we consider more complex situations such as multiple nested elements with different border-radii settings combined with scrolling and rectangular clipping, and possibly transforms. It will also be more difficult to determine when we need to enable clipping, although I guess a conservative estimate should be possible (see eg. #235).

I'd appreciate it and I will certainly consider it if you come up with a solution that is not too complicated and handles situations as outlined above.

We would not want to require clients to use stencil buffers though, eg. the SDL2 sample does not use this at all. I'd be fine with a single added optional rendering function for a more advanced clipping mask. Any solution should be backward compatible, users not implementing this should then get the old behavior.

@mikke89
Copy link
Owner

mikke89 commented Jan 17, 2022

Closing due to inactivity. Feel free to reopen if there is any work in this direction.

@mikke89 mikke89 closed this as completed Jan 17, 2022
@mikke89 mikke89 removed the wontfix This will not be worked on label Apr 2, 2022
@mikke89 mikke89 added this to the 5.0 milestone Apr 2, 2022
@mikke89
Copy link
Owner

mikke89 commented Apr 2, 2022

I'm reopening this one. It is now being worked on as part of the RmlUi 5.0 features, which also includes filters and masks (currently in the filter branch).

image

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants