-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Improved UI overflow API #15468
Copy link
Copy link
Closed
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenA-UIGraphical user interfaces, styles, layouts, and widgetsGraphical user interfaces, styles, layouts, and widgetsC-FeatureA new feature, making something new possibleA new feature, making something new possibleD-ModestA "normal" level of difficulty; suitable for simple features or challenging fixesA "normal" level of difficulty; suitable for simple features or challenging fixesS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!
Metadata
Metadata
Assignees
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenA-UIGraphical user interfaces, styles, layouts, and widgetsGraphical user interfaces, styles, layouts, and widgetsC-FeatureA new feature, making something new possibleA new feature, making something new possibleD-ModestA "normal" level of difficulty; suitable for simple features or challenging fixesA "normal" level of difficulty; suitable for simple features or challenging fixesS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!
What problem does this solve or what need does it fill?
Currently with
OverflowAxis::Clip/Hidden/Scrollthe node's clipping rect will be set to the node's bounds.This isn't very natural since if you have a UI Node set to
Overflow::Clipany overflowing content of its children's will spill over the node's border.There is a PR in review #15442 that changes the clipping rect to the node's content-box (The innermost part of the node excluding the padding and border).
It's not difficult to implement support for other clipping options, so we should.
What solution would you like?
I'm not sure we can match all the CSS options anytime soon, so I suggest a simplified API:
With the usual const construction functions like
OverflowClipMargin::padding_box()for clipping around the node's padding-box with no inset.The
Overflowstruct would be unchanged but with some extra helper methods like:The implementation just involves a few trivial changes to
update_clipping, the only questions I have are about the API.Notes
MarginBoxmight be tricky to support asTaffy'sLayoutdoesn't return margin values. Probably should be left out of the initial PR.clip-pathsupport until we have some sort of compositing.OverflowClipMarginfeels like it could be confusing to users. It matches the name of the similar CSS property but maybeOverflowClipBoundswould be more intuitive.