Title: [201890] trunk/Source/WebInspectorUI
Revision
201890
Author
[email protected]
Date
2016-06-09 15:49:28 -0700 (Thu, 09 Jun 2016)

Log Message

REGRESSION (r194717): Web Inspector: Elements tab: an element loses focus when selected by Up/Down key
https://bugs.webkit.org/show_bug.cgi?id=157768
<rdar://problem/26311155>

Reviewed by Timothy Hatcher.

Remove _previousFocusedSection and _newInspectorRuleSelector since it was used only
to focus on a newly created section (added by clicking on "+" button).

Introduce _inspectorSection and _isInspectorSectionPendingFocus.

* UserInterface/Views/CSSStyleDeclarationSection.js:
(WebInspector.CSSStyleDeclarationSection.prototype.cssStyleDeclarationTextEditorBlurActiveEditor): Deleted.
(WebInspector.CSSStyleDeclarationSection.prototype._handleSelectorPaste): Deleted.
No longer needed, it was only used by _previousFocusedSection and _newInspectorRuleSelector.

* UserInterface/Views/CSSStyleDeclarationTextEditor.js:
(WebInspector.CSSStyleDeclarationTextEditor.): Deleted.
No londer needed, it was only used by _previousFocusedSection.

* UserInterface/Views/RulesStyleDetailsPanel.js:
(WebInspector.RulesStyleDetailsPanel):
(WebInspector.RulesStyleDetailsPanel.prototype.refresh.appendStyleSection):
(WebInspector.RulesStyleDetailsPanel.prototype.newRuleButtonClicked):
(WebInspector.RulesStyleDetailsPanel.prototype.nodeStylesRefreshed):
(WebInspector.RulesStyleDetailsPanel.prototype.cssStyleDeclarationSectionEditorFocused): Deleted.
(WebInspector.RulesStyleDetailsPanel.prototype.cssStyleDeclarationSectionBlurActiveEditor): Deleted.
(WebInspector.RulesStyleDetailsPanel.prototype.cssStyleDeclarationSectionFocusNewInspectorRuleWithSelector): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (201889 => 201890)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-06-09 22:34:41 UTC (rev 201889)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-06-09 22:49:28 UTC (rev 201890)
@@ -1,3 +1,34 @@
+2016-06-09  Nikita Vasilyev  <[email protected]>
+
+        REGRESSION (r194717): Web Inspector: Elements tab: an element loses focus when selected by Up/Down key
+        https://bugs.webkit.org/show_bug.cgi?id=157768
+        <rdar://problem/26311155>
+
+        Reviewed by Timothy Hatcher.
+
+        Remove _previousFocusedSection and _newInspectorRuleSelector since it was used only
+        to focus on a newly created section (added by clicking on "+" button).
+
+        Introduce _inspectorSection and _isInspectorSectionPendingFocus.
+
+        * UserInterface/Views/CSSStyleDeclarationSection.js:
+        (WebInspector.CSSStyleDeclarationSection.prototype.cssStyleDeclarationTextEditorBlurActiveEditor): Deleted.
+        (WebInspector.CSSStyleDeclarationSection.prototype._handleSelectorPaste): Deleted.
+        No longer needed, it was only used by _previousFocusedSection and _newInspectorRuleSelector.
+
+        * UserInterface/Views/CSSStyleDeclarationTextEditor.js:
+        (WebInspector.CSSStyleDeclarationTextEditor.): Deleted.
+        No londer needed, it was only used by _previousFocusedSection.
+
+        * UserInterface/Views/RulesStyleDetailsPanel.js:
+        (WebInspector.RulesStyleDetailsPanel):
+        (WebInspector.RulesStyleDetailsPanel.prototype.refresh.appendStyleSection):
+        (WebInspector.RulesStyleDetailsPanel.prototype.newRuleButtonClicked):
+        (WebInspector.RulesStyleDetailsPanel.prototype.nodeStylesRefreshed):
+        (WebInspector.RulesStyleDetailsPanel.prototype.cssStyleDeclarationSectionEditorFocused): Deleted.
+        (WebInspector.RulesStyleDetailsPanel.prototype.cssStyleDeclarationSectionBlurActiveEditor): Deleted.
+        (WebInspector.RulesStyleDetailsPanel.prototype.cssStyleDeclarationSectionFocusNewInspectorRuleWithSelector): Deleted.
+
 2016-06-08  Joseph Pecoraro  <[email protected]>
 
         REGRESSION: Web Inspector: Should be able to evaluate "{a:1, b:2}" in the console

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js (201889 => 201890)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js	2016-06-09 22:34:41 UTC (rev 201889)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js	2016-06-09 22:49:28 UTC (rev 201890)
@@ -324,12 +324,6 @@
             this._delegate.cssStyleDeclarationSectionEditorFocused(this);
     }
 
-    cssStyleDeclarationTextEditorBlurActiveEditor()
-    {
-        if (typeof this._delegate.cssStyleDeclarationSectionBlurActiveEditor === "function")
-            this._delegate.cssStyleDeclarationSectionBlurActiveEditor(this);
-    }
-
     cssStyleDeclarationTextEditorSwitchRule(reverse)
     {
         if (!this._delegate)
@@ -458,9 +452,6 @@
                 }
             }
 
-            if (this._delegate && typeof this._delegate.cssStyleDeclarationSectionFocusNewInspectorRuleWithSelector === "function")
-                this._delegate.cssStyleDeclarationSectionFocusNewInspectorRuleWithSelector(this._currentSelectorText);
-
             this._style.nodeStyles.addRule(this._currentSelectorText);
         });
 
@@ -486,9 +477,6 @@
                     else
                         selector = this._currentSelectorText + pseudoClassSelector;
 
-                    if (this._delegate && typeof this._delegate.cssStyleDeclarationSectionFocusNewInspectorRuleWithSelector === "function")
-                        this._delegate.cssStyleDeclarationSectionFocusNewInspectorRuleWithSelector(selector);
-
                     this._style.nodeStyles.addRule(selector);
                 });
             }
@@ -524,9 +512,6 @@
                 else
                     selector = this._currentSelectorText + pseudoElementSelector;
 
-                if (this._delegate && typeof this._delegate.cssStyleDeclarationSectionFocusNewInspectorRuleWithSelector === "function")
-                    this._delegate.cssStyleDeclarationSectionFocusNewInspectorRuleWithSelector(selector);
-
                 this._style.nodeStyles.addRule(selector, styleText);
             });
         }

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js (201889 => 201890)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js	2016-06-09 22:34:41 UTC (rev 201889)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js	2016-06-09 22:49:28 UTC (rev 201890)
@@ -859,7 +859,6 @@
     {
         function createSwatch(swatch, marker, valueObject, valueString)
         {
-            swatch.addEventListener(WebInspector.InlineSwatch.Event.BeforeClicked, this._inlineSwatchBeforeClicked, this);
             swatch.addEventListener(WebInspector.InlineSwatch.Event.ValueChanged, this._inlineSwatchValueChanged, this);
 
             let codeMirrorTextMarker = marker.codeMirrorTextMarker;
@@ -1291,12 +1290,6 @@
         this._codeMirror.operation(update.bind(this));
     }
 
-    _inlineSwatchBeforeClicked(event)
-    {
-        if (this._delegate && typeof this._delegate.cssStyleDeclarationTextEditorBlurActiveEditor === "function")
-            this._delegate.cssStyleDeclarationTextEditorBlurActiveEditor();
-    }
-
     _inlineSwatchValueChanged(event)
     {
         let swatch = event && event.target;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js (201889 => 201890)


--- trunk/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js	2016-06-09 22:34:41 UTC (rev 201889)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js	2016-06-09 22:49:28 UTC (rev 201890)
@@ -30,7 +30,8 @@
         super(delegate, "rules", "rules", WebInspector.UIString("Styles \u2014 Rules"));
 
         this._sections = [];
-        this._previousFocusedSection = null;
+        this._inspectorSection = null;
+        this._isInspectorSectionPendingFocus = false;
         this._ruleMediaAndInherticanceList = [];
         this._propertyToSelectAndHighlight = null;
 
@@ -144,8 +145,6 @@
         function appendStyleSection(style)
         {
             var section = style.__rulesSection;
-            if (section && section.focused && !this._previousFocusedSection)
-                this._previousFocusedSection = section;
 
             if (!section) {
                 section = new WebInspector.CSSStyleDeclarationSection(this, style);
@@ -153,10 +152,8 @@
             } else
                 section.refresh();
 
-            if (style.isInspectorRule() && this._newInspectorRuleSelector === style.selectorText && !style.hasProperties()) {
-                this._previousFocusedSection = section;
-                this._newInspectorRuleSelector = null;
-            }
+            if (this._isInspectorSectionPendingFocus && style.isInspectorRule())
+                this._inspectorSection = section;
 
             // Reset lastInGroup in case the order/grouping changed.
             section.lastInGroup = false;
@@ -317,12 +314,10 @@
             if (section !== focusedSection)
                 section.clearSelection();
         }
-        this._previousFocusedSection = focusedSection;
     }
 
     cssStyleDeclarationSectionBlurActiveEditor()
     {
-        this._previousFocusedSection = null;
     }
 
     cssStyleDeclarationSectionEditorNextRule(currentSection)
@@ -383,11 +378,6 @@
         this.element.classList.toggle("filter-non-matching", !matchFound);
     }
 
-    cssStyleDeclarationSectionFocusNewInspectorRuleWithSelector(selector)
-    {
-        this._newInspectorRuleSelector = selector;
-    }
-
     newRuleButtonClicked()
     {
         if (this.nodeStyles.node.isInShadowTree())
@@ -398,8 +388,9 @@
                 return;
         }
 
-        this._newInspectorRuleSelector = this.nodeStyles.node.appropriateSelectorFor(true);
-        this.nodeStyles.addRule(this._newInspectorRuleSelector);
+        this._isInspectorSectionPendingFocus = true;
+        let newInspectorRuleSelector = this.nodeStyles.node.appropriateSelectorFor(true);
+        this.nodeStyles.addRule(newInspectorRuleSelector);
     }
 
     sectionForStyle(style)
@@ -461,14 +452,20 @@
     nodeStylesRefreshed(event)
     {
         super.nodeStylesRefreshed(event);
-        
+
         if (this._propertyToSelectAndHighlight) {
             this.scrollToSectionAndHighlightProperty(this._propertyToSelectAndHighlight);
             this._propertyToSelectAndHighlight = null;
         }
 
-        if (this._previousFocusedSection && this._visible)
-            this._previousFocusedSection.focus();
+        if (this._isInspectorSectionPendingFocus) {
+            this._isInspectorSectionPendingFocus = false;
+
+            if (this._inspectorSection) {
+                this._inspectorSection.focus();
+                this._inspectorSection = null;
+            }
+        }
     }
 
     // Private
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to