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

fix: children of inline-block element not stretch #1214

Merged
merged 5 commits into from
Mar 21, 2022

Conversation

temper357
Copy link
Contributor

Closes #1204

  • 对于未定义 width 的 inline-block 容器,其宽度应该由其 children 撑开,当其 children 中有未定义 width 的 block level 的 child 时,此 child 又应该 stretch 到 parent 的宽度,如以下示例,id=2 的 div 的 width 实际上等于 100 px。
  • Kraken 在计算某个 renderBoxModel 的 logicalWidth 时只计算其 ancestor 的 renderStyle,并不计算 sibling 的 renderStyle,也不应该计算(例如当 sibling 有 replaced element 时其 width 在 load 前不可知),因此正确做法是在 parent 的 size 确定后对这种 child 进行二次 layout。
  <div style="display: inline-block;">
     <div id="1" style="width: 100px;">
     </div>
     <div id="2">
     </div>
  </div>

@answershuto answershuto merged commit fe44453 into main Mar 21, 2022
@answershuto answershuto deleted the fix/inline-block-child-stretch branch March 21, 2022 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

flex-grow 在 flex-item 的 children 主轴 size 不小于剩余空间时不生效
3 participants