Bug 1565652 - Treat input and select unconditionally as replaced elements; r=miker a=RyanVM
authorPatrick Brosset <pbrosset@mozilla.com>
Mon, 29 Jul 2019 11:42:07 +0000
changeset 544845 4dd5da95d5c19c2d05aa00cf35ad71f1d06982f2
parent 544844 eb98783c379ce453a706d1f9b7b7558b417edb46
child 544846 cc88bee2c7a9f8fe9254371b8bd03afd8d6ace59
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmiker, RyanVM
bugs1565652
milestone69.0
Bug 1565652 - Treat input and select unconditionally as replaced elements; r=miker a=RyanVM Differential Revision: https://phabricator.services.mozilla.com/D39199
devtools/server/actors/utils/inactive-property-helper.js
devtools/server/tests/mochitest/inactive-property-helper/max-min-width-height.js
--- a/devtools/server/actors/utils/inactive-property-helper.js
+++ b/devtools/server/actors/utils/inactive-property-helper.js
@@ -467,19 +467,28 @@ class InactivePropertyHelper {
     if (
       this.nodeNameOneOf([
         "br",
         "button",
         "canvas",
         "embed",
         "hr",
         "iframe",
+        // Inputs are generally replaced elements. E.g. checkboxes and radios are replaced
+        // unless they have `-moz-appearance: none`. However unconditionally treating them
+        // as replaced is enough for our purpose here, and avoids extra complexity that
+        // will likely not be necessary in most cases.
+        "input",
         "math",
         "object",
         "picture",
+        // Select is a replaced element if it has `size<=1` or no size specified, but
+        // unconditionally treating it as replaced is enough for our purpose here, and
+        // avoids extra complexity that will likely not be necessary in most cases.
+        "select",
         "svg",
         "video",
       ])
     ) {
       return true;
     }
 
     // audio – Treated as a replaced element only when it's "exposing a user
--- a/devtools/server/tests/mochitest/inactive-property-helper/max-min-width-height.js
+++ b/devtools/server/tests/mochitest/inactive-property-helper/max-min-width-height.js
@@ -92,16 +92,30 @@ export default [
   {
     info: "width is active on a replaced inline element",
     property: "width",
     tagName: "img",
     rules: ["img { width: 500px; }"],
     isActive: true,
   },
   {
+    info: "width is active on an inline input element",
+    property: "width",
+    tagName: "input",
+    rules: ["input { display: inline; width: 500px; }"],
+    isActive: true,
+  },
+  {
+    info: "width is active on an inline select element",
+    property: "width",
+    tagName: "select",
+    rules: ["select { display: inline; width: 500px; }"],
+    isActive: true,
+  },
+  {
     info: "min-width is active on a replaced inline element",
     property: "min-width",
     tagName: "img",
     rules: ["img { min-width: 500px; }"],
     isActive: true,
   },
   {
     info: "max-width is active on a replaced inline element",
@@ -197,16 +211,30 @@ export default [
   {
     info: "height is active on a replaced inline element",
     property: "height",
     tagName: "img",
     rules: ["img { height: 500px; }"],
     isActive: true,
   },
   {
+    info: "height is active on an inline input element",
+    property: "height",
+    tagName: "input",
+    rules: ["input { display: inline; height: 500px; }"],
+    isActive: true,
+  },
+  {
+    info: "height is active on an inline select element",
+    property: "height",
+    tagName: "select",
+    rules: ["select { display: inline; height: 500px; }"],
+    isActive: true,
+  },
+  {
     info: "min-height is active on a replaced inline element",
     property: "min-height",
     tagName: "img",
     rules: ["img { min-height: 500px; }"],
     isActive: true,
   },
   {
     info: "max-height is active on a replaced inline element",