inline-block baseline not computed correctly for vertical-lr
authorjfernandez@igalia.com <jfernandez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Feb 2018 01:56:52 +0000 (01:56 +0000)
committerjfernandez@igalia.com <jfernandez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Feb 2018 01:56:52 +0000 (01:56 +0000)
commit1585724930f67be27045eab99c1035fbb3347dad
treee14e8e3a29cbaece40956c58e5328eeca644e86c
parent49e28b08dca87127080966dbdaf51104b0012e21
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:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227947 268f45cc-cd09-0410-ab3c-d52691b4dbfc
37 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/inline-block/baseline-vertical-01-expected.html [new file with mode: 0644]
LayoutTests/fast/inline-block/baseline-vertical-01.html [new file with mode: 0644]
LayoutTests/fast/inline-block/baseline-vertical-02-expected.html [new file with mode: 0644]
LayoutTests/fast/inline-block/baseline-vertical-02.html [new file with mode: 0644]
LayoutTests/fast/inline-block/baseline-vertical-03-expected.html [new file with mode: 0644]
LayoutTests/fast/inline-block/baseline-vertical-03.html [new file with mode: 0644]
LayoutTests/fast/inline-block/baseline-vertical-04-expected.html [new file with mode: 0644]
LayoutTests/fast/inline-block/baseline-vertical-04.html [new file with mode: 0644]
LayoutTests/fast/inline-block/baseline-vertical-05-expected.html [new file with mode: 0644]
LayoutTests/fast/inline-block/baseline-vertical-05.html [new file with mode: 0644]
LayoutTests/fast/inline-block/baseline-vertical-06-expected.html [new file with mode: 0644]
LayoutTests/fast/inline-block/baseline-vertical-06.html [new file with mode: 0644]
LayoutTests/fast/inline-block/baseline-vertical-07-expected.html [new file with mode: 0644]
LayoutTests/fast/inline-block/baseline-vertical-07.html [new file with mode: 0644]
LayoutTests/fast/inline-block/baseline-vertical-08-expected.html [new file with mode: 0644]
LayoutTests/fast/inline-block/baseline-vertical-08.html [new file with mode: 0644]
LayoutTests/fast/text/emphasis-avoid-ruby-expected.png
LayoutTests/fast/text/emphasis-avoid-ruby-expected.txt
LayoutTests/fast/text/emphasis-overlap-expected.png
LayoutTests/fast/text/emphasis-overlap-expected.txt
LayoutTests/platform/gtk/fast/backgrounds/background-leakage-transforms-expected.png
LayoutTests/platform/gtk/fast/backgrounds/background-leakage-transforms-expected.txt
LayoutTests/platform/gtk/fast/writing-mode/border-styles-vertical-lr-expected.png
LayoutTests/platform/gtk/fast/writing-mode/border-styles-vertical-lr-expected.txt
LayoutTests/platform/ios-simulator/TestExpectations
LayoutTests/platform/ios/fast/backgrounds/background-leakage-transforms-expected.png [new file with mode: 0644]
LayoutTests/platform/ios/fast/backgrounds/background-leakage-transforms-expected.txt
LayoutTests/platform/ios/fast/writing-mode/border-styles-vertical-lr-expected.png
LayoutTests/platform/ios/fast/writing-mode/border-styles-vertical-lr-expected.txt
LayoutTests/platform/mac/fast/backgrounds/background-leakage-transforms-expected.png
LayoutTests/platform/mac/fast/backgrounds/background-leakage-transforms-expected.txt
LayoutTests/platform/mac/fast/writing-mode/border-styles-vertical-lr-expected.txt
LayoutTests/platform/win/fast/writing-mode/text-orientation-basic-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/rendering/InlineFlowBox.cpp
Source/WebCore/rendering/RenderBlockFlow.cpp