Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/CSSSourceFrame.js

Issue 2187173002: DevTools: Find bookmarks at line endpoints when calling _clearBookmarks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 /** 105 /**
106 * @param {number} startLine 106 * @param {number} startLine
107 * @param {number} endLine 107 * @param {number} endLine
108 */ 108 */
109 _updateColorSwatches: function(startLine, endLine) 109 _updateColorSwatches: function(startLine, endLine)
110 { 110 {
111 var colorPositions = []; 111 var colorPositions = [];
112 112
113 var colorRegex = /[\s:;,(){}]((?:rgb|hsl)a?\([^)]+\)|#[0-9a-f]{8}|#[0-9a -f]{6}|#[0-9a-f]{3,4}|[a-z]+)(?=[\s;,(){}])/gi; 113 var colorRegex = /[\s:;,(){}]((?:rgb|hsl)a?\([^)]+\)|#[0-9a-f]{8}|#[0-9a -f]{6}|#[0-9a-f]{3,4}|[a-z]+)(?=[\s;,(){}])/gi;
114 for (var lineNumber = startLine; lineNumber <= endLine; lineNumber++) { 114 for (var lineNumber = startLine; lineNumber <= endLine; lineNumber++) {
115 var line = this.textEditor.line(lineNumber).substring(0, WebInspecto r.CSSSourceFrame.maxSwatchProcessingLength) + "\n"; 115 var line = "\n" + this.textEditor.line(lineNumber).substring(0, WebI nspector.CSSSourceFrame.maxSwatchProcessingLength) + "\n";
116 var match; 116 var match;
117 while ((match = colorRegex.exec(line)) !== null) { 117 while ((match = colorRegex.exec(line)) !== null) {
118 if (match.length < 2) 118 if (match.length < 2)
119 continue; 119 continue;
120 var colorText = match[1]; 120 var colorText = match[1];
121 var color = WebInspector.Color.parse(colorText); 121 var color = WebInspector.Color.parse(colorText);
122 if (color) 122 if (color)
123 colorPositions.push(new WebInspector.CSSSourceFrame.ColorPos ition(color, lineNumber, match.index + 1, colorText.length)); 123 colorPositions.push(new WebInspector.CSSSourceFrame.ColorPos ition(color, lineNumber, match.index, colorText.length));
124 } 124 }
125 } 125 }
126 126
127 this.textEditor.operation(putColorSwatchesInline.bind(this)); 127 this.textEditor.operation(putColorSwatchesInline.bind(this));
128 128
129 /** 129 /**
130 * @this {WebInspector.CSSSourceFrame} 130 * @this {WebInspector.CSSSourceFrame}
131 */ 131 */
132 function putColorSwatchesInline() 132 function putColorSwatchesInline()
133 { 133 {
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 var propertyToken = this._backtrackPropertyToken(editor, prefixRange.sta rtLine, prefixRange.startColumn - 1); 355 var propertyToken = this._backtrackPropertyToken(editor, prefixRange.sta rtLine, prefixRange.startColumn - 1);
356 if (!propertyToken) 356 if (!propertyToken)
357 return this._simpleDelegate.wordsWithPrefix(editor, prefixRange, sub stituteRange); 357 return this._simpleDelegate.wordsWithPrefix(editor, prefixRange, sub stituteRange);
358 358
359 var line = editor.line(prefixRange.startLine); 359 var line = editor.line(prefixRange.startLine);
360 var tokenContent = line.substring(propertyToken.startColumn, propertyTok en.endColumn); 360 var tokenContent = line.substring(propertyToken.startColumn, propertyTok en.endColumn);
361 var keywords = WebInspector.CSSMetadata.keywordsForProperty(tokenContent ); 361 var keywords = WebInspector.CSSMetadata.keywordsForProperty(tokenContent );
362 return keywords.startsWith(prefix); 362 return keywords.startsWith(prefix);
363 }, 363 },
364 } 364 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698