RESOLVED FIXED 227234
Web Inspector: Sources: Scope Chain sidebar panel is stripping repeating whitespace from strings
https://bugs.webkit.org/show_bug.cgi?id=227234
Summary Web Inspector: Sources: Scope Chain sidebar panel is stripping repeating whit...
Patrick Angle
Reported 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.
Attachments
Screenshot of Issue (765.55 KB, image/png)
2021-06-21 14:00 PDT, Patrick Angle
no flags
Patch v1.0 (1.84 KB, patch)
2021-06-22 15:25 PDT, Patrick Angle
no flags
Screenshot of Issue (529.31 KB, image/png)
2021-06-22 15:25 PDT, Patrick Angle
no flags
Screenshot of Patch v1.0 (529.34 KB, image/png)
2021-06-22 15:26 PDT, Patrick Angle
no flags
Patrick Angle
Comment 1 2021-06-22 15:25:31 PDT
Created attachment 432001 [details] Patch v1.0
Patrick Angle
Comment 2 2021-06-22 15:25:51 PDT
Created attachment 432002 [details] Screenshot of Issue
Patrick Angle
Comment 3 2021-06-22 15:26:05 PDT
Created attachment 432003 [details] Screenshot of Patch v1.0
Radar WebKit Bug Importer
Comment 4 2021-06-22 16:01:37 PDT
Devin Rousso
Comment 5 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?
Patrick Angle
Comment 6 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.
EWS
Comment 7 2021-06-25 11:50:24 PDT
Committed r279294 (239170@main): <https://commits.webkit.org/239170@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 432001 [details].
Note You need to log in before you can comment on or make changes to this bug.