facebook / yoga

Yoga is an embeddable layout engine targeting web standards.

Home Page:https://yogalayout.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flex shorthand in UseWebDefaults should set basis to 0 instead of auto

NickGerleman opened this issue · comments

Since UseWebDefaults was added with 62f4719,

return node->config->useWebDefaults ? &YGValueAuto : &YGValueZero;

https://www.w3.org/TR/css-flexbox-1/#flex-common says that zeroing is the right interpretation, so UseWebDefaults does the wrong thing seemingly.

UseWebDefaults is going to be in a weird place in general with static and block in the mix.

What is the value in Yoga supporting the shorthand syntax? Why not just stick to the longhand syntax and let the layers above Yoga lower the shorthand into the longhand?

It’s a good question.

Yogas api has historically supported length shorthands through different “edges”, e.g. all vs horizontal vs left. It will then resolve based on specificity.

That’s convenient in not letting the underlying framework need to manage extra state, and the resolved value can depend on things like ltr vs rtl, but if means Yoga must store the information (probably more efficiently than the host would too).

Beyond what we’d do with a clean slate though, I’ve been aiming to avoid non-trivial breaks to the public api (though I introduced plenty of more trivial ones for the next release).