Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/sources/CSSSourceFrame.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/sources/CSSSourceFrame.js b/third_party/WebKit/Source/devtools/front_end/sources/CSSSourceFrame.js |
| index 66322da1b841a29893cb01938aa0948f89d46763..7ff7b63fb3ecd63e309f0067ff678ff9f2110f85 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/sources/CSSSourceFrame.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/sources/CSSSourceFrame.js |
| @@ -112,7 +112,7 @@ WebInspector.CSSSourceFrame.prototype = { |
| var colorRegex = /[\s:;,(){}]((?:rgb|hsl)a?\([^)]+\)|#[0-9a-f]{8}|#[0-9a-f]{6}|#[0-9a-f]{3,4}|[a-z]+)(?=[\s;,(){}])/gi; |
| for (var lineNumber = startLine; lineNumber <= endLine; lineNumber++) { |
| - var line = this.textEditor.line(lineNumber).substring(0, WebInspector.CSSSourceFrame.maxSwatchProcessingLength) + "\n"; |
| + var line = "\n" + this.textEditor.line(lineNumber).substring(0, WebInspector.CSSSourceFrame.maxSwatchProcessingLength) + "\n"; |
| var match; |
| while ((match = colorRegex.exec(line)) !== null) { |
| if (match.length < 2) |
| @@ -120,7 +120,7 @@ WebInspector.CSSSourceFrame.prototype = { |
| var colorText = match[1]; |
| var color = WebInspector.Color.parse(colorText); |
| if (color) |
| - colorPositions.push(new WebInspector.CSSSourceFrame.ColorPosition(color, lineNumber, match.index + 1, colorText.length)); |
| + colorPositions.push(new WebInspector.CSSSourceFrame.ColorPosition(color, lineNumber, match.index, colorText.length)); |
| } |
| } |
| @@ -151,10 +151,21 @@ WebInspector.CSSSourceFrame.prototype = { |
| */ |
| _clearBookmarks: function(startLine, endLine) |
| { |
| - var range = new WebInspector.TextRange(startLine, 0, endLine, this.textEditor.line(endLine).length); |
| - var markers = this.textEditor.bookmarks(range); |
| - for (var i = 0; i < markers.length; i++) |
| - markers[i].clear(); |
| + var startPos = new CodeMirror.Pos(startLine, 0); |
|
lushnikov
2016/07/27 23:32:02
we shouldn't be using CodeMirror.Pos outside of Co
flandy
2016/07/29 17:25:51
Done.
|
| + var endPos = new CodeMirror.Pos(endLine, this.textEditor.line(endLine).length) |
| + var range = WebInspector.CodeMirrorUtils.toRange(startPos, endPos); |
| + |
| + var startMarkers = this.textEditor.bookmarksAt(startPos); |
| + for (var i = 0; i < startMarkers.length; i++) |
| + startMarkers[i].clear(); |
| + |
| + var endMarkers = this.textEditor.bookmarksAt(endPos) |
| + for (var i = 0; i < endMarkers.length; i++) |
| + endMarkers[i].clear(); |
| + |
| + var innerMarkers = this.textEditor.bookmarks(range); |
| + for (var i = 0; i < innerMarkers.length; i++) |
| + innerMarkers[i].clear(); |
| }, |
| /** |