Title: [185789] trunk/Source/WebInspectorUI
Revision
185789
Author
[email protected]
Date
2015-06-19 23:20:21 -0700 (Fri, 19 Jun 2015)

Log Message

Web Inspector: Duplication of style attribute in rules panel for shadow content
https://bugs.webkit.org/show_bug.cgi?id=146176

Patch by Joseph Pecoraro <[email protected]> on 2015-06-19
Reviewed by Timothy Hatcher.

* UserInterface/Views/CSSStyleDeclarationTextEditor.js:
The styleText can be non-empty for a readonly editor if the editor is for
the style attribute of a shadow dom node. Instead of assuming it is empty
we can just clear the editor ourselves and regenerate from properties.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (185788 => 185789)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-06-20 02:41:09 UTC (rev 185788)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-06-20 06:20:21 UTC (rev 185789)
@@ -1,3 +1,15 @@
+2015-06-19  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Duplication of style attribute in rules panel for shadow content
+        https://bugs.webkit.org/show_bug.cgi?id=146176
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Views/CSSStyleDeclarationTextEditor.js:
+        The styleText can be non-empty for a readonly editor if the editor is for
+        the style attribute of a shadow dom node. Instead of assuming it is empty
+        we can just clear the editor ourselves and regenerate from properties.
+
 2015-06-19  Devin Rousso  <[email protected]>
 
         Web Inspector: Highlight currently edited CSS selector

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js (185788 => 185789)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js	2015-06-20 02:41:09 UTC (rev 185788)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js	2015-06-20 06:20:21 UTC (rev 185789)
@@ -1052,19 +1052,16 @@
             var styleText = this._style.text.trim();
             var findWhitespace = /\s+/g;
 
-            // Only format non-empty styles. Keep in mind that styleText is always empty
-            // for "readOnly" Editors. But prepare Checkbox placeholders in any case.
-            // Because that will indent the cursor when the User starts typing.
+            // We only need to format non-empty styles, but prepare checkbox placeholders
+            // in any case because that will indent the cursor when the User starts typing.
             if (!styleText && !isEditorReadOnly) {
                 this._markLinesWithCheckboxPlaceholder();
                 return;
             }
 
-            // Set non-optimized, valid and invalid styles in preparation for the Formatter.
-            // Set empty string in case of readonly styles.
-            this._codeMirror.setValue(styleText);
-
+            // Generate formatted content for readonly editors by iterating properties.
             if (isEditorReadOnly) {
+                this._codeMirror.setValue("");
                 var lineNumber = 0;
                 this._iterateOverProperties(false, function(property) {
                     var from = {line: lineNumber, ch: 0};
@@ -1074,10 +1071,12 @@
                     this._createTextMarkerForPropertyIfNeeded(from, to, property);
                     lineNumber++;
                 });
-
                 return;
             }
 
+            // Set non-optimized, valid and invalid styles in preparation for the Formatter.
+            this._codeMirror.setValue(styleText);
+
             // Now the Formatter pretty prints the styles.
             this._codeMirror.setValue(this._formattedContentFromEditor());
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to