Bug 1508441 part 1: Adjust button reflow to suppress baseline for contain:layout, instead of for contain:size. r=TYLin
authorDaniel Holbert <dholbert@cs.stanford.edu>
Fri, 26 Apr 2019 21:56:39 +0000
changeset 471824 7e12e84c87164186044c7a06a72494b469fed1a0
parent 471823 17c0c0c8627c4a18f3824a3e62d6e58dbb300ad7
child 471825 f7e1b8a24398e572fe25ed0b40d7db6df0f5cc18
push id35935
push usershindli@mozilla.com
push dateTue, 30 Apr 2019 03:46:04 +0000
treeherdermozilla-central@f3c2a7206699 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersTYLin
bugs1508441
milestone68.0a1
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
Bug 1508441 part 1: Adjust button reflow to suppress baseline for contain:layout, instead of for contain:size. r=TYLin Differential Revision: https://phabricator.services.mozilla.com/D28909
layout/forms/nsHTMLButtonControlFrame.cpp
layout/reftests/w3c-css/submitted/contain/reftest.list
testing/web-platform/meta/css/css-contain/contain-layout-button-001.html.ini
testing/web-platform/meta/css/css-contain/contain-size-button-001.html.ini
testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-button-001.html.ini
--- a/layout/forms/nsHTMLButtonControlFrame.cpp
+++ b/layout/forms/nsHTMLButtonControlFrame.cpp
@@ -306,21 +306,26 @@ 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->IsContainSize()) {
-    // If we're size-contained, we should pretend our contents had 0 height
-    // (as they would, if we had no children). This case is identical to the
-    // final else case, but uses only our specified button height for ascent
-    // (ie. it ignores the height returned in contentsDesiredSize).
+  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));
   }
--- a/layout/reftests/w3c-css/submitted/contain/reftest.list
+++ b/layout/reftests/w3c-css/submitted/contain/reftest.list
@@ -13,17 +13,17 @@ pref(layout.css.overflow-clip-box.enable
 == contain-paint-ignored-cases-ib-split-001.html contain-paint-ignored-cases-ib-split-001-ref.html
 == contain-paint-ignored-cases-internal-table-001a.html contain-paint-ignored-cases-internal-table-001-ref.html
 == contain-paint-ignored-cases-internal-table-001b.html contain-paint-ignored-cases-internal-table-001-ref.html
 == contain-paint-ignored-cases-no-principal-box-001.html contain-paint-ignored-cases-no-principal-box-001-ref.html
 == contain-paint-ignored-cases-ruby-containing-block-001.html contain-paint-ignored-cases-ruby-containing-block-001-ref.html
 == contain-paint-ignored-cases-ruby-stacking-and-clipping-001.html contain-paint-ignored-cases-ruby-stacking-and-clipping-001-ref.html
 == contain-paint-stacking-context-001a.html contain-paint-stacking-context-001-ref.html
 == contain-paint-stacking-context-001b.html contain-paint-stacking-context-001-ref.html
-fails == contain-size-button-001.html contain-size-button-001-ref.html # bug 1508441
+== contain-size-button-001.html contain-size-button-001-ref.html
 == contain-size-block-001.html contain-size-block-001-ref.html
 == contain-size-block-002.html contain-size-block-002-ref.html
 == contain-size-block-003.html contain-size-block-003-ref.html
 == contain-size-block-004.html contain-size-block-004-ref.html
 == contain-size-inline-block-001.html contain-size-inline-block-001-ref.html
 == contain-size-inline-block-002.html contain-size-inline-block-002-ref.html
 == contain-size-inline-block-003.html contain-size-inline-block-003-ref.html
 == contain-size-inline-block-004.html contain-size-inline-block-004-ref.html
deleted file mode 100644
--- a/testing/web-platform/meta/css/css-contain/contain-layout-button-001.html.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[contain-layout-button-001.html]
-  expected: FAIL
deleted file mode 100644
--- a/testing/web-platform/meta/css/css-contain/contain-size-button-001.html.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[contain-size-button-001.html]
-  expected: FAIL
deleted file mode 100644
--- a/testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-button-001.html.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[contain-size-button-001.html]
-  expected: FAIL