RESOLVED FIXED 167949
Web Inspector: Option+hover on -webkit-transform in Styles sidebar underlines only half the property
https://bugs.webkit.org/show_bug.cgi?id=167949
Summary Web Inspector: Option+hover on -webkit-transform in Styles sidebar underlines...
Blaze Burg
Reported 2017-02-07 12:12:03 PST
Via Antoine Quint: "When you have a -wekit-transform property in the Styles sidebar and you hold down Cmd while hovering over it, the text is only partially underlined as the string is split in two tokens."
Attachments
Patch (2.28 KB, patch)
2017-02-08 14:44 PST, Devin Rousso
joepeck: review+
Patch (2.82 KB, patch)
2017-02-09 02:32 PST, Devin Rousso
no flags
Blaze Burg
Comment 1 2017-02-07 12:12:18 PST
Blaze Burg
Comment 2 2017-02-07 12:13:32 PST
Joe said in radar: "So this is because CodeMirror is splitting it up into 2 tokens, 1 vendor prefix and 1 actual property. We can make CodeMirrorTokenTrackingController smarter here, and treat both as 1 "token" for the Cmd+Hover mode."
Devin Rousso
Comment 3 2017-02-08 14:44:23 PST
Joseph Pecoraro
Comment 4 2017-02-08 16:57:45 PST
Comment on attachment 300969 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=300969&action=review > Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorTokenTrackingController.js:351 > + let preceedingTokenPosition = Object.shallowCopy(position); > + preceedingTokenPosition.ch = tokenInfo.token.start - 1; This might need to sanity check some things: What if tokenInfo.token.start was 0. Then this would set ch to -1. Would that cause a problem?
Devin Rousso
Comment 5 2017-02-08 17:09:31 PST
Comment on attachment 300969 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=300969&action=review >> Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorTokenTrackingController.js:351 >> + preceedingTokenPosition.ch = tokenInfo.token.start - 1; > > This might need to sanity check some things: What if tokenInfo.token.start was 0. Then this would set ch to -1. Would that cause a problem? So I just tried this, and it appears to work fine. I think that CodeMirror will create an "empty" token if the position is invalid. Either way, I also check that the token exists and has a type, so it should cover both cases.
Joseph Pecoraro
Comment 6 2017-02-08 22:18:17 PST
Comment on attachment 300969 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=300969&action=review r=me >>> Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorTokenTrackingController.js:351 >>> + preceedingTokenPosition.ch = tokenInfo.token.start - 1; >> >> This might need to sanity check some things: What if tokenInfo.token.start was 0. Then this would set ch to -1. Would that cause a problem? > > So I just tried this, and it appears to work fine. I think that CodeMirror will create an "empty" token if the position is invalid. Either way, I also check that the token exists and has a type, so it should cover both cases. I just want to make sure it doesn't throw an exception. I see now that CodeMirror clips positions to ensure they are in bounds (clipPos and clipToLen). > Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorTokenTrackingController.js:354 > + if (preceedingToken && preceedingToken.type && preceedingToken.type.includes("meta")) { Includes "meta" could false trigger if the type was something was something like "not-meta". But we seem to do this style elsewhere and meta is pretty unique =).
Devin Rousso
Comment 7 2017-02-09 02:32:42 PST
Created attachment 301027 [details] Patch So I just realized that I forgot to include a check for if the user highlights the meta token instead of the non-meta token. These changes now cover both.
Joseph Pecoraro
Comment 8 2017-02-09 11:05:13 PST
Comment on attachment 301027 [details] Patch Nice. r=me
WebKit Commit Bot
Comment 9 2017-02-09 11:30:38 PST
Comment on attachment 301027 [details] Patch Clearing flags on attachment: 301027 Committed r211973: <http://trac.webkit.org/changeset/211973>
WebKit Commit Bot
Comment 10 2017-02-09 11:30:43 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.