Title: [229787] trunk/Source/WebInspectorUI
Revision
229787
Author
nvasil...@apple.com
Date
2018-03-20 21:47:45 -0700 (Tue, 20 Mar 2018)

Log Message

Web Inspector: Styles: Loses focus when editing a property while page is being loaded
https://bugs.webkit.org/show_bug.cgi?id=182619
<rdar://problem/37363185>

Reviewed by Matt Baker.

Adding or removing a stylesheet causes SpreadsheetRulesStyleDetailsPanel to refresh, triggering a layout
of all SpreadsheetCSSStyleDeclarationSection child views. This resets the focus, selection, and
auto-completion state.

This patch prevents SpreadsheetCSSStyleDeclarationSection from performing a layout when a property is being edited.

* UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js:
(WI.SpreadsheetCSSStyleDeclarationEditor.prototype.layout):
Allow re-layout after creating a blank CSS property and pasting CSS code.
- _pendingAddBlankPropertyIndexOffset is a number after pasting CSS rules.
- _propertyPendingStartEditing is a property model after creating a new property.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (229786 => 229787)


--- trunk/Source/WebInspectorUI/ChangeLog	2018-03-21 04:42:32 UTC (rev 229786)
+++ trunk/Source/WebInspectorUI/ChangeLog	2018-03-21 04:47:45 UTC (rev 229787)
@@ -1,3 +1,23 @@
+2018-03-20  Nikita Vasilyev  <nvasil...@apple.com>
+
+        Web Inspector: Styles: Loses focus when editing a property while page is being loaded
+        https://bugs.webkit.org/show_bug.cgi?id=182619
+        <rdar://problem/37363185>
+
+        Reviewed by Matt Baker.
+
+        Adding or removing a stylesheet causes SpreadsheetRulesStyleDetailsPanel to refresh, triggering a layout
+        of all SpreadsheetCSSStyleDeclarationSection child views. This resets the focus, selection, and
+        auto-completion state.
+
+        This patch prevents SpreadsheetCSSStyleDeclarationSection from performing a layout when a property is being edited.
+
+        * UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js:
+        (WI.SpreadsheetCSSStyleDeclarationEditor.prototype.layout):
+        Allow re-layout after creating a blank CSS property and pasting CSS code.
+        - _pendingAddBlankPropertyIndexOffset is a number after pasting CSS rules.
+        - _propertyPendingStartEditing is a property model after creating a new property.
+
 2018-03-20  Devin Rousso  <web...@devinrousso.com>
 
         Web Inspector: Session dividers are not added when Console tab is not visible

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js (229786 => 229787)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js	2018-03-21 04:42:32 UTC (rev 229786)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js	2018-03-21 04:47:45 UTC (rev 229787)
@@ -62,6 +62,11 @@
 
     layout()
     {
+        // Prevent layout of properties when one of them is being edited. A full layout resets
+        // the focus, text selection, and completion state <http://webkit.org/b/182619>.
+        if (this.editing && !this._propertyPendingStartEditing && isNaN(this._pendingAddBlankPropertyIndexOffset))
+            return;
+
         super.layout();
 
         this.element.removeChildren();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to