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

Unified 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: Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
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();
},
/**

Powered by Google App Engine
This is Rietveld 408576698