|Summary:||Web Inspector: Sources: Scope Chain sidebar panel is stripping repeating whitespace from strings|
|Product:||WebKit||Reporter:||Patrick Angle <pangle>|
|Component:||Web Inspector||Assignee:||Patrick Angle <pangle>|
|Severity:||Normal||CC:||drousso, ews-watchlist, inspector-bugzilla-changes, pangle, webkit-bug-importer|
|Version:||WebKit Nightly Build|
Description Patrick Angle 2021-06-21 14:00:36 PDT
Created attachment 431905 [details] Screenshot of Issue See attached screenshot. Notice that on hover the `text` local variable has two spaces between `1px` and `red`, but in the Scope Chain sidebar panel, it is shown with a single space. In this case if I check the string's length in my source, it is 8 characters, which is what I would expect, but the sidebar panel is only showing seven characters.
Comment 2 Patrick Angle 2021-06-22 15:25:51 PDT
Created attachment 432002 [details] Screenshot of Issue
Comment 3 Patrick Angle 2021-06-22 15:26:05 PDT
Created attachment 432003 [details] Screenshot of Patch v1.0
Comment 5 Devin Rousso 2021-06-23 20:28:18 PDT
Comment on attachment 432001 [details] Patch v1.0 View in context: https://bugs.webkit.org/attachment.cgi?id=432001&action=review r=me > Source/WebInspectorUI/ChangeLog:11 > + which makes sure that the text does not wrap unless it contains a newline, and these previews have newlines > + replaced with a Unicode symbol to visually represent a newline without breaking to a new line. Perhaps worth adding an assertion inside `WI.FormattedValue.createLinkifiedElementString` that there are no `'\n'` then?
Comment 6 Patrick Angle 2021-06-25 09:52:34 PDT
Comment on attachment 432001 [details] Patch v1.0 View in context: https://bugs.webkit.org/attachment.cgi?id=432001&action=review >> Source/WebInspectorUI/ChangeLog:11 >> + replaced with a Unicode symbol to visually represent a newline without breaking to a new line. > > Perhaps worth adding an assertion inside `WI.FormattedValue.createLinkifiedElementString` that there are no `'\n'` then? I don't think that would be the right place to assert this. `WI.FormattedValue.createLinkifiedElementString` is only called in `ConsoleMessageView.prototype._formatParameterAsString`, which wouldn't be affected by this CSS change anyways, as object trees handle creating the tree entries using `WI.FormattedValue.createElementForTypesAndValue` (via one of the functions in FormattedValue.js:269-324). The class name is added dynamically here, which makes it not entirely clear that `.formatted-string` is used anywhere other than where you found it in `WI.FormattedValue.createLinkifiedElementString`. I don't think adding an assertion to `WI.FormattedValue.createElementForTypesAndValue` helps us since if the type is `string` newlines are explicitly removed here instead of relying on the input to be pre-formatted.