Title: [210110] trunk/Source/WebInspectorUI
Revision
210110
Author
[email protected]
Date
2016-12-22 13:56:50 -0800 (Thu, 22 Dec 2016)

Log Message

Web Inspector: Styles sidebar: Uncommenting CSS rules of pseudo-elements doesn't work
https://bugs.webkit.org/show_bug.cgi?id=165831
<rdar://problem/29652688>

Reviewed by Matt Baker.

* UserInterface/Views/CSSStyleDeclarationTextEditor.js:
(WebInspector.CSSStyleDeclarationTextEditor.prototype.uncommentAllProperties):
Call _resetContent() when toggling all properties to ensure properties have text markers.

(WebInspector.CSSStyleDeclarationTextEditor.prototype._propertyCommentCheckboxChanged):
(WebInspector.CSSStyleDeclarationTextEditor.prototype._uncommentProperty): Added.
This method is the opposite of _commentProperty. Introduce it to minimize code duplication.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (210109 => 210110)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-12-22 21:10:26 UTC (rev 210109)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-12-22 21:56:50 UTC (rev 210110)
@@ -1,3 +1,19 @@
+2016-12-22  Nikita Vasilyev  <[email protected]>
+
+        Web Inspector: Styles sidebar: Uncommenting CSS rules of pseudo-elements doesn't work
+        https://bugs.webkit.org/show_bug.cgi?id=165831
+        <rdar://problem/29652688>
+
+        Reviewed by Matt Baker.
+
+        * UserInterface/Views/CSSStyleDeclarationTextEditor.js:
+        (WebInspector.CSSStyleDeclarationTextEditor.prototype.uncommentAllProperties):
+        Call _resetContent() when toggling all properties to ensure properties have text markers.
+
+        (WebInspector.CSSStyleDeclarationTextEditor.prototype._propertyCommentCheckboxChanged):
+        (WebInspector.CSSStyleDeclarationTextEditor.prototype._uncommentProperty): Added.
+        This method is the opposite of _commentProperty. Introduce it to minimize code duplication.
+
 2016-12-21  Nikita Vasilyev  <[email protected]>
 
         Web Inspector: Uncommenting CSS properties doesn't work for inline styles

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js (210109 => 210110)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js	2016-12-22 21:10:26 UTC (rev 210109)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js	2016-12-22 21:56:50 UTC (rev 210110)
@@ -309,13 +309,11 @@
             if (!properties.length)
                 return false;
 
-            for (var property of properties) {
-                if (property._commentRange) {
-                    this._uncommentRange(property._commentRange);
-                    property._commentRange = null;
-                }
-            }
+            this._resetContent();
 
+            for (let property of properties)
+                this._uncommentProperty(property);
+
             return true;
         }
 
@@ -1272,9 +1270,6 @@
         if (!range)
             return;
 
-        property._commentRange = range;
-        property._commentRange.to.ch += 6; // Number of characters added by comments.
-
         var text = this._codeMirror.getRange(range.from, range.to);
 
         function update()
@@ -1291,14 +1286,19 @@
 
     _propertyCommentCheckboxChanged(event)
     {
-        var commentTextMarker = event.target.__commentTextMarker;
-        console.assert(commentTextMarker);
-        if (!commentTextMarker)
+        this._uncommentProperty(event.target);
+    }
+
+    _uncommentProperty(property)
+    {
+        let textMarker = property.__propertyTextMarker;
+        console.assert(textMarker);
+        if (!textMarker)
             return;
 
-        // Check if the comment has been removed already, like from double-clicking
-        // the checkbox and calling event listener multiple times.
-        var range = commentTextMarker.find();
+        // Check if the property has been removed already, like from double-clicking
+        // the checkbox and calling this event listener multiple times.
+        let range = textMarker.find();
         if (!range)
             return;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to