Bug 1565652 - Treat all audio elements as replaced; r=miker a=RyanVM
authorPatrick Brosset <pbrosset@mozilla.com>
Mon, 29 Jul 2019 11:43:54 +0000
changeset 544846 cc88bee2c7a9f8fe9254371b8bd03afd8d6ace59
parent 544845 4dd5da95d5c19c2d05aa00cf35ad71f1d06982f2
child 544847 13b13662c19a39e5a9660cbd5e54a473b1392cfe
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
Bug 1565652 - Treat all audio elements as replaced; r=miker a=RyanVM Before this patch we would only treat audio elements as replaced if they had something visible on the page, so if they had the controls attribute. This is a specific case that we don't really need to worry about. If we unconditionnally assume audio elements are replaced, then the code is simpler and the heuristic is still fine for the vast majority of cases. In fact, it's even more correct, as an audio element that's inline and does *not* have the controls attribute still has active width/height properties. So we do need to treat it as replaced even in this case. Differential Revision: https://phabricator.services.mozilla.com/D39216
--- a/devtools/server/actors/utils/inactive-property-helper.js
+++ b/devtools/server/actors/utils/inactive-property-helper.js
@@ -461,16 +461,17 @@ class InactivePropertyHelper {
    * content that will be replaced e.g. <img>, <audio>, <video> or <object>
    * elements.
   get replaced() {
     // The <applet> element was removed in Gecko 56 so we can ignore them.
     // These are always treated as replaced elements:
     if (
+        "audio",
         // Inputs are generally replaced elements. E.g. checkboxes and radios are replaced
         // unless they have `-moz-appearance: none`. However unconditionally treating them
@@ -486,22 +487,16 @@ class InactivePropertyHelper {
     ) {
       return true;
-    // audio – Treated as a replaced element only when it's "exposing a user
-    // interface element" i.e. has a "controls" attribute.
-    if (this.nodeName === "audio" && this.node.getAttribute("controls")) {
-      return true;
-    }
     // img tags are replaced elements only when the image has finished loading.
     if (this.nodeName === "img" && this.node.complete) {
       return true;
     return false;