Title: [141401] trunk
- Revision
- 141401
- Author
- [email protected]
- Date
- 2013-01-31 04:04:09 -0800 (Thu, 31 Jan 2013)
Log Message
Web Inspector: DTE doesn't highlight words if the selected one is the last in the line
https://bugs.webkit.org/show_bug.cgi?id=108344
Patch by Andrey Lushnikov <[email protected]> on 2013-01-31
Reviewed by Pavel Feldman.
Source/WebCore:
Fix error in _isWord function which made an erroneous line-end check.
Improved test: inspector/editor/text-editor-highlight-token.html
* inspector/front-end/DefaultTextEditor.js:
(WebInspector.TextEditorMainPanel.TokenHighlighter.prototype._isWord):
LayoutTests:
Add a test to cover specific case which caused the bug.
* inspector/editor/text-editor-highlight-token-expected.txt:
* inspector/editor/text-editor-highlight-token.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (141400 => 141401)
--- trunk/LayoutTests/ChangeLog 2013-01-31 12:01:16 UTC (rev 141400)
+++ trunk/LayoutTests/ChangeLog 2013-01-31 12:04:09 UTC (rev 141401)
@@ -1,5 +1,17 @@
2013-01-31 Andrey Lushnikov <[email protected]>
+ Web Inspector: DTE doesn't highlight words if the selected one is the last in the line
+ https://bugs.webkit.org/show_bug.cgi?id=108344
+
+ Reviewed by Pavel Feldman.
+
+ Add a test to cover specific case which caused the bug.
+
+ * inspector/editor/text-editor-highlight-token-expected.txt:
+ * inspector/editor/text-editor-highlight-token.html:
+
+2013-01-31 Andrey Lushnikov <[email protected]>
+
Web Inspector: text-editor-ctrl-movements.html timeouts on mac
https://bugs.webkit.org/show_bug.cgi?id=108440
Modified: trunk/LayoutTests/inspector/editor/text-editor-highlight-token-expected.txt (141400 => 141401)
--- trunk/LayoutTests/inspector/editor/text-editor-highlight-token-expected.txt 2013-01-31 12:01:16 UTC (rev 141400)
+++ trunk/LayoutTests/inspector/editor/text-editor-highlight-token-expected.txt 2013-01-31 12:04:09 UTC (rev 141401)
@@ -2,6 +2,7 @@
=========== TextEditor text ==========
function findElement(collection, elem) {
+ // length
for(var i = 0; i < collection.length; ++i)
if (collection[i] === elem)
return i;
@@ -11,6 +12,7 @@
<div class="inner-container text-editor-editable" tabindex="0">
<div class="webkit-line-content">function findElement(collection, elem) {</div>
+<div class="webkit-line-content"> // length</div>
<div class="webkit-line-content"> for(var i = 0; i <span class="webkit-html-tag"><</span> <span class="webkit-html-tag">collection.length;</span> <span class="webkit-html-attribute-name">++i)</span></div>
<div class="webkit-line-content"> <span class="webkit-html-attribute-name">if</span> <span class="webkit-html-attribute-name">(collection</span>[<span class="webkit-html-attribute-name">i</span>] === <span class="webkit-html-attribute-value">elem)</span></div>
<div class="webkit-line-content"> <span class="webkit-html-attribute-value">return</span> <span class="webkit-html-attribute-value">i;</span></div>
@@ -20,6 +22,7 @@
<div class="inner-container text-editor-editable" tabindex="0">
<div class="webkit-line-content">function findElement(collection, elem) {<span class="text-editor-token-highlight text-editor-overlay-highlight" style="left: 146px; width: 72px;"> </span></div>
+<div class="webkit-line-content"> // length</div>
<div class="webkit-line-content"> for(var i = 0; i <span class="webkit-html-tag"><</span> <span class="webkit-html-tag">collection.length;</span> <span class="webkit-html-attribute-name">++i)</span><span class="text-editor-token-highlight text-editor-overlay-highlight" style="left: 188px; width: 72px;"> </span></div>
<div class="webkit-line-content"> <span class="webkit-html-attribute-name">if</span> <span class="webkit-html-attribute-name">(collection</span>[<span class="webkit-html-attribute-name">i</span>] === <span class="webkit-html-attribute-value">elem)</span><span class="text-editor-token-highlight text-editor-overlay-highlight" style="left: 111px; width: 72px;"> </span></div>
<div class="webkit-line-content"> <span class="webkit-html-attribute-value">return</span> <span class="webkit-html-attribute-value">i;</span></div>
@@ -29,9 +32,20 @@
<div class="inner-container text-editor-editable" tabindex="0">
<div class="webkit-line-content">function findElement(collection, elem) {<span class="text-editor-token-highlight text-editor-overlay-highlight" style="left: 230px; width: 30px;"> </span></div>
+<div class="webkit-line-content"> // length</div>
<div class="webkit-line-content"> for(var i = 0; i <span class="webkit-html-tag"><</span> <span class="webkit-html-tag">collection.length;</span> <span class="webkit-html-attribute-name">++i)</span></div>
<div class="webkit-line-content"> <span class="webkit-html-attribute-name">if</span> <span class="webkit-html-attribute-name">(collection</span>[<span class="webkit-html-attribute-name">i</span>] === <span class="webkit-html-attribute-value">elem)</span><span class="text-editor-token-highlight text-editor-overlay-highlight" style="left: 237px; width: 30px;"> </span></div>
<div class="webkit-line-content"> <span class="webkit-html-attribute-value">return</span> <span class="webkit-html-attribute-value">i;</span></div>
<div class="webkit-line-content"> <span class="webkit-html-attribute-value">return</span> <span class="webkit-html-attribute-value">null;</span></div>
<div class="webkit-line-content"> <span class="webkit-html-attribute-value">}</span></div></div>
+=========== After selecting 'length' ===========
+<div class="inner-container text-editor-editable" tabindex="0">
+<div class="webkit-line-content">function findElement(collection, elem) {</div>
+<div class="webkit-line-content"> // length<span class="text-editor-token-highlight text-editor-overlay-highlight" style="left: 76px; width: 44px;"> </span></div>
+<div class="webkit-line-content"> for(var i = 0; i <span class="webkit-html-tag"><</span> <span class="webkit-html-tag">collection.length;</span> <span class="webkit-html-attribute-name">++i)</span><span class="text-editor-token-highlight text-editor-overlay-highlight" style="left: 265px; width: 44px;"> </span></div>
+<div class="webkit-line-content"> <span class="webkit-html-attribute-name">if</span> <span class="webkit-html-attribute-name">(collection</span>[<span class="webkit-html-attribute-name">i</span>] === <span class="webkit-html-attribute-value">elem)</span></div>
+<div class="webkit-line-content"> <span class="webkit-html-attribute-value">return</span> <span class="webkit-html-attribute-value">i;</span></div>
+<div class="webkit-line-content"> <span class="webkit-html-attribute-value">return</span> <span class="webkit-html-attribute-value">null;</span></div>
+<div class="webkit-line-content"> <span class="webkit-html-attribute-value">}</span></div></div>
+
Modified: trunk/LayoutTests/inspector/editor/text-editor-highlight-token.html (141400 => 141401)
--- trunk/LayoutTests/inspector/editor/text-editor-highlight-token.html 2013-01-31 12:01:16 UTC (rev 141400)
+++ trunk/LayoutTests/inspector/editor/text-editor-highlight-token.html 2013-01-31 12:04:09 UTC (rev 141401)
@@ -6,13 +6,14 @@
function test()
{
function findElement(collection, elem) {
+ // length
for(var i = 0; i < collection.length; ++i)
if (collection[i] === elem)
return i;
return null;
}
- var steps = [step2, step1]; // reversed order
+ var steps = [step3, step2, step1]; // reversed order
function selectionChangeListener()
{
if (steps.length)
@@ -48,6 +49,14 @@
{
InspectorTest.addResult("=========== After selecting '" + textEditor._textModel.copyRange(range) + "' ===========");
InspectorTest.dumpEditorHTML(textEditor, true);
+ range = new WebInspector.TextRange(1, 11, 1, 17);
+ textEditor.setSelection(range);
+ }
+
+ function step3()
+ {
+ InspectorTest.addResult("=========== After selecting '" + textEditor._textModel.copyRange(range) + "' ===========");
+ InspectorTest.dumpEditorHTML(textEditor, true);
InspectorTest.completeTest();
}
Modified: trunk/Source/WebCore/ChangeLog (141400 => 141401)
--- trunk/Source/WebCore/ChangeLog 2013-01-31 12:01:16 UTC (rev 141400)
+++ trunk/Source/WebCore/ChangeLog 2013-01-31 12:04:09 UTC (rev 141401)
@@ -1,3 +1,17 @@
+2013-01-31 Andrey Lushnikov <[email protected]>
+
+ Web Inspector: DTE doesn't highlight words if the selected one is the last in the line
+ https://bugs.webkit.org/show_bug.cgi?id=108344
+
+ Reviewed by Pavel Feldman.
+
+ Fix error in _isWord function which made an erroneous line-end check.
+
+ Improved test: inspector/editor/text-editor-highlight-token.html
+
+ * inspector/front-end/DefaultTextEditor.js:
+ (WebInspector.TextEditorMainPanel.TokenHighlighter.prototype._isWord):
+
2013-01-31 Philippe Normand <[email protected]>
Unreviewed, Qt build fix after r141265.
Modified: trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js (141400 => 141401)
--- trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js 2013-01-31 12:01:16 UTC (rev 141400)
+++ trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js 2013-01-31 12:04:09 UTC (rev 141401)
@@ -3187,7 +3187,7 @@
const WordRegex = WebInspector.TextEditorMainPanel.TokenHighlighter._WordRegex;
var line = this._textModel.line(range.startLine);
var leftBound = range.startColumn === 0 || NonWordChar.test(line.charAt(range.startColumn - 1));
- var rightBound = range.endColumn === line.length - 1 || NonWordChar.test(line.charAt(range.endColumn));
+ var rightBound = range.endColumn === line.length || NonWordChar.test(line.charAt(range.endColumn));
return leftBound && rightBound && WordRegex.test(selectedText);
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes