Title: [140320] trunk
Revision
140320
Author
[email protected]
Date
2013-01-21 03:54:00 -0800 (Mon, 21 Jan 2013)

Log Message

Web Inspector: fix highlight bug in DTE.
https://bugs.webkit.org/show_bug.cgi?id=107433

Patch by Andrey Lushnikov <[email protected]> on 2013-01-21
Reviewed by Pavel Feldman.

Source/WebCore:

Do not re-create |state.ranges| array when it already contains highlight.

Test: inpector/editor/highlighter-chunk-limit.txt

* inspector/front-end/TextEditorHighlighter.js:
(WebInspector.TextEditorHighlighter.prototype._highlightLines):

LayoutTests:

Add a layout test to cover highlight bug specific situation.

* inspector/editor/highlighter-chunk-limit-expected.txt: Added.
* inspector/editor/highlighter-chunk-limit.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (140319 => 140320)


--- trunk/LayoutTests/ChangeLog	2013-01-21 11:33:54 UTC (rev 140319)
+++ trunk/LayoutTests/ChangeLog	2013-01-21 11:54:00 UTC (rev 140320)
@@ -1,3 +1,15 @@
+2013-01-21  Andrey Lushnikov  <[email protected]>
+
+        Web Inspector: fix highlight bug in DTE.
+        https://bugs.webkit.org/show_bug.cgi?id=107433
+
+        Reviewed by Pavel Feldman.
+
+        Add a layout test to cover highlight bug specific situation.
+
+        * inspector/editor/highlighter-chunk-limit-expected.txt: Added.
+        * inspector/editor/highlighter-chunk-limit.html: Added.
+
 2013-01-21  Ádám Kallai  <[email protected]>
 
         [Qt] Unreviewed gardening. Skip some failing.

Added: trunk/LayoutTests/inspector/editor/highlighter-chunk-limit-expected.txt (0 => 140320)


--- trunk/LayoutTests/inspector/editor/highlighter-chunk-limit-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/editor/highlighter-chunk-limit-expected.txt	2013-01-21 11:54:00 UTC (rev 140320)
@@ -0,0 +1,15 @@
+This test checks highlighting with specific highlightChunkLimit.
+
+Highlighter results
+1 : this.field = this.field = "foo"; /* comment here */ this.otherField = 12; // end of line : _javascript_-keyword[0-4] _javascript_-ident[5-10] _javascript_-keyword[13-17] _javascript_-ident[18-23] _javascript_-string[26-31] _javascript_-comment[33-51] _javascript_-keyword[52-56] _javascript_-ident[57-67] _javascript_-number[70-72] _javascript_-comment[74-88]
+2 : this.field = this.field = "foo"; /* comment here */ this.otherField = 12; // end of line : _javascript_-keyword[0-4] _javascript_-ident[5-10] _javascript_-keyword[13-17] _javascript_-ident[18-23] _javascript_-string[26-31] _javascript_-comment[33-51] _javascript_-keyword[52-56] _javascript_-ident[57-67] _javascript_-number[70-72] _javascript_-comment[74-88]
+3 : this.field = this.field = "foo"; /* comment here */ this.otherField = 12; // end of line : _javascript_-keyword[0-4] _javascript_-ident[5-10] _javascript_-keyword[13-17] _javascript_-ident[18-23] _javascript_-string[26-31] _javascript_-comment[33-51] _javascript_-keyword[52-56] _javascript_-ident[57-67] _javascript_-number[70-72] _javascript_-comment[74-88]
+4 : this.field = this.field = "foo"; /* comment here */ this.otherField = 12; // end of line : _javascript_-keyword[0-4] _javascript_-ident[5-10] _javascript_-keyword[13-17] _javascript_-ident[18-23] _javascript_-string[26-31] _javascript_-comment[33-51] _javascript_-keyword[52-56] _javascript_-ident[57-67] _javascript_-number[70-72] _javascript_-comment[74-88]
+5 : this.field = this.field = "foo"; /* comment here */ this.otherField = 12; // end of line : _javascript_-keyword[0-4] _javascript_-ident[5-10] _javascript_-keyword[13-17] _javascript_-ident[18-23] _javascript_-string[26-31] _javascript_-comment[33-51] _javascript_-keyword[52-56] _javascript_-ident[57-67] _javascript_-number[70-72] _javascript_-comment[74-88]
+6 : this.field = this.field = "foo"; /* comment here */ this.otherField = 12; // end of line : _javascript_-keyword[0-4] _javascript_-ident[5-10] _javascript_-keyword[13-17] _javascript_-ident[18-23] _javascript_-string[26-31] _javascript_-comment[33-51] _javascript_-keyword[52-56] _javascript_-ident[57-67] _javascript_-number[70-72] _javascript_-comment[74-88]
+7 : this.field = this.field = "foo"; /* comment here */ this.otherField = 12; // end of line : _javascript_-keyword[0-4] _javascript_-ident[5-10] _javascript_-keyword[13-17] _javascript_-ident[18-23] _javascript_-string[26-31] _javascript_-comment[33-51] _javascript_-keyword[52-56] _javascript_-ident[57-67] _javascript_-number[70-72] _javascript_-comment[74-88]
+8 : this.field = this.field = "foo"; /* comment here */ this.otherField = 12; // end of line : _javascript_-keyword[0-4] _javascript_-ident[5-10] _javascript_-keyword[13-17] _javascript_-ident[18-23] _javascript_-string[26-31] _javascript_-comment[33-51] _javascript_-keyword[52-56] _javascript_-ident[57-67] _javascript_-number[70-72] _javascript_-comment[74-88]
+9 : this.field = this.field = "foo"; /* comment here */ this.otherField = 12; // end of line : _javascript_-keyword[0-4] _javascript_-ident[5-10] _javascript_-keyword[13-17] _javascript_-ident[18-23] _javascript_-string[26-31] _javascript_-comment[33-51] _javascript_-keyword[52-56] _javascript_-ident[57-67] _javascript_-number[70-72] _javascript_-comment[74-88]
+10 : this.field = this.field = "foo"; /* comment here */ this.otherField = 12; // end of line : _javascript_-keyword[0-4] _javascript_-ident[5-10] _javascript_-keyword[13-17] _javascript_-ident[18-23] _javascript_-string[26-31] _javascript_-comment[33-51] _javascript_-keyword[52-56] _javascript_-ident[57-67] _javascript_-number[70-72] _javascript_-comment[74-88]
+11 :  :
+

Added: trunk/LayoutTests/inspector/editor/highlighter-chunk-limit.html (0 => 140320)


--- trunk/LayoutTests/inspector/editor/highlighter-chunk-limit.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/editor/highlighter-chunk-limit.html	2013-01-21 11:54:00 UTC (rev 140320)
@@ -0,0 +1,42 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+
+function test()
+{
+
+    var singleLine = "this.field = this.field = \"foo\"; /* comment here */ this.otherField = 12; // end of line\n";
+    src = ""
+    for (var i = 0; i < 10; ++i)
+        src += singleLine;
+
+    var textModel = new WebInspector.TextEditorModel();
+    textModel.setText(src);
+
+    function damageCallback(startLine, endLine)
+    {
+        if (endLine === textModel.linesCount) {
+            InspectorTest.addResult("Highlighter results");
+            InspectorTest.dumpTextModel(textModel);
+            InspectorTest.completeTest();
+        }
+    }
+
+    var highlighter = new WebInspector.TextEditorHighlighter(textModel, damageCallback);
+    highlighter.mimeType = "text/_javascript_";
+    highlighter.highlightChunkLimit = 3;
+    highlighter.highlight(textModel.linesCount);
+}
+
+</script>
+</head>
+
+<body _onload_="runTest()">
+<p>
+This test checks highlighting with specific highlightChunkLimit.
+</p>
+
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (140319 => 140320)


--- trunk/Source/WebCore/ChangeLog	2013-01-21 11:33:54 UTC (rev 140319)
+++ trunk/Source/WebCore/ChangeLog	2013-01-21 11:54:00 UTC (rev 140320)
@@ -1,3 +1,17 @@
+2013-01-21  Andrey Lushnikov  <[email protected]>
+
+        Web Inspector: fix highlight bug in DTE.
+        https://bugs.webkit.org/show_bug.cgi?id=107433
+
+        Reviewed by Pavel Feldman.
+
+        Do not re-create |state.ranges| array when it already contains highlight.
+
+        Test: inpector/editor/highlighter-chunk-limit.txt
+
+        * inspector/front-end/TextEditorHighlighter.js:
+        (WebInspector.TextEditorHighlighter.prototype._highlightLines):
+
 2013-01-21  Takashi Sakamoto  <[email protected]>
 
         [Refactoring] rename StyleRuleBlock -> StyleRuleGroup

Modified: trunk/Source/WebCore/inspector/front-end/TextEditorHighlighter.js (140319 => 140320)


--- trunk/Source/WebCore/inspector/front-end/TextEditorHighlighter.js	2013-01-21 11:33:54 UTC (rev 140319)
+++ trunk/Source/WebCore/inspector/front-end/TextEditorHighlighter.js	2013-01-21 11:54:00 UTC (rev 140320)
@@ -192,7 +192,7 @@
                 this._tokenizer.condition = JSON.parse(postConditionStringified);
 
                 // Highlight line.
-                state.ranges = [];
+                state.ranges = state.ranges || [];
                 do {
                     var newColumn = this._tokenizer.nextToken(lastHighlightedColumn);
                     var tokenType = this._tokenizer.tokenType;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to