haikuwebkit/LayoutTests/fast/inline-block/baseline-vertical-04-expect...

55 lines
1.3 KiB
HTML
Raw Permalink Normal View History

inline-block baseline not computed correctly for vertical-lr https://bugs.webkit.org/show_bug.cgi?id=170176 Reviewed by Manuel Rego Casasnovas. Source/WebCore: When computing the baseline position of inline-block elements we use the InlineFlow logicalTop and the FontMetrics ascent. The issue comes from the fact that these units are incompatible. The logicalTop of a vertical-lr element is offset to the left edge, while the ascent is the distance from the right edge. We need to either use logical value for the FontMetrics ascent so we can compute the correctly the baselines of vertical-lr elements, or just using the logicalBottom for these cases. The approach based on a logicalAscent API for FontMetrics would require a lot of work because inline-block logic assumes everything is vertical-rl and at some point, flips the elements along the block-axis in case of vertical-lr mode. While it'd be desirable to get rid of this flipping logic, this patch tries first the simpler approach of using logicalBottom, which aligns with the currently implemented logic. Tests: fast/inline-block/baseline-vertical-01.html fast/inline-block/baseline-vertical-02.html fast/inline-block/baseline-vertical-03.html fast/inline-block/baseline-vertical-04.html fast/inline-block/baseline-vertical-05.html fast/inline-block/baseline-vertical-06.html fast/inline-block/baseline-vertical-07.html fast/inline-block/baseline-vertical-08.html * rendering/InlineFlowBox.cpp: (WebCore::InlineFlowBox::placeBoxesInBlockDirection): * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::inlineBlockBaseline const): LayoutTests: Tests to evaluate the baseline alignment in vertical modes. Additionally, several tests were rebaselined. Some of the new tests are marked as Failure for the ios-sim platform because of pixel rounding errors in the absolute positioned elements used as reference. Finally, there are color differences in the border-styles-vertical-lr-expected.png caused by changes in the gtk+ platform. Those differences were not noticeable until now that the patch causes diffs in the expected.txt files. * fast/inline-block/baseline-vertical-01-expected.html: Added. * fast/inline-block/baseline-vertical-01.html: Added. * fast/inline-block/baseline-vertical-02-expected.html: Added. * fast/inline-block/baseline-vertical-02.html: Added. * fast/inline-block/baseline-vertical-03-expected.html: Added. * fast/inline-block/baseline-vertical-03.html: Added. * fast/inline-block/baseline-vertical-04-expected.html: Added. * fast/inline-block/baseline-vertical-04.html: Added. * fast/inline-block/baseline-vertical-05-expected.html: Added. * fast/inline-block/baseline-vertical-05.html: Added. * fast/inline-block/baseline-vertical-06-expected.html: Added. * fast/inline-block/baseline-vertical-06.html: Added. * fast/inline-block/baseline-vertical-07-expected.html: Added. * fast/inline-block/baseline-vertical-07.html: Added. * fast/inline-block/baseline-vertical-08-expected.html: Added. * fast/inline-block/baseline-vertical-08.html: Added. * fast/text/emphasis-avoid-ruby-expected.png: * fast/text/emphasis-avoid-ruby-expected.txt: * fast/text/emphasis-overlap-expected.png: * fast/text/emphasis-overlap-expected.txt: * platform/gtk/fast/backgrounds/background-leakage-transforms-expected.png: * platform/gtk/fast/backgrounds/background-leakage-transforms-expected.txt: * platform/gtk/fast/writing-mode/border-styles-vertical-lr-expected.png: * platform/gtk/fast/writing-mode/border-styles-vertical-lr-expected.txt: * platform/ios-simulator/TestExpectations: * platform/ios/fast/backgrounds/background-leakage-transforms-expected.png: Added. * platform/ios/fast/backgrounds/background-leakage-transforms-expected.txt: * platform/ios/fast/writing-mode/border-styles-vertical-lr-expected.png: * platform/ios/fast/writing-mode/border-styles-vertical-lr-expected.txt: * platform/mac/fast/backgrounds/background-leakage-transforms-expected.png: * platform/mac/fast/backgrounds/background-leakage-transforms-expected.txt: * platform/mac/fast/writing-mode/border-styles-vertical-lr-expected.txt: * platform/win/fast/writing-mode/text-orientation-basic-expected.txt: Canonical link: https://commits.webkit.org/198169@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227947 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-02-01 01:56:52 +00:00
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body { font: 10px/1 monospace; }
#container {
position: relative;
background: grey;
LayoutTests/imported/w3c: WebKit uses Alphabetic Baseline when "-webkit-text-orientation" is "mixed" in Vertical Writing Mode https://bugs.webkit.org/show_bug.cgi?id=208824 Patch by Frank Yang <guowei_yang@apple.com> on 2020-03-25 Reviewed by Myles C. Maxfield. Those -expected.txt files need to be updated since previously they are expecting failures, but after the code change those failures are actually passing, so the expected.txt files need to be updated. * web-platform-tests/css/css-grid/alignment/grid-alignment-style-changes-008-expected.txt: * web-platform-tests/css/css-grid/alignment/grid-container-baseline-001-expected.txt: Source/WebCore: WebKit uses Alphabetic Baseline when "-webkit-text-orientation" is "mixed" in Vertical Writing Mode https://bugs.webkit.org/show_bug.cgi?id=208824 Patch by Frank Yang <guowei_yang@apple.com> on 2020-03-25 Reviewed by Myles C. Maxfield. According to the CSS documentation, https://drafts.csswg.org/css-writing-modes/#text-orientation and https://drafts.csswg.org/css-writing-modes/#text-baselines "In vertical typographic mode, the central baseline is used as the dominant baseline when text-orientation is mixed or upright. Otherwise the alphabetic baseline is used." However, InlineFlowBox::requiresIdeographicsBaseline returns true only when text orientation is "upright", meaning it applies the same baseline for mixed and sideways text orientation. Therefore, a new clause is added to check if text-orientation is "mixed" Currently in our implementation, text orientation is determinted by the following: - mixed: FontDescription returns Vertical and nonCJKGlyphOrientation returns Mixed - upright: FontDescription returns Vertical and nonCJKGlyphOrientation returns Upright - sideways: FontDescription returns Horizontal and nonCJKGlyphOrientation returns Mixed Original code only checks if FontDescription returns Vertical and nonCJKGlyphOrientation returns Mixed, which is only checking if text orientation is "upright", and returns true for requiresIdeographicBaseline, treating "mixed" and "sideways" the same, requesting alphabetic baseline, which is incorrect. Therefore, to correct this bahavior, change the code so that requiresIdeographicsBaseline returns true either when text-orientation is "mixed" or "upright". Equivalently, we return true when FontDescription returns Vertical false otherwise. Test: imported/w3c/web-platform-tests/css/css-writing-modes/ * rendering/InlineFlowBox.cpp: (WebCore::InlineFlowBox::requiresIdeographicBaseline const): LayoutTests: WebKit uses Alphabetic Baseline when "-webkit-text-orientation" is "mixed" in Vertical Writing Mode https://bugs.webkit.org/show_bug.cgi?id=208824 Patch by Frank Yang <guowei_yang@apple.com> on 2020-03-25 Reviewed by Myles C. Maxfield. Fixed errors in existing test files and expected results regarding baseline alignment. This baseline alignment bug is probably in the codebase for a long time, and all the following tests are based on two incorrect behaviors within WebKit, which is 1) WebKit cannot parse "text-orientation" since it's not supported yet, 2) WebKit doesn't distinguish "mixed" and "sideways" when selecting baselines, so both orientations alphabetic baseline is selected. Therefore, for those test cases, the expected files are actually reflecting the behavior of "sideways" instead of "mixed". Now after this patch, "mixed" now selects ideographic baseline, which will cause the tests to fail, so I added "-webkit-text-orientation: sideways" to these tests, and I also created new tests to cover "mixed" text orientation. * editing/selection/vertical-rl-rtl-extend-line-backward-br.html: * editing/selection/vertical-rl-rtl-extend-line-backward-p.html: * editing/selection/vertical-rl-rtl-extend-line-forward-br.html: * editing/selection/vertical-rl-rtl-extend-line-forward-p.html: * fast/backgrounds/background-leakage-transforms.html: * fast/css/vertical-text-overflow-ellipsis-text-align-center.html: * fast/css/vertical-text-overflow-ellipsis-text-align-justify.html: * fast/css/vertical-text-overflow-ellipsis-text-align-left.html: * fast/css/vertical-text-overflow-ellipsis-text-align-right.html: * fast/html/details-marker-style.html: * fast/html/details-writing-mode.html: * fast/inline-block/baseline-vertical-01-expected.html: * fast/inline-block/baseline-vertical-01.html: * fast/inline-block/baseline-vertical-02-expected.html: * fast/inline-block/baseline-vertical-02.html: * fast/inline-block/baseline-vertical-03-expected.html: * fast/inline-block/baseline-vertical-03.html: * fast/inline-block/baseline-vertical-04-expected.html: * fast/inline-block/baseline-vertical-04.html: * fast/inline-block/baseline-vertical-05-expected.html: * fast/inline-block/baseline-vertical-05.html: * fast/inline-block/baseline-vertical-06-expected.html: * fast/inline-block/baseline-vertical-06.html: * fast/inline-block/baseline-vertical-07-expected.html: * fast/inline-block/baseline-vertical-07.html: * fast/inline-block/baseline-vertical-08-expected.html: * fast/inline-block/baseline-vertical-08.html: * fast/lists/003-vertical.html: * fast/lists/009-vertical.html: * fast/multicol/tall-image-behavior-lr.html: * fast/multicol/vertical-rl/rule-style.html: * fast/ruby/overhang-vertical-no-overlap2.html: * fast/ruby/overhang-vertical.html: * fast/text/vertical-rl-rtl-linebreak.html: * fast/writing-mode/background-vertical-lr.html: * fast/writing-mode/background-vertical-rl.html: * fast/writing-mode/basic-vertical-line.html: * fast/writing-mode/border-image-vertical-lr.html: * fast/writing-mode/border-image-vertical-rl.html: * fast/writing-mode/border-styles-vertical-lr.html: * fast/writing-mode/border-styles-vertical-rl.html: * fast/writing-mode/vertical-lr-replaced-selection.html: * fast/writing-mode/vertical-rl-replaced-selection.html: * platform/ios/media/track/track-cue-rendering-vertical-expected.txt: * platform/mac/fast/ruby/bopomofo-expected.txt: * platform/mac/fast/ruby/bopomofo-letter-spacing-expected.txt: * platform/mac/fast/ruby/bopomofo-rl-expected.txt: * platform/mac/fast/text/orientation-sideways-expected.png: Removed. * platform/mac/fast/writing-mode/text-orientation-basic-expected.txt: * platform/mac/fast/writing-mode/vertical-baseline-alignment-expected.txt: * platform/win/fast/ruby/bopomofo-expected.txt: * platform/win/fast/ruby/bopomofo-letter-spacing-expected.txt: * platform/win/fast/ruby/bopomofo-rl-expected.txt: * platform/win/fast/writing-mode/text-orientation-basic-expected.txt: * platform/win/fast/writing-mode/vertical-align-table-baseline-expected.txt: * platform/win/fast/writing-mode/vertical-baseline-alignment-expected.txt: * platform/win/fast/css/vertical-text-overflow-ellipsis-text-align-center-mixed-expected.txt: Added. * platform/win/fast/css/vertical-text-overflow-ellipsis-text-align-justify-mixed-expected.txt: Added. * platform/win/fast/css/vertical-text-overflow-ellipsis-text-align-left-mixed-expected.txt: Added. * platform/win/fast/css/vertical-text-overflow-ellipsis-text-align-right-mixed-expected.txt: Added. * platform/win/fast/html/details-marker-style-mixed-expected.txt: Added. * platform/win/fast/html/details-writing-mode-mixed-expected.txt: Added. * platform/win/fast/multicol/tall-image-behavior-lr-mixed-expected.txt: Added. * platform/win/fast/ruby/bopomofo-mixed-expected.txt: Added. * platform/win/fast/text/vertical-rl-rtl-linebreak-mixed-expected.txt: Added. * platform/win/fast/writing-mode/vertical-baseline-alignment-mixed-expected.txt: Added. * platform/win/fast/writing-mode/vertical-lr-replaced-selection-mixed-expected.txt: Added. * platform/win/fast/writing-mode/vertical-rl-replaced-selection-mixed-expected.txt: Added. * printing/resources/iframe-subframe-vertical-rl.html: * editing/selection/vertical-rl-rtl-extend-line-backward-br-mixed-expected.txt: Added. * editing/selection/vertical-rl-rtl-extend-line-backward-br-mixed.html: Added. * editing/selection/vertical-rl-rtl-extend-line-backward-p-mixed-expected.txt: Added. * editing/selection/vertical-rl-rtl-extend-line-backward-p-mixed.html: Added. * editing/selection/vertical-rl-rtl-extend-line-forward-br-mixed-expected.txt: Added. * editing/selection/vertical-rl-rtl-extend-line-forward-br-mixed.html: Added. * editing/selection/vertical-rl-rtl-extend-line-forward-p-mixed-expected.txt: Added. * editing/selection/vertical-rl-rtl-extend-line-forward-p-mixed.html: Added. * fast/css/vertical-text-overflow-ellipsis-text-align-center-mixed-expected.txt: Added. * fast/css/vertical-text-overflow-ellipsis-text-align-center-mixed.html: Added. * fast/css/vertical-text-overflow-ellipsis-text-align-justify-mixed-expected.txt: Added. * fast/css/vertical-text-overflow-ellipsis-text-align-justify-mixed.html: Added. * fast/css/vertical-text-overflow-ellipsis-text-align-left-mixed-expected.txt: Added. * fast/css/vertical-text-overflow-ellipsis-text-align-left-mixed.html: Added. * fast/css/vertical-text-overflow-ellipsis-text-align-right-mixed-expected.txt: Added. * fast/css/vertical-text-overflow-ellipsis-text-align-right-mixed.html: Added. * fast/html/details-marker-style-mixed-expected.txt: Added. * fast/html/details-marker-style-mixed.html: Added. * fast/html/details-writing-mode-mixed-expected.txt: Added. * fast/html/details-writing-mode-mixed.html: Added. * fast/multicol/tall-image-behavior-lr-mixed-expected.txt: Added. * fast/multicol/tall-image-behavior-lr-mixed.html: Added. * fast/ruby/bopomofo-mixed-expected.txt: Added. * fast/ruby/bopomofo-mixed.html: Added. * fast/ruby/overhang-vertical-mixed-expected.txt: Added. * fast/ruby/overhang-vertical-mixed.html: Added. * fast/ruby/overhang-vertical-no-overlap2-mixed-expected.txt: Added. * fast/ruby/overhang-vertical-no-overlap2-mixed.html: Added. * fast/text/vertical-rl-rtl-linebreak-mixed-expected.txt: Added. * fast/text/vertical-rl-rtl-linebreak-mixed.html: Added. * fast/writing-mode/background-vertical-lr-mixed-expected.txt: Added. * fast/writing-mode/background-vertical-lr-mixed.html: Added. * fast/writing-mode/background-vertical-rl-mixed-expected.txt: Added. * fast/writing-mode/background-vertical-rl-mixed.html: Added. * fast/writing-mode/basic-vertical-line-mixed-expected.txt: Added. * fast/writing-mode/basic-vertical-line-mixed.html: Added. * fast/writing-mode/border-styles-vertical-lr-mixed-expected.txt: Added. * fast/writing-mode/border-styles-vertical-lr-mixed.html: Added. * fast/writing-mode/border-styles-vertical-rl-mixed-expected.txt: Added. * fast/writing-mode/border-styles-vertical-rl-mixed.html: Added. * fast/writing-mode/vertical-baseline-alignment-mixed-expected.txt: Added. * fast/writing-mode/vertical-baseline-alignment-mixed.html: Added. * fast/writing-mode/vertical-lr-replaced-selection-mixed-expected.txt: Added. * fast/writing-mode/vertical-lr-replaced-selection-mixed.html: Added. * fast/writing-mode/vertical-rl-replaced-selection-mixed-expected.txt: Added. * fast/writing-mode/vertical-rl-replaced-selection-mixed.html: Added. * LayoutTests/TestExpectations: * platform/ios-wk2/TestExpectations: * platform/mac/TestExpectations: * platform/win/TestExpectations: Canonical link: https://commits.webkit.org/222474@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258990 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-25 17:03:50 +00:00
-webkit-text-orientation: sideways;
inline-block baseline not computed correctly for vertical-lr https://bugs.webkit.org/show_bug.cgi?id=170176 Reviewed by Manuel Rego Casasnovas. Source/WebCore: When computing the baseline position of inline-block elements we use the InlineFlow logicalTop and the FontMetrics ascent. The issue comes from the fact that these units are incompatible. The logicalTop of a vertical-lr element is offset to the left edge, while the ascent is the distance from the right edge. We need to either use logical value for the FontMetrics ascent so we can compute the correctly the baselines of vertical-lr elements, or just using the logicalBottom for these cases. The approach based on a logicalAscent API for FontMetrics would require a lot of work because inline-block logic assumes everything is vertical-rl and at some point, flips the elements along the block-axis in case of vertical-lr mode. While it'd be desirable to get rid of this flipping logic, this patch tries first the simpler approach of using logicalBottom, which aligns with the currently implemented logic. Tests: fast/inline-block/baseline-vertical-01.html fast/inline-block/baseline-vertical-02.html fast/inline-block/baseline-vertical-03.html fast/inline-block/baseline-vertical-04.html fast/inline-block/baseline-vertical-05.html fast/inline-block/baseline-vertical-06.html fast/inline-block/baseline-vertical-07.html fast/inline-block/baseline-vertical-08.html * rendering/InlineFlowBox.cpp: (WebCore::InlineFlowBox::placeBoxesInBlockDirection): * rendering/RenderBlockFlow.cpp: (WebCore::RenderBlockFlow::inlineBlockBaseline const): LayoutTests: Tests to evaluate the baseline alignment in vertical modes. Additionally, several tests were rebaselined. Some of the new tests are marked as Failure for the ios-sim platform because of pixel rounding errors in the absolute positioned elements used as reference. Finally, there are color differences in the border-styles-vertical-lr-expected.png caused by changes in the gtk+ platform. Those differences were not noticeable until now that the patch causes diffs in the expected.txt files. * fast/inline-block/baseline-vertical-01-expected.html: Added. * fast/inline-block/baseline-vertical-01.html: Added. * fast/inline-block/baseline-vertical-02-expected.html: Added. * fast/inline-block/baseline-vertical-02.html: Added. * fast/inline-block/baseline-vertical-03-expected.html: Added. * fast/inline-block/baseline-vertical-03.html: Added. * fast/inline-block/baseline-vertical-04-expected.html: Added. * fast/inline-block/baseline-vertical-04.html: Added. * fast/inline-block/baseline-vertical-05-expected.html: Added. * fast/inline-block/baseline-vertical-05.html: Added. * fast/inline-block/baseline-vertical-06-expected.html: Added. * fast/inline-block/baseline-vertical-06.html: Added. * fast/inline-block/baseline-vertical-07-expected.html: Added. * fast/inline-block/baseline-vertical-07.html: Added. * fast/inline-block/baseline-vertical-08-expected.html: Added. * fast/inline-block/baseline-vertical-08.html: Added. * fast/text/emphasis-avoid-ruby-expected.png: * fast/text/emphasis-avoid-ruby-expected.txt: * fast/text/emphasis-overlap-expected.png: * fast/text/emphasis-overlap-expected.txt: * platform/gtk/fast/backgrounds/background-leakage-transforms-expected.png: * platform/gtk/fast/backgrounds/background-leakage-transforms-expected.txt: * platform/gtk/fast/writing-mode/border-styles-vertical-lr-expected.png: * platform/gtk/fast/writing-mode/border-styles-vertical-lr-expected.txt: * platform/ios-simulator/TestExpectations: * platform/ios/fast/backgrounds/background-leakage-transforms-expected.png: Added. * platform/ios/fast/backgrounds/background-leakage-transforms-expected.txt: * platform/ios/fast/writing-mode/border-styles-vertical-lr-expected.png: * platform/ios/fast/writing-mode/border-styles-vertical-lr-expected.txt: * platform/mac/fast/backgrounds/background-leakage-transforms-expected.png: * platform/mac/fast/backgrounds/background-leakage-transforms-expected.txt: * platform/mac/fast/writing-mode/border-styles-vertical-lr-expected.txt: * platform/win/fast/writing-mode/text-orientation-basic-expected.txt: Canonical link: https://commits.webkit.org/198169@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227947 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-02-01 01:56:52 +00:00
width: 250px;
height: 500px;
writing-mode: vertical-lr;
direction: rtl;
}
#container :nth-child(1) {
font: 24px/1 ahem;
border-width: 4px 10px 6px 8px;
border-style: solid;
padding: 12px 6px 14px 6px;
left: 24px;
top: 432px;
}
#container :nth-child(2) {
font: 40px/1 ahem;
border-width: 8px 6px 10px 4px;
border-style: solid;
padding: 6px 12px 16px 14px;
left: 71px;
top: 308px;
}
#container :nth-child(3) {
font: 60px/1 ahem;
border-width: 2px 5px 3px 4px;
border-style: solid;
padding: 6px 3px 12px 8px;
left: 73px;
top: 209px;
}
#container :nth-child(4) {
font: 80px/1 ahem;
border-width: 12px 6px 14px 16px;
border-style: solid;
padding: 20px 12px 8px 24px;
left: 41px;
top: 59px;
}
#container > div { position: absolute; }
#container :nth-child(1) { padding-left: 60px; }
#container :nth-child(3) { padding-right: 30px; }
</style>
<p>Test verifying inline-block elements with extra padding are baseline aligned in a VerticalLR and RTL container</p>
<div id="container">
<div>É</div><div>É</div><div>É</div><div>É</div>
</div>