Summary: Execution highlighting in the frontend should be line/column-based. The call frame location payload uses line/column, but to simplify range calculations in the frontend, TextEditor converts these to character offsets when highlighting source code locations. The frontend should never use raw offsets into source code, since the values will depend on the particular line endings used. This patch is a step toward allowing CodeMirror to auto-detect line endings again, instead of forcing Unix-style (\n) line endings. Specifying a line ending other than that of the original file causes problems when inspecting certain resources (see https://webkit.org/b/186453).
<rdar://problem/42035580>
Created attachment 344716 [details] Patch
Again I have a very bad feeling about this. Changing line endings affects many things, offsets was supposed to be an easy solution avoiding line endings. Is this fixing a recent regression? If so, what caused it?
I think we should land https://webkit.org/b/187612 first. It is a simpler change, and duplicates some of the changes here, allowing this patch to be smaller.
It looks like expression highlighting in inline scripts is currently broken in Safari, even in files with Unix-style line endings. For example, // test.js var o = { get x() { debugger; return 1; } }; var x = o.x; // test.html <html> <head> <script> var o = { get x() { debugger; return 1; } }; var x = o.x; </script> <script src="test.js"></script> </head> </html> Steps to Reproduce: 1. Inspect the test page 2. Reload the page 3. Debugger breaks at test.html:6 4. Select the call frame's parent Expected: > var x = |o.x|; Actual: > var x |= o|.x; When breaking at the second debugger statement (in the separate script file) the parent call frame's selection appears correctly.
Created attachment 344948 [details] Patch
Created attachment 344950 [details] Patch
(In reply to Matt Baker from comment #7) > Created attachment 344950 [details] > Patch This also addresses the long standing bug with expression highlighting in inline scripts: https://bugs.webkit.org/show_bug.cgi?id=187532#c5.
Comment on attachment 344950 [details] Patch r=me Nice! I think using SourcePosition everywhere is cleaning things up a bit!
Comment on attachment 344950 [details] Patch Clearing flags on attachment: 344950 Committed r233817: <https://trac.webkit.org/changeset/233817>
All reviewed patches have been landed. Closing bug.