Title: [141689] trunk
Revision
141689
Author
commit-qu...@webkit.org
Date
2013-02-02 03:58:26 -0800 (Sat, 02 Feb 2013)

Log Message

Web Inspector: fix bug in highlighting single chars via highlightRange API of DTE
https://bugs.webkit.org/show_bug.cgi?id=108685

Patch by Andrey Lushnikov <lushni...@chromium.org> on 2013-02-02
Reviewed by Pavel Feldman.

Source/WebCore:

Use Math.min instead of Math.max in rangesForLine method.

Updated test: text-editor-highlight-api.html

* inspector/front-end/DefaultTextEditor.js:
(WebInspector.TextEditorMainPanel.RangeHighlightDescriptor.prototype.rangesForLine):

LayoutTests:

Updated layout test to cover specific bug case.

* inspector/editor/text-editor-highlight-api-expected.txt:
* inspector/editor/text-editor-highlight-api.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (141688 => 141689)


--- trunk/LayoutTests/ChangeLog	2013-02-02 09:43:30 UTC (rev 141688)
+++ trunk/LayoutTests/ChangeLog	2013-02-02 11:58:26 UTC (rev 141689)
@@ -1,3 +1,15 @@
+2013-02-02  Andrey Lushnikov  <lushni...@chromium.org>
+
+        Web Inspector: fix bug in highlighting single chars via highlightRange API of DTE
+        https://bugs.webkit.org/show_bug.cgi?id=108685
+
+        Reviewed by Pavel Feldman.
+
+        Updated layout test to cover specific bug case.
+
+        * inspector/editor/text-editor-highlight-api-expected.txt:
+        * inspector/editor/text-editor-highlight-api.html:
+
 2013-02-02  Zan Dobersek  <zdober...@igalia.com>
 
         Unreviewed GTK gardening.

Modified: trunk/LayoutTests/inspector/editor/text-editor-highlight-api-expected.txt (141688 => 141689)


--- trunk/LayoutTests/inspector/editor/text-editor-highlight-api-expected.txt	2013-02-02 09:43:30 UTC (rev 141688)
+++ trunk/LayoutTests/inspector/editor/text-editor-highlight-api-expected.txt	2013-02-02 11:58:26 UTC (rev 141689)
@@ -63,3 +63,16 @@
 <div class="webkit-line-content">global_foo2</div>
 <div class="webkit-line-content">some_other_foo_X</div></div>
 
+Running: testHighlightSmallRange
+
+Highlighting range from (1, 1) to (1, 1)
+Lines repainted: 1
+
+<div class="inner-container" tabindex="0">
+<div class="webkit-line-content">foo();</div>
+<div class="webkit-line-content">foo_1; foor; foo_;<span class="some-other-class text-editor-overlay-highlight" style="left: 7px; width: 7px; height: <number>px;"></span></div>
+<div class="webkit-line-content">foo_</div>
+<div class="webkit-line-content">global_foo</div>
+<div class="webkit-line-content">global_foo2</div>
+<div class="webkit-line-content">some_other_foo_X</div></div>
+

Modified: trunk/LayoutTests/inspector/editor/text-editor-highlight-api.html (141688 => 141689)


--- trunk/LayoutTests/inspector/editor/text-editor-highlight-api.html	2013-02-02 09:43:30 UTC (rev 141688)
+++ trunk/LayoutTests/inspector/editor/text-editor-highlight-api.html	2013-02-02 11:58:26 UTC (rev 141689)
@@ -67,6 +67,17 @@
             InspectorTest.dumpEditorHTML(textEditor, true);
             next();
         },
+
+        function testHighlightSmallRange(next)
+        {
+            InspectorTest.addResult("\nHighlighting range from (1, 1) to (1, 1)");
+            paintLineCalls = 0;
+            var smallRangeHighlightDescriptor = textEditor.highlightRange(new WebInspector.TextRange(1, 1, 1, 1), "some-other-class");
+            InspectorTest.addResult("Lines repainted: " + paintLineCalls);
+            InspectorTest.dumpEditorHTML(textEditor, true);
+            next();
+        },
+
     ]);
 }
 

Modified: trunk/Source/WebCore/ChangeLog (141688 => 141689)


--- trunk/Source/WebCore/ChangeLog	2013-02-02 09:43:30 UTC (rev 141688)
+++ trunk/Source/WebCore/ChangeLog	2013-02-02 11:58:26 UTC (rev 141689)
@@ -1,3 +1,17 @@
+2013-02-02  Andrey Lushnikov  <lushni...@chromium.org>
+
+        Web Inspector: fix bug in highlighting single chars via highlightRange API of DTE
+        https://bugs.webkit.org/show_bug.cgi?id=108685
+
+        Reviewed by Pavel Feldman.
+
+        Use Math.min instead of Math.max in rangesForLine method.
+
+        Updated test: text-editor-highlight-api.html
+
+        * inspector/front-end/DefaultTextEditor.js:
+        (WebInspector.TextEditorMainPanel.RangeHighlightDescriptor.prototype.rangesForLine):
+
 2013-02-02  Tony Gentilcore  <to...@chromium.org>
 
         Continue making XSSAuditor thread safe: Remove unsafe AtomicString compares

Modified: trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js (141688 => 141689)


--- trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js	2013-02-02 09:43:30 UTC (rev 141688)
+++ trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js	2013-02-02 11:58:26 UTC (rev 141689)
@@ -2825,7 +2825,7 @@
             return [];
 
         var startColumn = lineNumber === this._range.startLine ? this._range.startColumn : 0;
-        var endColumn = lineNumber === this._range.endLine ? Math.max(this._range.endColumn, line.length) : line.length;
+        var endColumn = lineNumber === this._range.endLine ? Math.min(this._range.endColumn, line.length) : line.length;
         return [{
             startColumn: startColumn,
             endColumn: endColumn
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to