Backed out 2 changesets (bug 1552287) for failing contain-layout-suppress-baseline-002.html on a CLOSED TREE
authorAndreea Pavel <apavel@mozilla.com>
Fri, 24 May 2019 03:34:03 +0300
changeset 475289 3b14313df83b02bcbc04a4b788d63f6e9a20becb
parent 475288 ee890b30dbe3126fa7c0c55b911de8dc65ef3867
child 475290 6acae89335b04d1d634fe5f6be2637f25e3e81e2
push id36058
push useraciure@mozilla.com
push dateFri, 24 May 2019 03:53:25 +0000
treeherdermozilla-central@c87317c41902 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1552287
milestone69.0a1
backs out815c6657d164d34b215a39d233cc60b2e6f546fa
888c32d2a32e849046cfe945593fe684c79e9ffa
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 2 changesets (bug 1552287) for failing contain-layout-suppress-baseline-002.html on a CLOSED TREE Backed out changeset 815c6657d164 (bug 1552287) Backed out changeset 888c32d2a32e (bug 1552287)
layout/forms/nsDateTimeControlFrame.cpp
layout/forms/nsHTMLButtonControlFrame.cpp
layout/forms/nsNumberControlFrame.cpp
layout/forms/nsTextControlFrame.cpp
layout/forms/nsTextControlFrame.h
layout/generic/nsBlockFrame.cpp
layout/generic/nsFlexContainerFrame.cpp
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsGridContainerFrame.cpp
layout/reftests/w3c-css/submitted/contain/reftest.list
layout/tables/nsTableWrapperFrame.cpp
layout/tables/nsTableWrapperFrame.h
testing/web-platform/meta/css/css-contain/contain-layout-baseline-005.html.ini
testing/web-platform/meta/css/css-contain/contain-layout-grid-001.html.ini
testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-layout-suppress-baseline-002.html.ini
testing/web-platform/tests/css/css-contain/contain-layout-baseline-005.html
testing/web-platform/tests/css/css-contain/contain-layout-button-001.html
testing/web-platform/tests/css/css-contain/reference/contain-layout-baseline-005-ref.html
testing/web-platform/tests/css/css-contain/reference/contain-layout-button-001-ref.html
--- a/layout/forms/nsDateTimeControlFrame.cpp
+++ b/layout/forms/nsDateTimeControlFrame.cpp
@@ -180,25 +180,21 @@ void nsDateTimeControlFrame::Reflow(nsPr
     // Needed in FinishReflowChild, for logical-to-physical conversion:
     nsSize borderBoxSize =
         LogicalSize(myWM, borderBoxISize, borderBoxBSize).GetPhysicalSize(myWM);
 
     // Place the child
     FinishReflowChild(inputAreaFrame, aPresContext, childDesiredSize,
                       &childReflowOuput, myWM, childOffset, borderBoxSize, 0);
 
-    if (!aReflowInput.mStyleDisplay->IsContainLayout()) {
-      nsSize contentBoxSize =
-          LogicalSize(myWM, contentBoxISize, contentBoxBSize)
-              .GetPhysicalSize(myWM);
-      aDesiredSize.SetBlockStartAscent(
-          childDesiredSize.BlockStartAscent() +
-          inputAreaFrame->BStart(aReflowInput.GetWritingMode(),
-                                 contentBoxSize));
-    }  // else: we're layout-contained, and so we have no baseline.
+    nsSize contentBoxSize = LogicalSize(myWM, contentBoxISize, contentBoxBSize)
+                                .GetPhysicalSize(myWM);
+    aDesiredSize.SetBlockStartAscent(
+        childDesiredSize.BlockStartAscent() +
+        inputAreaFrame->BStart(aReflowInput.GetWritingMode(), contentBoxSize));
   }
 
   LogicalSize logicalDesiredSize(myWM, borderBoxISize, borderBoxBSize);
   aDesiredSize.SetSize(myWM, logicalDesiredSize);
 
   aDesiredSize.SetOverflowAreasToDesiredBounds();
 
   if (inputAreaFrame) {
--- a/layout/forms/nsHTMLButtonControlFrame.cpp
+++ b/layout/forms/nsHTMLButtonControlFrame.cpp
@@ -306,24 +306,34 @@ void nsHTMLButtonControlFrame::ReflowBut
       wm,
       LogicalSize(wm, aButtonReflowInput.ComputedISize() + clbp.IStartEnd(wm),
                   buttonContentBox.BSize(wm) + clbp.BStartEnd(wm)));
 
   //  * Button's ascent is its child's ascent, plus the child's block-offset
   // within our frame... unless it's orthogonal, in which case we'll use the
   // contents inline-size as an approximation for now.
   // XXX is there a better strategy? should we include border-padding?
-  if (!aButtonReflowInput.mStyleDisplay->IsContainLayout()) {
-    if (aButtonDesiredSize.GetWritingMode().IsOrthogonalTo(wm)) {
-      aButtonDesiredSize.SetBlockStartAscent(contentsDesiredSize.ISize(wm));
-    } else {
-      aButtonDesiredSize.SetBlockStartAscent(
-          contentsDesiredSize.BlockStartAscent() + childPos.B(wm));
-    }
-  }  // else: we're layout-contained, and so we have no baseline.
+  if (aButtonReflowInput.mStyleDisplay->IsContainLayout()) {
+    // If we're layout-contained, then for the purposes of computing the
+    // ascent, we should pretend our button-contents frame had 0 height. In
+    // other words, we use the <button> content-rect's central block-axis
+    // position as our baseline.
+    // NOTE: This should be the same ascent that we'd get from the final 'else'
+    // clause here, if we had no DOM children. In that no-children scenario,
+    // the final 'else' clause's BlockStartAscent() term would be 0, and its
+    // childPos.B(wm) term would be equal to the same central offset that we're
+    // independently calculating here.
+    nscoord containAscent = (buttonContentBox.BSize(wm) / 2) + clbp.BStart(wm);
+    aButtonDesiredSize.SetBlockStartAscent(containAscent);
+  } else if (aButtonDesiredSize.GetWritingMode().IsOrthogonalTo(wm)) {
+    aButtonDesiredSize.SetBlockStartAscent(contentsDesiredSize.ISize(wm));
+  } else {
+    aButtonDesiredSize.SetBlockStartAscent(
+        contentsDesiredSize.BlockStartAscent() + childPos.B(wm));
+  }
 
   aButtonDesiredSize.SetOverflowAreasToDesiredBounds();
 }
 
 bool nsHTMLButtonControlFrame::GetVerticalAlignBaseline(
     mozilla::WritingMode aWM, nscoord* aBaseline) const {
   nsIFrame* inner = mFrames.FirstChild();
   if (MOZ_UNLIKELY(inner->GetWritingMode().IsOrthogonalTo(aWM))) {
--- a/layout/forms/nsNumberControlFrame.cpp
+++ b/layout/forms/nsNumberControlFrame.cpp
@@ -208,25 +208,22 @@ void nsNumberControlFrame::Reflow(nsPres
     nsSize borderBoxSize =
         LogicalSize(myWM, borderBoxISize, borderBoxBSize).GetPhysicalSize(myWM);
 
     // Place the child
     FinishReflowChild(outerWrapperFrame, aPresContext, wrappersDesiredSize,
                       &wrapperReflowInput, myWM, wrapperOffset, borderBoxSize,
                       0);
 
-    if (!aReflowInput.mStyleDisplay->IsContainLayout()) {
-      nsSize contentBoxSize =
-          LogicalSize(myWM, contentBoxISize, contentBoxBSize)
-              .GetPhysicalSize(myWM);
-      aDesiredSize.SetBlockStartAscent(
-          wrappersDesiredSize.BlockStartAscent() +
-          outerWrapperFrame->BStart(aReflowInput.GetWritingMode(),
-                                    contentBoxSize));
-    }  // else: we're layout-contained, and so we have no baseline.
+    nsSize contentBoxSize = LogicalSize(myWM, contentBoxISize, contentBoxBSize)
+                                .GetPhysicalSize(myWM);
+    aDesiredSize.SetBlockStartAscent(
+        wrappersDesiredSize.BlockStartAscent() +
+        outerWrapperFrame->BStart(aReflowInput.GetWritingMode(),
+                                  contentBoxSize));
   }
 
   LogicalSize logicalDesiredSize(myWM, borderBoxISize, borderBoxBSize);
   aDesiredSize.SetSize(myWM, logicalDesiredSize);
 
   aDesiredSize.SetOverflowAreasToDesiredBounds();
 
   if (outerWrapperFrame) {
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -576,31 +576,29 @@ void nsTextControlFrame::Reflow(nsPresCo
   LogicalSize finalSize(
       wm,
       aReflowInput.ComputedISize() +
           aReflowInput.ComputedLogicalBorderPadding().IStartEnd(wm),
       aReflowInput.ComputedBSize() +
           aReflowInput.ComputedLogicalBorderPadding().BStartEnd(wm));
   aDesiredSize.SetSize(wm, finalSize);
 
-  if (!aReflowInput.mStyleDisplay->IsContainLayout()) {
-    // Calculate the baseline and store it in mFirstBaseline.
-    nscoord lineHeight = aReflowInput.ComputedBSize();
-    float inflation = nsLayoutUtils::FontSizeInflationFor(this);
-    if (!IsSingleLineTextControl()) {
-      lineHeight = ReflowInput::CalcLineHeight(
-          GetContent(), Style(), PresContext(), NS_AUTOHEIGHT, inflation);
-    }
-    RefPtr<nsFontMetrics> fontMet =
-        nsLayoutUtils::GetFontMetricsForFrame(this, inflation);
-    mFirstBaseline = nsLayoutUtils::GetCenteredFontBaseline(
-                         fontMet, lineHeight, wm.IsLineInverted()) +
-                     aReflowInput.ComputedLogicalBorderPadding().BStart(wm);
-    aDesiredSize.SetBlockStartAscent(mFirstBaseline);
-  }  // else: we're layout-contained, and so we have no baseline.
+  // Calculate the baseline and store it in mFirstBaseline.
+  nscoord lineHeight = aReflowInput.ComputedBSize();
+  float inflation = nsLayoutUtils::FontSizeInflationFor(this);
+  if (!IsSingleLineTextControl()) {
+    lineHeight = ReflowInput::CalcLineHeight(
+        GetContent(), Style(), PresContext(), NS_AUTOHEIGHT, inflation);
+  }
+  RefPtr<nsFontMetrics> fontMet =
+      nsLayoutUtils::GetFontMetricsForFrame(this, inflation);
+  mFirstBaseline = nsLayoutUtils::GetCenteredFontBaseline(fontMet, lineHeight,
+                                                          wm.IsLineInverted()) +
+                   aReflowInput.ComputedLogicalBorderPadding().BStart(wm);
+  aDesiredSize.SetBlockStartAscent(mFirstBaseline);
 
   // overflow handling
   aDesiredSize.SetOverflowAreasToDesiredBounds();
   // perform reflow on all kids
   nsIFrame* kid = mFrames.FirstChild();
   while (kid) {
     ReflowTextControlChild(kid, aPresContext, aReflowInput, aStatus,
                            aDesiredSize);
--- a/layout/forms/nsTextControlFrame.h
+++ b/layout/forms/nsTextControlFrame.h
@@ -64,17 +64,17 @@ class nsTextControlFrame final : public 
                                 nscoord* aBaseline) const override {
     return GetNaturalBaselineBOffset(aWM, BaselineSharingGroup::First,
                                      aBaseline);
   }
 
   bool GetNaturalBaselineBOffset(mozilla::WritingMode aWM,
                                  BaselineSharingGroup aBaselineGroup,
                                  nscoord* aBaseline) const override {
-    if (StyleDisplay()->IsContainLayout() || !IsSingleLineTextControl()) {
+    if (!IsSingleLineTextControl()) {
       return false;
     }
     NS_ASSERTION(mFirstBaseline != NS_INTRINSIC_ISIZE_UNKNOWN,
                  "please call Reflow before asking for the baseline");
     if (aBaselineGroup == BaselineSharingGroup::First) {
       *aBaseline = mFirstBaseline;
     } else {
       *aBaseline = BSize(aWM) - mFirstBaseline;
@@ -332,17 +332,17 @@ class nsTextControlFrame final : public 
   // Otherwise, it's cached when setting specific value or getting value from
   // TextEditor.  Additionally, when contents in the anonymous <div> element
   // is modified, this is cleared.
   //
   // FIXME(bug 1402545): Consider using an nsAutoString here.
   nsString mCachedValue;
 
   // Our first baseline, or NS_INTRINSIC_ISIZE_UNKNOWN if we have a pending
-  // Reflow (or if we're contain:layout, which means we have no baseline).
+  // Reflow.
   nscoord mFirstBaseline;
 
   // these packed bools could instead use the high order bits on mState, saving
   // 4 bytes
   bool mEditorHasBeenInitialized;
   bool mIsProcessing;
 
 #ifdef DEBUG
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -2925,21 +2925,18 @@ void nsBlockFrame::ReflowDirtyLines(Bloc
         marker, aState, metrics,
         aState.mReflowInput.ComputedPhysicalBorderPadding().top);
     NS_ASSERTION(!MarkerIsEmpty() || metrics.BSize(wm) == 0,
                  "empty ::marker frame took up space");
 
     if (!MarkerIsEmpty()) {
       // There are no lines so we have to fake up some y motion so that
       // we end up with *some* height.
-      // (Note: if we're layout-contained, we have to be sure to leave our
-      // ReflowOutput's BlockStartAscent() (i.e. the baseline) untouched,
-      // because layout-contained frames have no baseline.)
-      if (!aState.mReflowInput.mStyleDisplay->IsContainLayout() &&
-          metrics.BlockStartAscent() == ReflowOutput::ASK_FOR_BASELINE) {
+
+      if (metrics.BlockStartAscent() == ReflowOutput::ASK_FOR_BASELINE) {
         nscoord ascent;
         WritingMode wm = aState.mReflowInput.GetWritingMode();
         if (nsLayoutUtils::GetFirstLineBaseline(wm, marker, &ascent)) {
           metrics.SetBlockStartAscent(ascent);
         } else {
           metrics.SetBlockStartAscent(metrics.BSize(wm));
         }
       }
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -4548,18 +4548,19 @@ void nsFlexContainerFrame::DoFlexLayout(
 
   GenerateFlexLines(aPresContext, aReflowInput, aContentBoxMainSize,
                     aAvailableBSizeForContent, aStruts, aAxisTracker,
                     aMainGapSize, aHasLineClampEllipsis, placeholderKids,
                     lines);
 
   if ((lines.getFirst()->IsEmpty() && !lines.getFirst()->getNext()) ||
       aReflowInput.mStyleDisplay->IsContainLayout()) {
-    // We have no flex items, or we're layout-contained. So, we have no
-    // baseline, and our parent should synthesize a baseline if needed.
+    // If have no flex items, or if we  are layout contained and
+    // want to behave as if we have none, our parent
+    // should synthesize a baseline if needed.
     AddStateBits(NS_STATE_FLEX_SYNTHESIZE_BASELINE);
   } else {
     RemoveStateBits(NS_STATE_FLEX_SYNTHESIZE_BASELINE);
   }
 
   // Construct our computed info if we've been asked to do so. This is
   // necessary to do now so we can capture some computed values for
   // FlexItems during layout that would not otherwise be saved (like
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -974,18 +974,17 @@ static void GetScrollableOverflowForPers
 nscoord nsHTMLScrollFrame::GetLogicalBaseline(WritingMode aWritingMode) const {
   // This function implements some of the spec text here:
   //  https://drafts.csswg.org/css-align/#baseline-export
   //
   // Specifically: if our scrolled frame is a block, we just use the inherited
   // GetLogicalBaseline() impl, which synthesizes a baseline from the
   // margin-box. Otherwise, we defer to our scrolled frame, considering it
   // to be scrolled to its initial scroll position.
-  if (mHelper.mScrolledFrame->IsBlockFrameOrSubclass() ||
-      StyleDisplay()->IsContainLayout()) {
+  if (mHelper.mScrolledFrame->IsBlockFrameOrSubclass()) {
     return nsContainerFrame::GetLogicalBaseline(aWritingMode);
   }
 
   // OK, here's where we defer to our scrolled frame. We have to add our
   // border BStart thickness to whatever it returns, to produce an offset in
   // our frame-rect's coordinate system. (We don't have to add padding,
   // because the scrolled frame handles our padding.)
   LogicalMargin border = GetLogicalUsedBorder(aWritingMode);
--- a/layout/generic/nsGridContainerFrame.cpp
+++ b/layout/generic/nsGridContainerFrame.cpp
@@ -7034,20 +7034,18 @@ void nsGridContainerFrame::Reflow(nsPres
                "continuations should have same kIsSubgridBits");
   }
   GridReflowInput gridReflowInput(this, aReflowInput);
   if (gridReflowInput.mIter.ItemsAreAlreadyInOrder()) {
     AddStateBits(NS_STATE_GRID_NORMAL_FLOW_CHILDREN_IN_CSS_ORDER);
   } else {
     RemoveStateBits(NS_STATE_GRID_NORMAL_FLOW_CHILDREN_IN_CSS_ORDER);
   }
-  if (gridReflowInput.mIter.AtEnd() ||
-      aReflowInput.mStyleDisplay->IsContainLayout()) {
-    // We have no grid items, or we're layout-contained. So, we have no
-    // baseline, and our parent should synthesize a baseline if needed.
+  if (gridReflowInput.mIter.AtEnd()) {
+    // We have no grid items, our parent should synthesize a baseline if needed.
     AddStateBits(NS_STATE_GRID_SYNTHESIZE_BASELINE);
   } else {
     RemoveStateBits(NS_STATE_GRID_SYNTHESIZE_BASELINE);
   }
   const nscoord computedBSize = aReflowInput.ComputedBSize();
   const nscoord computedISize = aReflowInput.ComputedISize();
   const WritingMode& wm = gridReflowInput.mWM;
   const LogicalSize computedSize(wm, computedISize, computedBSize);
--- a/layout/reftests/w3c-css/submitted/contain/reftest.list
+++ b/layout/reftests/w3c-css/submitted/contain/reftest.list
@@ -43,16 +43,16 @@ fuzzy-if(webrender&&winWidget,0-24,0-2) 
 == contain-layout-formatting-context-margin-001.html contain-layout-formatting-context-margin-001-ref.html
 == contain-layout-containing-block-fixed-001.html contain-paint-containing-block-fixed-001-ref.html
 == contain-layout-containing-block-absolute-001.html contain-paint-containing-block-absolute-001-ref.html
 == contain-layout-ignored-cases-ib-split-001.html contain-layout-ignored-cases-ib-split-001-ref.html
 == contain-layout-ignored-cases-no-principal-box-001.html contain-paint-ignored-cases-no-principal-box-001-ref.html
 == contain-layout-ignored-cases-no-principal-box-002.html contain-layout-ignored-cases-no-principal-box-002-ref.html
 == contain-layout-ignored-cases-no-principal-box-003.html contain-layout-ignored-cases-no-principal-box-003-ref.html
 == contain-layout-suppress-baseline-001.html contain-layout-suppress-baseline-001-ref.html
-== contain-layout-suppress-baseline-002.html contain-layout-suppress-baseline-002-ref.html
+fails == contain-layout-suppress-baseline-002.html contain-layout-suppress-baseline-002-ref.html # bug 1552287
 
 # The following lines are duplicates of other lines from further up in this
 # manifest. They're listed again here so we can re-run these tests with
 # column-span enabled. These lines can be removed once the pref becomes
 # default-enabled (Bug 1426010).
 pref(layout.css.column-span.enabled,true) == contain-size-multicol-002.html contain-size-multicol-002-ref.html
 pref(layout.css.column-span.enabled,true) == contain-size-multicol-003.html contain-size-multicol-003-ref.html
--- a/layout/tables/nsTableWrapperFrame.cpp
+++ b/layout/tables/nsTableWrapperFrame.cpp
@@ -26,22 +26,16 @@
 using namespace mozilla;
 using namespace mozilla::layout;
 
 #define NO_SIDE 100
 
 /* virtual */
 nscoord nsTableWrapperFrame::GetLogicalBaseline(
     WritingMode aWritingMode) const {
-  if (StyleDisplay()->IsContainLayout()) {
-    // We have no baseline. Fall back to the inherited impl which is
-    // appropriate for this situation.
-    return nsContainerFrame::GetLogicalBaseline(aWritingMode);
-  }
-
   nsIFrame* kid = mFrames.FirstChild();
   if (!kid) {
     MOZ_ASSERT_UNREACHABLE("no inner table");
     return nsContainerFrame::GetLogicalBaseline(aWritingMode);
   }
 
   return kid->GetLogicalBaseline(aWritingMode) +
          kid->BStart(aWritingMode, mRect.Size());
--- a/layout/tables/nsTableWrapperFrame.h
+++ b/layout/tables/nsTableWrapperFrame.h
@@ -65,19 +65,16 @@ class nsTableWrapperFrame : public nsCon
                                      const nsDisplayListSet& aLists);
 
   virtual nscoord GetLogicalBaseline(
       mozilla::WritingMode aWritingMode) const override;
 
   bool GetNaturalBaselineBOffset(mozilla::WritingMode aWM,
                                  BaselineSharingGroup aBaselineGroup,
                                  nscoord* aBaseline) const override {
-    if (StyleDisplay()->IsContainLayout()) {
-      return false;
-    }
     auto innerTable = InnerTableFrame();
     nscoord offset;
     if (innerTable->GetNaturalBaselineBOffset(aWM, aBaselineGroup, &offset)) {
       auto bStart = innerTable->BStart(aWM, mRect.Size());
       if (aBaselineGroup == BaselineSharingGroup::First) {
         *aBaseline = offset + bStart;
       } else {
         auto bEnd = bStart + innerTable->BSize(aWM);
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/css/css-contain/contain-layout-baseline-005.html.ini
@@ -0,0 +1,2 @@
+[contain-layout-baseline-005.html]
+  expected: FAIL
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/css/css-contain/contain-layout-grid-001.html.ini
@@ -0,0 +1,2 @@
+[contain-layout-grid-001.html]
+  expected: FAIL
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-layout-suppress-baseline-002.html.ini
@@ -0,0 +1,2 @@
+[contain-layout-suppress-baseline-002.html]
+  expected: FAIL
--- a/testing/web-platform/tests/css/css-contain/contain-layout-baseline-005.html
+++ b/testing/web-platform/tests/css/css-contain/contain-layout-baseline-005.html
@@ -8,17 +8,16 @@
 <style>
 .wrapper {
   height: 110px;
 }
 .wrapper > * {
   contain: layout;
   background: cyan;
   font-size: 20px;
-  vertical-align: baseline;
 }
 .wrapper > :nth-child(1) {
   background: magenta;
 }
 .inline-block {
   display: inline-block;
 }
 canvas {
@@ -45,17 +44,17 @@ fieldset, details {
   <div class="inline-block">foo</div>
   <button>foo</button>
   <select><option>foo</option></select>
   <select multiple style="height: 40px;"><option>foo</option></select>
   <textarea style="height: 40px;"></textarea>
 </div>
 <div class="wrapper">
   <canvas></canvas>
-  <input value="foo" size="3"></input>
+  <input value="foo"></input>
   <input type="file"></input>
 </div>
 <div class="wrapper">
   <canvas></canvas>
   <table style="display: inline-table;"><tr><td>foo</td></tr></table>
   <canvas></canvas>
   <fieldset></fieldset>
   <fieldset><legend>foo</legend></fieldset>
--- a/testing/web-platform/tests/css/css-contain/contain-layout-button-001.html
+++ b/testing/web-platform/tests/css/css-contain/contain-layout-button-001.html
@@ -1,24 +1,20 @@
 <!DOCTYPE html>
 <meta charset="utf-8">
 <title>CSS Containment Test: Layout containment on button</title>
 <link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
 <link rel="help" href="https://drafts.csswg.org/css-contain-1/#containment-layout">
-<link rel="help" href="https://drafts.csswg.org/css2/visudet.html#propdef-vertical-align">
 <link rel="match" href="reference/contain-layout-button-001-ref.html">
-<meta name=assert content="Layout containment does apply to buttons, thus their baseline is their margin-bottom edge.">
+<meta name=assert content="Layout containment does apply to buttons, thus their baseline is the same than if they don't have contents.">
 <style>
 button {
   border: 5px solid green;
   padding: 0;
-  /* We use a nonzero margin-bottom to be sure we're synthesizing a baseline
-     from the margin-box rather than from the border-box: */
-  margin-bottom: 2px;
   contain: layout;
   color: transparent;
   width: 0;
   height: 0;
 }
 </style>
 
-<p>This test passes if it has the same output as the reference. You see the word "before", a 10px green square aligned 2px above the text's baseline, and then the word "after".</p>
+<p>This test passes if it has the same output as the reference. You see the word "before", a 10px green square at the bottom, and then the word "after".</p>
 before<button>b</button>after
--- a/testing/web-platform/tests/css/css-contain/reference/contain-layout-baseline-005-ref.html
+++ b/testing/web-platform/tests/css/css-contain/reference/contain-layout-baseline-005-ref.html
@@ -41,17 +41,17 @@ fieldset, details {
   <div class="inline-block">foo</div>
   <button>foo</button>
   <select><option>foo</option></select>
   <select multiple style="height: 40px;"><option>foo</option></select>
   <textarea style="height: 40px;"></textarea>
 </div>
 <div class="wrapper">
   <canvas></canvas>
-  <input value="foo" size="3"></input>
+  <input value="foo"></input>
   <input type="file"></input>
 </div>
 <div class="wrapper">
   <canvas></canvas>
   <table style="display: inline-table;"><tr><td>foo</td></tr></table>
   <canvas></canvas>
   <fieldset></fieldset>
   <fieldset><legend>foo</legend></fieldset>
--- a/testing/web-platform/tests/css/css-contain/reference/contain-layout-button-001-ref.html
+++ b/testing/web-platform/tests/css/css-contain/reference/contain-layout-button-001-ref.html
@@ -1,21 +1,19 @@
 <!DOCTYPE html>
 <meta charset="utf-8">
 <title>CSS Containment Test: Reference file</title>
 <link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
 <style>
-div.fakeButton {
-  display: inline-block;
+button {
   border: 5px solid green;
   padding: 0;
-  margin-bottom: 2px;
   color: transparent;
   width: 0;
   height: 0px;
   /* Layout containment creates a stacking context, the following lines simuluate the same in the reference file. */
   position: relative;
   z-index: 1;
 }
 </style>
 
-<p>This test passes if it has the same output as the reference. You see the word "before", a 10px green square aligned 2px above the text's baseline, and then the word "after".</p>
-before<div class="fakeButton"></div>after
+<p>This test passes if it has the same output as the reference. You see the word "before", a 10px green square at the bottom, and then the word "after".</p>
+before<button></button>after