Bug 1509004 - Flexbox highlighter remains in place when toggling display:flex in the styles r=gl
authorMichael Ratcliffe <mratcliffe@mozilla.com>
Wed, 28 Nov 2018 16:40:20 +0000
changeset 507757 ea6a0c8d3bb57d8c8c8aceae3c743db461ddd68f
parent 507756 11828ed488177ec28bfb343c64b466785600fab6
child 507758 8953bab8246cf93cae049279a380a70f0de87264
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgl
bugs1509004
milestone65.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 1509004 - Flexbox highlighter remains in place when toggling display:flex in the styles r=gl Differential Revision: https://phabricator.services.mozilla.com/D12665
devtools/server/actors/highlighters/flexbox.js
--- a/devtools/server/actors/highlighters/flexbox.js
+++ b/devtools/server/actors/highlighters/flexbox.js
@@ -742,16 +742,28 @@ class FlexboxHighlighter extends AutoRef
           this.drawJustifyContent(containerWidth - crossStart - crossSize, mainStart,
             containerWidth - crossStart, containerHeight);
           break;
       }
     }
   }
 
   _update() {
+    // If this.currentNode is not a flex container we have nothing to highlight.
+    // We can't simply use getAsFlexContainer() here because this fails for
+    // text fields. This will be removed by https://bugzil.la/1509460.
+    if (!this.computedStyle) {
+      this.computedStyle = getComputedStyle(this.currentNode);
+    }
+
+    if (this.computedStyle.display !== "flex" &&
+        this.computedStyle.display !== "inline-flex") {
+      return false;
+    }
+
     setIgnoreLayoutChanges(true);
 
     const root = this.getElement("root");
 
     // Hide the root element and force the reflow in order to get the proper window's
     // dimensions without increasing them.
     root.setAttribute("style", "display: none");
     this.win.document.documentElement.offsetWidth;