RESOLVED FIXED 146676
Web Inspector: Tabbing in the styles sidebar doesn't highlight the next section of text
https://bugs.webkit.org/show_bug.cgi?id=146676
Summary Web Inspector: Tabbing in the styles sidebar doesn't highlight the next secti...
Devin Rousso
Reported 2015-07-07 00:20:16 PDT
Created attachment 256284 [details] Actual This occurs when the value of the property can be entirely found in the name of that property. For example, "border-collapse: collapse;" will highlight the "border-collapse" and then just the "collapse" because the code is trying to find the first index of the value (which is "collapse") and that happens to be inside the name. Thanks to @Nikita for the gif.
Attachments
Actual (202.17 KB, image/gif)
2015-07-07 00:20 PDT, Devin Rousso
no flags
Patch (3.27 KB, patch)
2015-07-07 00:28 PDT, Devin Rousso
no flags
Patch (3.30 KB, patch)
2015-07-07 00:43 PDT, Devin Rousso
no flags
Patch (3.27 KB, patch)
2015-07-07 10:24 PDT, Devin Rousso
no flags
Radar WebKit Bug Importer
Comment 1 2015-07-07 00:20:38 PDT
Devin Rousso
Comment 2 2015-07-07 00:28:09 PDT
Nikita Vasilyev
Comment 3 2015-07-07 00:32:52 PDT
Comment on attachment 256286 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=256286&action=review > Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js:400 > + var substringIndex = text.includes(":") && cursor.ch >= text.indexOf(":") ? text.indexOf(":") : 0; Nit: text.indexOf(":") used twice here, it should be pulled into a variable.
Devin Rousso
Comment 4 2015-07-07 00:43:56 PDT
Timothy Hatcher
Comment 5 2015-07-07 09:31:08 PDT
Comment on attachment 256288 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=256288&action=review > Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js:400 > + var colonIndex = text.indexOf(":"); What if this returns -1? > Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js:403 > + var match = /(?:[^:;\s]\s*)+/.exec(remaining); You can do this without doing a substring. If you make the regex, then set regex.lastIndex = colonIndex, it will only search after that.
Devin Rousso
Comment 6 2015-07-07 10:07:29 PDT
Comment on attachment 256288 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=256288&action=review >> Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js:400 >> + var colonIndex = text.indexOf(":"); > > What if this returns -1? On the next line, it checks if colonIndex >= 0 and if not then set the start to 0 since the entire string should be matched.
Timothy Hatcher
Comment 7 2015-07-07 10:11:16 PDT
Comment on attachment 256288 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=256288&action=review >>> Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js:400 >>> + var colonIndex = text.indexOf(":"); >> >> What if this returns -1? > > On the next line, it checks if colonIndex >= 0 and if not then set the start to 0 since the entire string should be matched. Oh, I see it now.
Devin Rousso
Comment 8 2015-07-07 10:24:30 PDT
WebKit Commit Bot
Comment 9 2015-07-07 11:29:49 PDT
Comment on attachment 256307 [details] Patch Clearing flags on attachment: 256307 Committed r186468: <http://trac.webkit.org/changeset/186468>
WebKit Commit Bot
Comment 10 2015-07-07 11:29:53 PDT
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.