зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1174003 part 7: [css-flexbox] Logicalize IsCrossAxisHorizontal() check in GetBaselineOffsetFromOuterCrossSize (and simplify a condition for baseline fallback). r=mats
This patch doesn't change our behavior -- not in opt builds, at least. In debug builds, this patch does change an assertion condition, to remove a usage of IsCrossAxisHorizontal(). This means debug builds may proceed a bit further when loading e.g. bug 1384266's testcase (which up until now was tripping this assertion). Now that testcase fails a slighlty later assertion (which I'll sort out on that bug). The first hunk of this patch is just a simplification -- replacing a complicated condition (IsRowOriented==IsOrthogonalTo) with a simpler formulation of the same condition. I'm making that simplification in this patch so that we're more clearly consistent about what condition we depend on for baseline alignment. After this patch, that (simplified) condition matches the condition that we assert inside of GetBaselineOffsetFromOuterCrossEdge(). Note: I'm adding two XXXdholbert comments in this patch, for outstanding issues that I ran across which are out-of-scope for this patch series. MozReview-Commit-ID: 5x5xqWWilQZ --HG-- extra : rebase_source : b25e8bfd7425f76b9784df0bd60fc454d4089347
This commit is contained in:
Родитель
fbc7422d44
Коммит
cc0ea3c45c
|
@ -1870,14 +1870,15 @@ FlexItem::FlexItem(ReflowInput& aFlexItemReflowInput,
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
|
|
||||||
// Map align-self 'baseline' value to 'start' when baseline alignment
|
// Map align-self 'baseline' value to 'start' when baseline alignment
|
||||||
// is not possible because the FlexItem's writing mode is orthogonal to
|
// is not possible because the FlexItem's block axis is orthogonal to
|
||||||
// the main axis of the container. If that's the case, we just directly
|
// the cross 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
|
// convert our align-self value here, so that we don't have to handle this
|
||||||
// with special cases elsewhere.
|
// with special cases elsewhere.
|
||||||
// We are treating this case as one where it is appropriate to use the
|
// We are treating this case as one where it is appropriate to use the
|
||||||
// fallback values defined at https://www.w3.org/TR/css-align-3/#baseline
|
// fallback values defined at https://www.w3.org/TR/css-align/#baseline-values
|
||||||
if (aAxisTracker.IsRowOriented() ==
|
// XXXdholbert That spec text actually says to fall back to 'start'/'end',
|
||||||
aAxisTracker.GetWritingMode().IsOrthogonalTo(mWM)) {
|
// not 'flex-start'/'flex-end'... Probably sort this out in bug 1207698.
|
||||||
|
if (!IsBlockAxisCrossAxis()) {
|
||||||
if (mAlignSelf == NS_STYLE_ALIGN_BASELINE) {
|
if (mAlignSelf == NS_STYLE_ALIGN_BASELINE) {
|
||||||
mAlignSelf = NS_STYLE_ALIGN_FLEX_START;
|
mAlignSelf = NS_STYLE_ALIGN_FLEX_START;
|
||||||
} else if (mAlignSelf == NS_STYLE_ALIGN_LAST_BASELINE) {
|
} else if (mAlignSelf == NS_STYLE_ALIGN_LAST_BASELINE) {
|
||||||
|
@ -1961,18 +1962,22 @@ FlexItem::GetBaselineOffsetFromOuterCrossEdge(
|
||||||
const FlexboxAxisTracker& aAxisTracker,
|
const FlexboxAxisTracker& aAxisTracker,
|
||||||
bool aUseFirstLineBaseline) const
|
bool aUseFirstLineBaseline) const
|
||||||
{
|
{
|
||||||
// NOTE: Currently, 'mAscent' (taken from reflow) is an inherently vertical
|
// NOTE:
|
||||||
// measurement -- it's the distance from the border-top edge of this FlexItem
|
// * We only use baselines for aligning in the flex container's cross axis.
|
||||||
// to its baseline. So, we can really only do baseline alignment when the
|
// * Baselines are a measurement in the item's block axis.
|
||||||
// cross axis is vertical. (The FlexItem constructor enforces this when
|
// ...so we only expect to get here if the item's block axis is parallel (or
|
||||||
// resolving the item's "mAlignSelf" value).
|
// antiparallel) to the container's cross axis. (Otherwise, the FlexItem
|
||||||
MOZ_ASSERT(!aAxisTracker.IsCrossAxisHorizontal(),
|
// constructor should've resolved mAlignSelf with a fallback value, which
|
||||||
|
// would prevent this function from being called.)
|
||||||
|
MOZ_ASSERT(IsBlockAxisCrossAxis(),
|
||||||
"Only expecting to be doing baseline computations when the "
|
"Only expecting to be doing baseline computations when the "
|
||||||
"cross axis is vertical");
|
"cross axis is the block axis");
|
||||||
|
|
||||||
AxisOrientationType crossAxis = aAxisTracker.GetCrossAxis();
|
AxisOrientationType crossAxis = aAxisTracker.GetCrossAxis();
|
||||||
mozilla::Side sideToMeasureFrom = kAxisOrientationToSidesMap[crossAxis][aEdge];
|
mozilla::Side sideToMeasureFrom = kAxisOrientationToSidesMap[crossAxis][aEdge];
|
||||||
|
|
||||||
|
// XXXdholbert The "top"/"bottom" physical-axis dependencies below need to be
|
||||||
|
// logicalized -- see bug 1384266.
|
||||||
nscoord marginTopToBaseline = ResolvedAscent(aUseFirstLineBaseline) +
|
nscoord marginTopToBaseline = ResolvedAscent(aUseFirstLineBaseline) +
|
||||||
mMargin.top;
|
mMargin.top;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче