Title: [185709] trunk/Source/WebInspectorUI
Revision
185709
Author
[email protected]
Date
2015-06-18 10:58:33 -0700 (Thu, 18 Jun 2015)

Log Message

Web Inspector: New Rule button doesn't reveal the newly added rule if not visible upon creation
https://bugs.webkit.org/show_bug.cgi?id=117600

Patch by Devin Rousso <[email protected]> on 2015-06-18
Reviewed by Timothy Hatcher.

* UserInterface/Views/RulesStyleDetailsPanel.js: Made previousFocusedSection into a member variable of the RulesStyleDetailsPanel.  This way, when the nodeStyles is refreshed (when a new rule is added), the previousFocusedSection will be scrolled into view.
(WebInspector.RulesStyleDetailsPanel):
(WebInspector.RulesStyleDetailsPanel.prototype.refresh.appendStyleSection):
(WebInspector.RulesStyleDetailsPanel.prototype.nodeStylesRefreshed):
(WebInspector.RulesStyleDetailsPanel.prototype.refresh): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (185708 => 185709)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-06-18 17:58:22 UTC (rev 185708)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-06-18 17:58:33 UTC (rev 185709)
@@ -1,3 +1,16 @@
+2015-06-18  Devin Rousso  <[email protected]>
+
+        Web Inspector: New Rule button doesn't reveal the newly added rule if not visible upon creation
+        https://bugs.webkit.org/show_bug.cgi?id=117600
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Views/RulesStyleDetailsPanel.js: Made previousFocusedSection into a member variable of the RulesStyleDetailsPanel.  This way, when the nodeStyles is refreshed (when a new rule is added), the previousFocusedSection will be scrolled into view.
+        (WebInspector.RulesStyleDetailsPanel):
+        (WebInspector.RulesStyleDetailsPanel.prototype.refresh.appendStyleSection):
+        (WebInspector.RulesStyleDetailsPanel.prototype.nodeStylesRefreshed):
+        (WebInspector.RulesStyleDetailsPanel.prototype.refresh): Deleted.
+
 2015-06-18  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r185671.

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js (185708 => 185709)


--- trunk/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js	2015-06-18 17:58:22 UTC (rev 185708)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js	2015-06-18 17:58:33 UTC (rev 185709)
@@ -30,6 +30,7 @@
         super("rules", "rules", WebInspector.UIString("Rules"));
 
         this._sections = [];
+        this._previousFocusedSection = null;
         this._propertyToSelectAndHighlight = null;
     }
 
@@ -47,7 +48,6 @@
 
         var previousMediaList = [];
         var previousSection = null;
-        var previousFocusedSection = null;
 
         function mediaListsEqual(a, b)
         {
@@ -116,8 +116,8 @@
         function appendStyleSection(style)
         {
             var section = style.__rulesSection;
-            if (section && section.focused && !previousFocusedSection)
-                previousFocusedSection = section;
+            if (section && section.focused && !this._previousFocusedSection)
+                this._previousFocusedSection = section;
 
             if (!section) {
                 section = new WebInspector.CSSStyleDeclarationSection(this, style);
@@ -126,7 +126,7 @@
                 section.refresh();
 
             if (this._focusNextNewInspectorRule && style.ownerRule && style.ownerRule.type === WebInspector.CSSRule.Type.Inspector) {
-                previousFocusedSection = section;
+                this._previousFocusedSection = section;
                 delete this._focusNextNewInspectorRule;
             }
 
@@ -237,9 +237,6 @@
 
         for (var i = 0; i < this._sections.length; ++i)
             this._sections[i].updateLayout();
-
-        if (previousFocusedSection)
-            previousFocusedSection.focus();
     }
 
     scrollToSectionAndHighlightProperty(property)
@@ -304,6 +301,11 @@
             this.scrollToSectionAndHighlightProperty(this._propertyToSelectAndHighlight);
             this._propertyToSelectAndHighlight = null;
         }
+
+        if (this._previousFocusedSection && this._visible) {
+            this._previousFocusedSection.focus();
+            this._previousFocusedSection = null;
+        }
     }
 
     // Private
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to