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

Support box-sizing: content-box #289

Closed
Tracked by #345
adjabaev opened this issue Dec 23, 2022 · 5 comments · Fixed by #675
Closed
Tracked by #345

Support box-sizing: content-box #289

adjabaev opened this issue Dec 23, 2022 · 5 comments · Fixed by #675
Labels
enhancement New feature or request

Comments

@adjabaev
Copy link
Contributor

adjabaev commented Dec 23, 2022

What problem does this solve or what need does it fill?

Could help in order to reproduce web default behaviour easily

What solution would you like?

Probably something as simple as passing an "BoxSizing" enum value to Style

What alternative(s) have you considered?

Made some tests but these were unfortunately inconclusive.

Additional context

If there is already a siimilar feature supported, then I am sorry, but I feel like I've done the research work through issues/ code

@adjabaev adjabaev added the enhancement New feature or request label Dec 23, 2022
@alice-i-cecile
Copy link
Collaborator

This appears to be the requested feature: https://www.w3schools.com/css/css3_box-sizing.asp

Is that correct? :)

@adjabaev
Copy link
Contributor Author

It definitely is! Taffy is using the "border-box" value of that property, meanwhile the default is "content-box" (the one that inflates elements based on padding/ border)

@alice-i-cecile
Copy link
Collaborator

Got it! IMO we should implement this choice and change our default behavior then. Are you up for a PR?

@nicoburns
Copy link
Collaborator

This is a worthwhile feature, but I don't think it will be a small change. This will involve updating everywhere that a size, max_size, or min_size style is used. And will also affect MeasureFuncs.

Taffy is using the "border-box" value of that property

It mostly is (indeed I believe this is set in our gentests), and I based my CSS Grid implementation on this assumption. But there are issues on the Yoga repo suggesting that it doesn't entirely follow either content-box or border-box, and I wouldn't be at all surprised if that is true of Taffy's Flexbox implementation too.

change our default behavior

Perhaps, but that would be up for debate I think. "content-box" is the default for browsers. But most of the web is using a "CSS reset" (e.g. normalize.css) that sets this back to "border-box". A small historical note: "border-box" was how Internet Explorer worked. "content-box" was how Netscape worked. And while "content-box" was standardised, I think most people think that "border-box" is generally better and more intuitive way of styling things (because otherwise if you add padding or border to a box that is 100px wide, then it's no longer 100px wide).

@nicoburns nicoburns added the controversial This work requires a heightened standard of review due to implementation or design complexity label Jan 2, 2023
@adjabaev
Copy link
Contributor Author

adjabaev commented Jan 5, 2023

Just wanted to link this issue with #223 as both are related to some extent

@nicoburns nicoburns changed the title CSS box-sizing: content-box property Support box-sizing: content-box Jul 7, 2023
This was referenced Feb 14, 2024
@nicoburns nicoburns removed the controversial This work requires a heightened standard of review due to implementation or design complexity label Feb 14, 2024
@nicoburns nicoburns moved this to Todo in 🍬 Taffy Roadmap Feb 14, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in 🍬 Taffy Roadmap Jul 16, 2024
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
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants