Web Inspector: Opening inspector with a selected element might immediately scroll...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Sep 2018 23:58:41 +0000 (23:58 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Sep 2018 23:58:41 +0000 (23:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=189569
<rdar://problem/44397098>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2018-09-13
Reviewed by Devin Rousso.

* UserInterface/Views/DOMTreeContentView.js:
(WI.DOMTreeContentView.prototype.layout):
Re-select the selected DOM node in the DOM Tree when the view resizes.
Typically this can happen if the sidebar opens/closes/resizes, in which
case we will want the selected DOM node to stay in view even if the DOM
tree starts wrapping earlier content.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235996 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js

index c071c65..f86151b 100644 (file)
@@ -1,3 +1,18 @@
+2018-09-13  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Opening inspector with a selected element might immediately scroll that element off screen in the DOM Tree outline
+        https://bugs.webkit.org/show_bug.cgi?id=189569
+        <rdar://problem/44397098>
+
+        Reviewed by Devin Rousso.
+
+        * UserInterface/Views/DOMTreeContentView.js:
+        (WI.DOMTreeContentView.prototype.layout):
+        Re-select the selected DOM node in the DOM Tree when the view resizes.
+        Typically this can happen if the sidebar opens/closes/resizes, in which
+        case we will want the selected DOM node to stay in view even if the DOM
+        tree starts wrapping earlier content.
+
 2018-09-12  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: fix test case failures in js-isLikelyStackTrace.html
index 8d99ffc..2d4306d 100644 (file)
@@ -348,6 +348,9 @@ WI.DOMTreeContentView = class DOMTreeContentView extends WI.ContentView
     layout()
     {
         this._domTreeOutline.updateSelection();
+
+        if (this.layoutReason === WI.View.LayoutReason.Resize)
+            this._domTreeOutline.selectDOMNode(this._domTreeOutline.selectedDOMNode());
     }
 
     // Private