Bug 1715661 - Fix justify-content:{left|right} for column oriented vertical flex container. r=dholbert

In a column oriented vertical flex container, its main axis is parallel
to physical left <-> right axis, so justify-content:left and
justify-content:right should map to physical left and right edge,
respectively. This patch makes this particular case go to the (tweaked)
`else` branch.

https://drafts.csswg.org/css-align-3/#valdef-justify-content-left

Differential Revision: https://phabricator.services.mozilla.com/D120415
This commit is contained in:
Ting-Yu Lin 2021-07-22 00:12:07 +00:00
Родитель 40bbd6b5fe
Коммит 1fb3c26fc2
2 изменённых файлов: 14 добавлений и 13 удалений

Просмотреть файл

@ -3381,14 +3381,22 @@ MainAxisPositionTracker::MainAxisPositionTracker(
// Map 'left'/'right' to 'start'/'end'
if (mJustifyContent.primary == StyleAlignFlags::LEFT ||
mJustifyContent.primary == StyleAlignFlags::RIGHT) {
if (aAxisTracker.IsColumnOriented()) {
// Container's alignment axis is not parallel to the inline axis,
// so we map both 'left' and 'right' to 'start'.
const auto wm = aAxisTracker.GetWritingMode();
if (aAxisTracker.IsColumnOriented() && !wm.IsVertical()) {
// Container's alignment axis (main axis) is *not* parallel to the
// line-left <-> line-right axis or the physical left <-> physical right
// axis, so we map both 'left' and 'right' to 'start'.
mJustifyContent.primary = StyleAlignFlags::START;
} else {
// Row-oriented, so we map 'left' and 'right' to 'start' or 'end',
// depending on left-to-right writing mode.
const bool isLTR = aAxisTracker.GetWritingMode().IsBidiLTR();
MOZ_ASSERT(
aAxisTracker.MainAxis() == eLogicalAxisInline ||
wm.PhysicalAxis(aAxisTracker.MainAxis()) == eAxisHorizontal,
"The container's main axis should be parallel to either line-left "
"<-> line-right axis or physical left <-> physical right axis!");
// Otherwise, we map 'left' and 'right' to 'start' or 'end', depending on
// the container's writing mode.
const bool isLTR = wm.IsPhysicalLTR();
const bool isJustifyLeft =
(mJustifyContent.primary == StyleAlignFlags::LEFT);
mJustifyContent.primary = (isJustifyLeft == isLTR)

Просмотреть файл

@ -1,7 +0,0 @@
[flexbox-justify-content-wmvert-002.html]
[.flexitem 1]
expected: FAIL
[.flexitem 2]
expected: FAIL