Commit 2d42f1dc authored by Manuel Rego Casasnovas's avatar Manuel Rego Casasnovas Committed by Commit Bot

[css-contain] Fix baseline on buttons with layout containment

Layout containment suppress baseline, so buttons with "contain: layout"
should use the same baseline than an empty inline block. This means
that it should use the margin box and not the content box.
Spec (https://www.w3.org/TR/CSS2/visudet.html#propdef-vertical-align):
"If the box does not have a baseline, align the bottom margin edge
 with the parent's baseline."

Modified LayoutButton::BaselinePosition() to take into account
layout containment.

BUG=965740
TEST=external/wpt/css/css-contain/contain-layout-button-001.html

Change-Id: I8752aa4f5aec00dbec2a6c93c16734b47d286c0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1643536Reviewed-by: default avatarChristian Biesinger <cbiesinger@chromium.org>
Commit-Queue: Manuel Rego <rego@igalia.com>
Cr-Commit-Position: refs/heads/master@{#666181}
parent 084a18e5
...@@ -90,7 +90,8 @@ LayoutUnit LayoutButton::BaselinePosition( ...@@ -90,7 +90,8 @@ LayoutUnit LayoutButton::BaselinePosition(
// We want to call the LayoutBlock version of firstLineBoxBaseline to // We want to call the LayoutBlock version of firstLineBoxBaseline to
// avoid LayoutFlexibleBox synthesizing a baseline that we don't want. // avoid LayoutFlexibleBox synthesizing a baseline that we don't want.
// We use this check as a proxy for "are there any line boxes in this button" // We use this check as a proxy for "are there any line boxes in this button"
if (!HasLineIfEmpty() && LayoutBlock::FirstLineBoxBaseline() == -1) { if (!HasLineIfEmpty() && !ShouldApplyLayoutContainment() &&
LayoutBlock::FirstLineBoxBaseline() == -1) {
// To ensure that we have a consistent baseline when we have no children, // To ensure that we have a consistent baseline when we have no children,
// even when we have the anonymous LayoutBlock child, we calculate the // even when we have the anonymous LayoutBlock child, we calculate the
// baseline for the empty case manually here. // baseline for the empty case manually here.
......
...@@ -564,7 +564,6 @@ crbug.com/613753 external/wpt/css/css-tables/border-spacing-included-in-sizes-00 ...@@ -564,7 +564,6 @@ crbug.com/613753 external/wpt/css/css-tables/border-spacing-included-in-sizes-00
crbug.com/880802 external/wpt/css/css-contain/contain-layout-017.html [ Failure ] crbug.com/880802 external/wpt/css/css-contain/contain-layout-017.html [ Failure ]
crbug.com/671132 external/wpt/css/css-contain/contain-layout-baseline-005.html [ Failure ] crbug.com/671132 external/wpt/css/css-contain/contain-layout-baseline-005.html [ Failure ]
crbug.com/626703 external/wpt/css/css-contain/contain-layout-breaks-002.html [ Failure ] crbug.com/626703 external/wpt/css/css-contain/contain-layout-breaks-002.html [ Failure ]
crbug.com/965740 external/wpt/css/css-contain/contain-layout-button-001.html [ Failure ]
crbug.com/847274 external/wpt/css/css-contain/contain-paint-005.html [ Failure ] crbug.com/847274 external/wpt/css/css-contain/contain-paint-005.html [ Failure ]
crbug.com/847274 external/wpt/css/css-contain/contain-paint-006.html [ Failure ] crbug.com/847274 external/wpt/css/css-contain/contain-paint-006.html [ Failure ]
crbug.com/880802 external/wpt/css/css-contain/contain-paint-021.html [ Failure ] crbug.com/880802 external/wpt/css/css-contain/contain-paint-021.html [ Failure ]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment