The expected behavior when using text-align: inherit; on a th is to inherit the text alignment of a parent element, in the case of my example left. Rather than doing this Safari uses the useragent default for th which is text-align: center.
Verified in Safari 8 and the latest WebKit Nightly build.
Firefox 33: Working as expected
Internet Explorer 11: Working as expected
Chrome 39: Also broken.
Chromium bug for cross-reference:
The Chromium patch to resolve this bug, for cross-reference: https://chromium.googlesource.com/chromium/src.git/+/367b26a9cdb1389d3e16c30527742f7cd33ef74d
This issue forced Bootstrap to use `-webkit-match-parent` on their CSS
which in return makes it hard to remove it from the Web platform without breaking Safari.
If it is being fixed it will help to obsolete it, and convince BootStrap to remove it too.
The WPT has already a test to remove the support of `-webkit-match-parent`
because the spec says Safari does the right thing.
but Firefox and Chrome do differently.
This is the relevant bit in WebKit:
I personally haven't tested which approach works, but the 2 I have in mind are:
1. Add a applyInheritTextAlign function here: https://webkit-search.igalia.com/webkit/rev/26eff7cbe4e53bbd8b325ee12a3567128ba52d2e/Source/WebCore/style/StyleBuilderCustom.h#197-207 that sets both textAlign, but also hasExplicitlySetTextAlign(). This needs to change: https://webkit-search.igalia.com/webkit/rev/26eff7cbe4e53bbd8b325ee12a3567128ba52d2e/Source/WebCore/css/CSSProperties.json#4590 to "custom": "All" in order to work.
2. Remove the StyleAdjuster code, do like Firefox/Chrome and add an `-internal-center-or-inherit` value, implement it in https://webkit-search.igalia.com/webkit/rev/26eff7cbe4e53bbd8b325ee12a3567128ba52d2e/Source/WebCore/style/StyleBuilderConverter.h#609 , something like:
if (primitiveValue.valueID() == CSSValueInternalCenterOrInherit)
if (parentStyle.textAlign() != TextAlign::Start)
Pull request: https://github.com/WebKit/WebKit/pull/1503
Last PR ended up breaking some WPT tests for `all: revert`. I'm going to go for Tim's #2 suggestion and use an internal CSS property instead.
Pull request: https://github.com/WebKit/WebKit/pull/1568
Committed r295625 (251630@main): <https://commits.webkit.org/251630@main>
Reviewed commits have been landed. Closing PR #1568 and removing active labels.