Skip to content

Commit d670217

Browse files
Ahmad-S792Ahmad Saleem
authored andcommitted
mpadded lspace attribute incorrectly positions content in RTL direction
https://bugs.webkit.org/show_bug.cgi?id=303735 rdar://166045517 Reviewed by Frédéric Wang. In RTL mode, lspace should add space on the inline-start (physical right) side. The previous implementation added in 303070@main simply negated lspace, which incorrectly positioned content at the left edge instead of accounting for the box width and content width. For RTL with lspace="25px", width="150px", and content width 75px: - Content should end 25px from the right edge - Content starts at: 150 - 25 - 75 = 50px from left The fix calculates RTL inline shift as (width - contentWidth - lspace()) to properly position content relative to the box's right edge. * Source/WebCore/rendering/mathml/RenderMathMLPadded.cpp: (WebCore::RenderMathMLPadded::layoutBlock): * LayoutTests/TestExpectations: Progression Canonical link: https://commits.webkit.org/304087@main
1 parent 66f81b4 commit d670217

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

LayoutTests/TestExpectations

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1968,7 +1968,6 @@ imported/w3c/web-platform-tests/html/browsers/windows/nested-browsing-contexts/f
19681968
# These MathML WPT tests fail.
19691969
webkit.org/b/180013 mathml/non-core/lengths-2.html [ ImageOnlyFailure ]
19701970
webkit.org/b/194952 imported/w3c/web-platform-tests/mathml/presentation-markup/fractions/frac-bar-001.html [ ImageOnlyFailure ]
1971-
imported/w3c/web-platform-tests/mathml/presentation-markup/direction/direction-mpadded.html [ ImageOnlyFailure ]
19721971
imported/w3c/web-platform-tests/mathml/presentation-markup/direction/direction-overall-003.html [ ImageOnlyFailure ]
19731972
imported/w3c/web-platform-tests/mathml/presentation-markup/fractions/frac-bar-002.html [ ImageOnlyFailure ]
19741973
imported/w3c/web-platform-tests/mathml/presentation-markup/fractions/frac-default-padding.html [ ImageOnlyFailure ]

Source/WebCore/rendering/mathml/RenderMathMLPadded.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ void RenderMathMLPadded::layoutBlock(RelayoutChildren relayoutChildren, LayoutUn
120120
LayoutUnit ascent = mpaddedHeight(contentAscent);
121121
LayoutUnit descent = mpaddedDepth(contentDescent);
122122

123-
auto inlineShift = style().writingMode().inlineDirection() == FlowDirection::RightToLeft ? -lspace() : lspace();
123+
auto inlineShift = style().writingMode().inlineDirection() == FlowDirection::RightToLeft ? (width - contentWidth - lspace()) : lspace();
124124

125125
// Align children on the new baseline and shift them by (lspace, -voffset)
126126
shiftInFlowChildren(inlineShift, ascent - contentAscent - voffset());

0 commit comments

Comments
 (0)