Title: [225299] trunk/Source/WebInspectorUI
- Revision
- 225299
- Author
- nvasil...@apple.com
- Date
- 2017-11-29 15:16:20 -0800 (Wed, 29 Nov 2017)
Log Message
Web Inspector: Styles Redesign: can't add new property after property without trailing semicolon
https://bugs.webkit.org/show_bug.cgi?id=179587
<rdar://problem/35490858>
Reviewed by Timothy Hatcher.
* UserInterface/Models/CSSProperty.js:
(WI.CSSProperty.prototype._updateOwnerStyleText):
(WI.CSSProperty.prototype._appendSemicolonIfNeeded):
Add a semicolon before the new property if the last property doesn't have it already.
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (225298 => 225299)
--- trunk/Source/WebInspectorUI/ChangeLog 2017-11-29 23:16:03 UTC (rev 225298)
+++ trunk/Source/WebInspectorUI/ChangeLog 2017-11-29 23:16:20 UTC (rev 225299)
@@ -1,3 +1,16 @@
+2017-11-29 Nikita Vasilyev <nvasil...@apple.com>
+
+ Web Inspector: Styles Redesign: can't add new property after property without trailing semicolon
+ https://bugs.webkit.org/show_bug.cgi?id=179587
+ <rdar://problem/35490858>
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Models/CSSProperty.js:
+ (WI.CSSProperty.prototype._updateOwnerStyleText):
+ (WI.CSSProperty.prototype._appendSemicolonIfNeeded):
+ Add a semicolon before the new property if the last property doesn't have it already.
+
2017-11-29 Joseph Pecoraro <pecor...@apple.com>
Web Inspector: Console Tab navigation bar sometimes does not include filter bar, clear console sometimes does not work
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CSSProperty.js (225298 => 225299)
--- trunk/Source/WebInspectorUI/UserInterface/Models/CSSProperty.js 2017-11-29 23:16:03 UTC (rev 225298)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CSSProperty.js 2017-11-29 23:16:20 UTC (rev 225299)
@@ -361,7 +361,7 @@
console.assert(oldText === styleText.slice(range.startOffset, range.endOffset), "_styleSheetTextRange data is invalid.");
- let newStyleText = styleText.slice(0, range.startOffset) + newText + styleText.slice(range.endOffset);
+ let newStyleText = this._appendSemicolonIfNeeded(styleText.slice(0, range.startOffset)) + newText + styleText.slice(range.endOffset);
let lineDelta = newText.lineCount - oldText.lineCount;
let columnDelta = newText.lastLine.length - oldText.lastLine.length;
@@ -372,6 +372,14 @@
let propertyWasRemoved = !newText;
this._ownerStyle.shiftPropertiesAfter(this, lineDelta, columnDelta, propertyWasRemoved);
}
+
+ _appendSemicolonIfNeeded(styleText)
+ {
+ if (/[^;\s]\s*$/.test(styleText))
+ return styleText.trimRight() + "; ";
+
+ return styleText;
+ }
};
WI.CSSProperty.Event = {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes