facebook / yoga

Yoga is an embeddable layout engine targeting web standards.
https://yogalayout.dev/
MIT License
17.25k stars 1.42k forks source link

Fix issue where % width would be wrong if physical and relative padding defined on parent #1662

Closed joevilches closed 3 months ago

joevilches commented 4 months ago

Summary: This should fix https://github.com/facebook/yoga/issues/1657. Rather insidious bug but we had code like

  // The total padding/border for a given axis does not depend on the direction
  // so hardcoding LTR here to avoid piping direction to this function
  return node->style().computeInlineStartPaddingAndBorder(
             axis, Direction::LTR, widthSize) +
      node->style().computeInlineEndPaddingAndBorder(
          axis, Direction::LTR, widthSize);

That comment is NOT true if someone sets both the physical edge and relative edge. So like paddingLeft and paddingEnd for RTL. This diff simply pipes the direction to that spot to use instead of hardcoding LTR. Every file changed is just to pipe direction.

Differential Revision: D58169843

vercel[bot] commented 4 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
yoga-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 7, 2024 6:19pm
facebook-github-bot commented 4 months ago

This pull request was exported from Phabricator. Differential Revision: D58169843

facebook-github-bot commented 4 months ago

This pull request was exported from Phabricator. Differential Revision: D58169843

facebook-github-bot commented 4 months ago

This pull request was exported from Phabricator. Differential Revision: D58169843

facebook-github-bot commented 3 months ago

This pull request has been merged in facebook/yoga@72b7e5b5cfbbd9e78023bf8f79959928ddb031c2.