fix: percentage of positioned element #1044
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #1042
此 issue 原因是 transform 的 getter 中为了提升性能(transformMatrix 计算有耗费性能)会缓存上一次计算结果,而百分比是相对自身 size 计算,需要等自身 layout 完才能出来,因此在 layout 之前不能使用默认值 0,而需要使用 null 防止缓存生效。另外对于 transform, background-size, border-radius 这些在 paint 阶段计算的 css 属性 paint 时肯定能拿到自身 size,因此 markParentNeedsLayout 这个操作是多余的。
此 issue 原因是在 length.dart 中解析 percentage 时错误地使用了 parent 的 renderStyle,正确应该使用 containing block 的 renderStyle,也就是 renderBoxModel 的直接 parent 对应的 renderStyle。