Changeset 141257 in webkit
- Timestamp:
- Jan 30, 2013 4:43:51 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 2 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r141256 r141257 1 2013-01-30 Andrey Lushnikov <lushnikov@chromium.org> 2 3 Web Inspector: implement highlight range API 4 https://bugs.webkit.org/show_bug.cgi?id=108317 5 6 Reviewed by Pavel Feldman. 7 8 Added test cases to the existed test to cover highlight range 9 functionality. 10 11 * inspector/editor/text-editor-highlight-api-expected.txt: Added. 12 * inspector/editor/text-editor-highlight-api.html: Added. 13 * inspector/editor/text-editor-highlight-regexp-expected.txt: Removed. 14 * inspector/editor/text-editor-highlight-regexp.html: Removed. 15 1 16 2013-01-30 Zan Dobersek <zdobersek@igalia.com> 2 17 -
trunk/Source/WebCore/ChangeLog
r141255 r141257 1 2013-01-30 Andrey Lushnikov <lushnikov@chromium.org> 2 3 Web Inspector: implement highlight range API 4 https://bugs.webkit.org/show_bug.cgi?id=108317 5 6 Reviewed by Pavel Feldman. 7 8 Test: inspector/editor/text-editor-highlight-api.html 9 10 Introduce RangeHighlightDescriptor class and implement Highlight Range 11 api. 12 13 * inspector/front-end/DefaultTextEditor.js: 14 (WebInspector.DefaultTextEditor.prototype.removeHighlight): 15 (WebInspector.DefaultTextEditor.prototype.highlightRange): 16 (WebInspector.TextEditorMainPanel.prototype.removeHighlight): 17 (WebInspector.TextEditorMainPanel.prototype.highlightRange): 18 (WebInspector.TextEditorMainPanel.RangeHighlightDescriptor): 19 (WebInspector.TextEditorMainPanel.RangeHighlightDescriptor.prototype.affectsLine): 20 (WebInspector.TextEditorMainPanel.RangeHighlightDescriptor.prototype.rangesForLine): 21 (WebInspector.TextEditorMainPanel.RangeHighlightDescriptor.prototype.cssClass): 22 (WebInspector.TextEditorMainPanel.TokenHighlighter.prototype._removeHighlight): 23 * inspector/front-end/TextEditor.js: 24 (WebInspector.TextEditor.prototype.highlightRange): 25 (WebInspector.TextEditor.prototype.removeHighlight): 26 1 27 2013-01-30 Simon Hausmann <simon.hausmann@digia.com> 2 28 -
trunk/Source/WebCore/inspector/front-end/DefaultTextEditor.js
r141245 r141257 124 124 * @param {WebInspector.TextEditorMainPanel.HighlightDescriptor} highlightDescriptor 125 125 */ 126 removeRegexHighlight: function(highlightDescriptor) 127 { 128 this._mainPanel.removeRegexHighlight(highlightDescriptor); 126 removeHighlight: function(highlightDescriptor) 127 { 128 this._mainPanel.removeHighlight(highlightDescriptor); 129 }, 130 131 /** 132 * @param {WebInspector.TextRange} range 133 * @param {string} cssClass 134 */ 135 highlightRange: function(range, cssClass) 136 { 137 return this._mainPanel.highlightRange(range, cssClass); 129 138 }, 130 139 … … 1389 1398 * @param {WebInspector.TextEditorMainPanel.HighlightDescriptor} highlightDescriptor 1390 1399 */ 1391 remove RegexHighlight: function(highlightDescriptor)1400 removeHighlight: function(highlightDescriptor) 1392 1401 { 1393 1402 this._highlightDescriptors.remove(highlightDescriptor); 1394 1403 this._repaintLineRowsAffectedByHighlightDescriptor(highlightDescriptor); 1404 }, 1405 1406 /** 1407 * @param {WebInspector.TextRange} range 1408 * @param {string} cssClass 1409 */ 1410 highlightRange: function(range, cssClass) 1411 { 1412 var highlightDescriptor = new WebInspector.TextEditorMainPanel.RangeHighlightDescriptor(range, cssClass); 1413 this._highlightDescriptors.push(highlightDescriptor); 1414 this._repaintLineRowsAffectedByHighlightDescriptor(highlightDescriptor); 1415 return highlightDescriptor; 1395 1416 }, 1396 1417 … … 2755 2776 /** 2756 2777 * @constructor 2778 * @implements {WebInspector.TextEditorMainPanel.HighlightDescriptor} 2779 * @param {WebInspector.TextRange} range 2780 * @param {string} cssClass 2781 */ 2782 WebInspector.TextEditorMainPanel.RangeHighlightDescriptor = function(range, cssClass) 2783 { 2784 this._cssClass = cssClass; 2785 this._range = range; 2786 } 2787 2788 WebInspector.TextEditorMainPanel.RangeHighlightDescriptor.prototype = { 2789 /** 2790 * @param {number} lineNumber 2791 * @param {string} line 2792 * @return {boolean} 2793 */ 2794 affectsLine: function(lineNumber, line) 2795 { 2796 return this._range.startLine <= lineNumber && lineNumber <= this._range.endLine && line.length > 0; 2797 }, 2798 2799 /** 2800 * @param {number} lineNumber 2801 * @param {string} line 2802 * @return {Array.<{startColumn: number, endColumn: number}>} 2803 */ 2804 rangesForLine: function(lineNumber, line) 2805 { 2806 if (!this.affectsLine(lineNumber, line)) 2807 return []; 2808 2809 var startColumn = lineNumber === this._range.startLine ? this._range.startColumn : 0; 2810 var endColumn = lineNumber === this._range.endLine ? Math.max(this._range.endColumn, line.length) : line.length; 2811 return [{ 2812 startColumn: startColumn, 2813 endColumn: endColumn 2814 }]; 2815 }, 2816 2817 /** 2818 * @return {string} 2819 */ 2820 cssClass: function() 2821 { 2822 return this._cssClass; 2823 } 2824 } 2825 2826 /** 2827 * @constructor 2757 2828 * @param {Element} element 2758 2829 */ … … 3100 3171 { 3101 3172 if (this._selectedWord) { 3102 this._mainPanel.remove RegexHighlight(this._highlightDescriptor);3173 this._mainPanel.removeHighlight(this._highlightDescriptor); 3103 3174 delete this._selectedWord; 3104 3175 delete this._highlightDescriptor; -
trunk/Source/WebCore/inspector/front-end/TextEditor.js
r141245 r141257 69 69 70 70 /** 71 * @param {WebInspector.TextRange} range 72 * @param {string} cssClass 73 */ 74 highlightRange: function(range, cssClass) { }, 75 76 /** 71 77 * @param {WebInspector.TextEditorMainPanel.HighlightDescriptor} highlightDescriptor 72 78 */ 73 remove RegexHighlight: function(highlightDescriptor) { },79 removeHighlight: function(highlightDescriptor) { }, 74 80 75 81 /**
Note: See TracChangeset
for help on using the changeset viewer.