Changeset 170681 in webkit
- Timestamp:
- Jul 1, 2014, 5:13:19 PM (12 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
UserInterface/Views/CodeMirrorAdditions.js (modified) (2 diffs)
-
UserInterface/Views/SyntaxHighlightingDefaultTheme.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r170497 r170681 1 2014-07-01 Jonathan Wells <jonowells@apple.com> 2 3 Web Inspector: Hexadecimal color values in all CSS editors are purple when they should be blue 4 https://bugs.webkit.org/show_bug.cgi?id=133997 5 6 Reviewed by Joseph Pecoraro. 7 8 CodeMirror 4 removed the style for hex colors from the CSS tokenizer. 9 Feature has been added to CodeMirrorAdditions.js. 10 11 * UserInterface/Views/CodeMirrorAdditions.js: Added hex-color to style for a valid hexadecimal color. 12 * UserInterface/Views/SyntaxHighlightingDefaultTheme.css: Added selector for hexadecimal color. 13 1 14 2014-06-26 Jono Wells <jonowells@apple.com> 2 15 -
trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorAdditions.js
r168494 r170681 183 183 function extendedCSSToken(stream, state) 184 184 { 185 const hexColorRegex = /#(?:[0-9a-fA-F]{6}|[0-9a-fA-F]{3})\b/g; 186 185 187 if (state._urlTokenize) { 186 188 // Call the link tokenizer instead. … … 194 196 195 197 if (style) { 196 if (style === "atom" && stream.current() === "url") { 197 // If the current text is "url" then we should expect the next string token to be a link. 198 state._expectLink = true; 199 } else if (state._expectLink && style === "atom") { 200 // We expected a string and got it. This is a link. Parse it the way we want it. 201 delete state._expectLink; 202 203 // This is a link, so setup the state to process it next. 204 state._urlTokenize = tokenizeCSSURLString; 205 state._urlBaseStyle = style; 206 207 // The url may or may not be quoted. 208 var quote = stream.current()[0]; 209 state._urlQuoteCharacter = quote === "'" || quote === "\"" ? quote : ")"; 210 state._unquotedURLString = state._urlQuoteCharacter === ")"; 211 212 // Rewind the steam to the start of this token. 213 stream.pos = startPosition; 214 215 // Eat the open quote of the string so the string style 216 // will be used for the quote character. 217 if (!state._unquotedURLString) 218 stream.eat(state._urlQuoteCharacter); 198 if (style === "atom") { 199 if (stream.current() === "url") { 200 // If the current text is "url" then we should expect the next string token to be a link. 201 state._expectLink = true; 202 } else if (state._expectLink) { 203 // We expected a string and got it. This is a link. Parse it the way we want it. 204 delete state._expectLink; 205 206 // This is a link, so setup the state to process it next. 207 state._urlTokenize = tokenizeCSSURLString; 208 state._urlBaseStyle = style; 209 210 // The url may or may not be quoted. 211 var quote = stream.current()[0]; 212 state._urlQuoteCharacter = quote === "'" || quote === "\"" ? quote : ")"; 213 state._unquotedURLString = state._urlQuoteCharacter === ")"; 214 215 // Rewind the steam to the start of this token. 216 stream.pos = startPosition; 217 218 // Eat the open quote of the string so the string style 219 // will be used for the quote character. 220 if (!state._unquotedURLString) 221 stream.eat(state._urlQuoteCharacter); 222 } else if (hexColorRegex.test(stream.current())) 223 style = style + " hex-color"; 219 224 } else if (state._expectLink) { 220 225 // We expected a string and didn't get one. Cleanup. -
trunk/Source/WebInspectorUI/UserInterface/Views/SyntaxHighlightingDefaultTheme.css
r167779 r170681 61 61 62 62 .cm-s-default .cm-number, 63 .cm-s-default .cm-atom.cm-hex-color, 63 64 .syntax-highlighted .css-number, 64 65 .syntax-highlighted .javascript-number {
Note:
See TracChangeset
for help on using the changeset viewer.