Commit 1eee13b
Fix transferred min/max constraints inflating percentage-default zero intrinsic dimensions
https://bugs.webkit.org/show_bug.cgi?id=308075
rdar://170765025
Reviewed by Alan Baradlay.
When an SVG image has a percentage-based width or height (the default
"100%" when the attribute is omitted), the intrinsic dimension is
reported as 0. The transferred min/max constraint logic in
computeIntrinsicSizesConstrainedByTransferredMinMaxSizes was applying
min-height/min-width via the aspect ratio to clamp these zeros upward,
making the dimension appear intrinsic and causing the wrong sizing path
to be taken.
For example, an SVG with only an intrinsic height of 25px and a 2:1
ratio would get its zero intrinsic width clamped to 40px via a
transferred min-height: 20px, producing 40x20 instead of the correct
50x25.
Fix by skipping the min-constraint when the dimension is zero, since
zero here means "no intrinsic dimension" rather than an explicit zero.
Max-constraints are still applied unconditionally as they can only
shrink non-zero values.
* Source/WebCore/rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeIntrinsicSizesConstrainedByTransferredMinMaxSizes):
* LayoutTests/TestExpectations: Progressions
Canonical link: https://commits.webkit.org/308212@main1 parent 5718d09 commit 1eee13b
File tree
2 files changed
+11
-7
lines changed- LayoutTests
- Source/WebCore/rendering
2 files changed
+11
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4485 | 4485 | | |
4486 | 4486 | | |
4487 | 4487 | | |
4488 | | - | |
4489 | 4488 | | |
4490 | 4489 | | |
4491 | 4490 | | |
| |||
8171 | 8170 | | |
8172 | 8171 | | |
8173 | 8172 | | |
8174 | | - | |
8175 | | - | |
8176 | | - | |
8177 | | - | |
8178 | 8173 | | |
8179 | 8174 | | |
8180 | 8175 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
526 | 526 | | |
527 | 527 | | |
528 | 528 | | |
529 | | - | |
530 | | - | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
531 | 540 | | |
532 | 541 | | |
533 | 542 | | |
| |||
0 commit comments