Skip to content
Permalink
Browse files
text-align: match-parent on root handles direction incorrectly
https://bugs.webkit.org/show_bug.cgi?id=241164

Reviewed by Myles C. Maxfield.

The spec says the initial containing block's direction should be used when the element has no parent.

Regarding the computed value, Chrome & Firefox computes to `start` for this case.
This may change in w3c/csswg-drafts#6542 to `left`/`right`.

Test: imported/w3c/web-platform-tests/css/css-text/text-align/text-align-match-parent-root-rtl.html

* LayoutTests/TestExpectations:
* Source/WebCore/style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertTextAlign):

Canonical link: https://commits.webkit.org/251211@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@295120 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
nt1m committed Jun 2, 2022
1 parent afe1ad3 commit faf2d5cc3bac6c4a3bdebaa3f6d0c6c8d5e8b4db
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
@@ -2645,7 +2645,6 @@ webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text
webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-last-010.html [ ImageOnlyFailure ]
webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-last-011.html [ ImageOnlyFailure ]
webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-last-wins-001.html [ ImageOnlyFailure ]
webkit.org/b/241164 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-match-parent-root-rtl.html [ ImageOnlyFailure ]
webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/text-encoding/shaping-join-003.html [ ImageOnlyFailure ]
webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/text-encoding/shaping-tatweel-002.html [ ImageOnlyFailure ]
webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/text-encoding/shaping-tatweel-003.html [ ImageOnlyFailure ]
@@ -614,6 +614,10 @@ inline TextAlignMode BuilderConverter::convertTextAlign(BuilderState& builderSta
if (primitiveValue.valueID() != CSSValueWebkitMatchParent && primitiveValue.valueID() != CSSValueMatchParent)
return primitiveValue;

auto* element = builderState.element();
if (element && element == builderState.document().documentElement())
return TextAlignMode::Start;

auto& parentStyle = builderState.parentStyle();
if (parentStyle.textAlign() == TextAlignMode::Start)
return parentStyle.isLeftToRightDirection() ? TextAlignMode::Left : TextAlignMode::Right;

0 comments on commit faf2d5c

Please sign in to comment.