Bug 1221524 Part 1: Map align-self:"baseline" to "flex-start" when FlexItem writing mode is orthogonal to container main axis. r?dholbert
MozReview-Commit-ID: 2IlkVDWNirG
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -1886,29 +1886,26 @@ FlexItem::FlexItem(ReflowInput& aFlexIte
if (styleMargin.GetUnit(side) == eStyleUnit_Auto) {
MOZ_ASSERT(GetMarginComponentForSide(side) == 0,
"Someone else tried to resolve our auto margin");
}
}
}
#endif // DEBUG
- // If the flex item's inline axis is the same as the cross axis, then
- // 'align-self:baseline' is identical to 'flex-start'. If that's the case, we
- // just directly convert our align-self value here, so that we don't have to
- // handle this with special cases elsewhere.
- // Moreover: for the time being (until we support writing-modes),
- // all inline axes are horizontal -- so we can just check if the cross axis
- // is horizontal.
- // FIXME: Once we support writing-mode (vertical text), this
- // IsCrossAxisHorizontal check won't be sufficient anymore -- we'll actually
- // need to compare our inline axis vs. the cross axis.
- if (mAlignSelf == NS_STYLE_ALIGN_BASELINE &&
- aAxisTracker.IsCrossAxisHorizontal()) {
- mAlignSelf = NS_STYLE_ALIGN_FLEX_START;
+ // Map align-self 'baseline' value to 'start' when baseline alignment
+ // is not possible because the FlexItem's writing mode is orthogonal to
+ // the main axis of the container. If that's the case, we just directly
+ // convert our align-self value here, so that we don't have to handle this
+ // with special cases elsewhere.
+ if (aAxisTracker.IsRowOriented() ==
+ aAxisTracker.GetWritingMode().IsOrthogonalTo(mWM)) {
+ if (mAlignSelf == NS_STYLE_ALIGN_BASELINE) {
+ mAlignSelf = NS_STYLE_ALIGN_FLEX_START;
+ }
}
}
// Simplified constructor for creating a special "strut" FlexItem, for a child
// with visibility:collapse. The strut has 0 main-size, and it only exists to
// impose a minimum cross size on whichever FlexLine it ends up in.
FlexItem::FlexItem(nsIFrame* aChildFrame, nscoord aCrossSize,
WritingMode aContainerWM)