Web Inspector: REGRESSION: Audit: result UI shown on first open if an audit was previ...
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Apr 2019 22:47:26 +0000 (22:47 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Apr 2019 22:47:26 +0000 (22:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196723
<rdar://problem/49722252>

Reviewed by Timothy Hatcher.

When opening Web Inspector for the first time, we will trigger resize `layout`s on the main
content area as Web Inspector is resized to it's old window size.

Rather than treating this layout as a `View.LayoutReason.Resize`, we should treat the
first `layout` (e.g. `initialLayout`) as a `View.LayoutReason.Dirty` instead, as there was
previously no content.

* UserInterface/Views/View.js:
(WI.View.prototype._layoutSubtree):
(WI.View.prototype._setLayoutReason):

* UserInterface/Views/AuditTestContentView.js:
(WI.AuditTestContentView):
Drive-by: ensure that this class is not instantiated directly.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244157 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/AuditTestContentView.js
Source/WebInspectorUI/UserInterface/Views/View.js

index f2bd044..6bf4c29 100644 (file)
@@ -1,5 +1,28 @@
 2019-04-10  Devin Rousso  <drousso@apple.com>
 
+        Web Inspector: REGRESSION: Audit: result UI shown on first open if an audit was previously selected
+        https://bugs.webkit.org/show_bug.cgi?id=196723
+        <rdar://problem/49722252>
+
+        Reviewed by Timothy Hatcher.
+
+        When opening Web Inspector for the first time, we will trigger resize `layout`s on the main
+        content area as Web Inspector is resized to it's old window size.
+
+        Rather than treating this layout as a `View.LayoutReason.Resize`, we should treat the
+        first `layout` (e.g. `initialLayout`) as a `View.LayoutReason.Dirty` instead, as there was
+        previously no content.
+
+        * UserInterface/Views/View.js:
+        (WI.View.prototype._layoutSubtree):
+        (WI.View.prototype._setLayoutReason):
+
+        * UserInterface/Views/AuditTestContentView.js:
+        (WI.AuditTestContentView):
+        Drive-by: ensure that this class is not instantiated directly.
+
+2019-04-10  Devin Rousso  <drousso@apple.com>
+
         Web Inspector: Debugger: current call frame indicator is indented when there is more than one thread
         https://bugs.webkit.org/show_bug.cgi?id=196580
         <rdar://problem/49582138>
index 646d692..cb38605 100644 (file)
@@ -31,6 +31,9 @@ WI.AuditTestContentView = class AuditTestContentView extends WI.ContentView
 
         super(representedObject);
 
+        // This class should not be instantiated directly. Create a concrete subclass instead.
+        console.assert(this.constructor !== WI.AuditTestContentView && this instanceof WI.AuditTestContentView);
+
         this.element.classList.add("audit-test");
 
         this._exportButtonNavigationItem = new WI.ButtonNavigationItem("audit-export", WI.UIString("Export"), "Images/Export.svg", 15, 15);
index 5494f98..b4adbce 100644 (file)
@@ -276,7 +276,10 @@ WI.View = class View extends WI.Object
         this._dirtyDescendantsCount = 0;
         let isInitialLayout = !this._didInitialLayout;
 
-        if (!this._didInitialLayout) {
+        if (isInitialLayout) {
+            // The initial layout should always be treated as dirty.
+            this._setLayoutReason();
+
             this.initialLayout();
             this._didInitialLayout = true;
         }
@@ -301,9 +304,6 @@ WI.View = class View extends WI.Object
 
     _setLayoutReason(layoutReason)
     {
-        if (this._layoutReason === WI.View.LayoutReason.Resize)
-            return;
-
         this._layoutReason = layoutReason || WI.View.LayoutReason.Dirty;
     }