Commit 91904fc
<mpadded> should treat percentage values as absent for width/height/depth attribute
https://bugs.webkit.org/show_bug.cgi?id=304790
rdar://167350169
Reviewed by Alan Baradlay.
According to the MathML Core specification [1], if the width, height, or
depth attributes are percentages, they should be treated as if absent
(using default values based on the inner box dimensions). Previously, these
percentage values were incorrectly resolved relative to the content dimensions.
This patch checks for LengthType::Percentage in mpaddedWidth(), mpaddedHeight(),
and mpaddedDepth(), and returns the content dimension directly when a percentage
is encountered, matching the behavior for absent/invalid attributes.
[1] https://w3c.github.io/mathml-core/#inner-box-and-requested-parameters
As drive-by, we updated to use std::max(0_lu, ..) rather than explicity
std::max<LayoutUnit> similar to through out other code.
* Source/WebCore/rendering/mathml/RenderMathMLPadded.cpp:
(WebCore::RenderMathMLPadded::lspace const): Drive-by fix
(WebCore::RenderMathMLPadded::mpaddedWidth const):
(WebCore::RenderMathMLPadded::mpaddedHeight const):
(WebCore::RenderMathMLPadded::mpaddedDepth const):
> Progressions:
* LayoutTests/imported/w3c/web-platform-tests/mathml/presentation-markup/mpadded/mpadded-002-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/mathml/presentation-markup/mpadded/mpadded-percentage-002-expected.txt:
Canonical link: https://commits.webkit.org/305027@main1 parent 6970795 commit 91904fc
File tree
3 files changed
+20
-9
lines changed- LayoutTests/imported/w3c/web-platform-tests/mathml/presentation-markup/mpadded
- Source/WebCore/rendering/mathml
3 files changed
+20
-9
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | 60 | | |
62 | | - | |
| 61 | + | |
63 | 62 | | |
64 | 63 | | |
65 | 64 | | |
66 | 65 | | |
67 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
68 | 71 | | |
69 | 72 | | |
70 | 73 | | |
71 | 74 | | |
72 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
73 | 80 | | |
74 | 81 | | |
75 | 82 | | |
76 | 83 | | |
77 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
78 | 89 | | |
79 | 90 | | |
80 | 91 | | |
| |||
0 commit comments