Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / devtools / front_end / ui / TextEditor.js
1 /*
2  * Copyright (C) 2011 Google Inc. All rights reserved.
3  * Copyright (C) 2010 Apple Inc. All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  *     * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *     * Redistributions in binary form must reproduce the above
12  * copyright notice, this list of conditions and the following disclaimer
13  * in the documentation and/or other materials provided with the
14  * distribution.
15  *     * Neither the name of Google Inc. nor the names of its
16  * contributors may be used to endorse or promote products derived from
17  * this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31
32 /**
33  * @interface
34  */
35 WebInspector.TextEditor = function() { };
36
37 WebInspector.TextEditor.Events = {
38     GutterClick: "gutterClick"
39 };
40
41 /** @typedef {{lineNumber: number, event: !Event}} */
42 WebInspector.TextEditor.GutterClickEventData;
43
44 WebInspector.TextEditor.prototype = {
45
46     undo: function() { },
47
48     redo: function() { },
49
50     /**
51      * @return {boolean}
52      */
53     isClean: function() { },
54
55     markClean: function() { },
56
57     /**
58      * @return {string}
59      */
60     indent: function() { },
61
62     /**
63      * @param {number} lineNumber
64      * @param {number} column
65      * @return {?{x: number, y: number, height: number}}
66      */
67     cursorPositionToCoordinates: function(lineNumber, column) { return null; },
68
69     /**
70      * @param {number} x
71      * @param {number} y
72      * @return {?WebInspector.TextRange}
73      */
74     coordinatesToCursorPosition: function(x, y) { return null; },
75
76     /**
77      * @param {number} lineNumber
78      * @param {number} column
79      * @return {?{startColumn: number, endColumn: number, type: string}}
80      */
81     tokenAtTextPosition: function(lineNumber, column) { return null; },
82
83     /**
84      * @param {string} mimeType
85      */
86     setMimeType: function(mimeType) { },
87
88     /**
89      * @param {boolean} readOnly
90      */
91     setReadOnly: function(readOnly) { },
92
93     /**
94      * @return {boolean}
95      */
96     readOnly: function() { },
97
98     /**
99      * @return {!Element}
100      */
101     defaultFocusedElement: function() { },
102
103     /**
104      * @param {!WebInspector.TextRange} range
105      * @param {string} cssClass
106      * @return {!Object}
107      */
108     highlightRange: function(range, cssClass) { },
109
110     /**
111      * @param {!Object} highlightDescriptor
112      */
113     removeHighlight: function(highlightDescriptor) { },
114
115     /**
116      * @param {number} lineNumber
117      * @param {boolean} disabled
118      * @param {boolean} conditional
119      */
120     addBreakpoint: function(lineNumber, disabled, conditional) { },
121
122     /**
123      * @param {number} lineNumber
124      */
125     removeBreakpoint: function(lineNumber) { },
126
127     /**
128      * @param {number} lineNumber
129      */
130     setExecutionLine: function(lineNumber) { },
131
132     clearExecutionLine: function() { },
133
134     /**
135      * @param {number} lineNumber
136      * @param {string} className
137      * @param {boolean} toggled
138      */
139     toggleLineClass: function(lineNumber, className, toggled) { },
140
141     /**
142      * @param {number} lineNumber
143      * @param {!Element} element
144      */
145     addDecoration: function(lineNumber, element) { },
146
147     /**
148      * @param {number} lineNumber
149      * @param {!Element} element
150      */
151     removeDecoration: function(lineNumber, element) { },
152
153     /**
154      * @param {!RegExp} regex
155      * @param {?WebInspector.TextRange} range
156      */
157     highlightSearchResults: function(regex, range) { },
158
159     /**
160      * @param {number} lineNumber
161      * @param {number=} columnNumber
162      * @param {boolean=} shouldHighlight
163      */
164     revealPosition: function(lineNumber, columnNumber, shouldHighlight) { },
165
166     clearPositionHighlight: function() { },
167
168     /**
169      * @return {!Array.<!Element>}
170      */
171     elementsToRestoreScrollPositionsFor: function() { },
172
173     /**
174      * @param {!WebInspector.TextEditor} textEditor
175      */
176     inheritScrollPositions: function(textEditor) { },
177
178     beginUpdates: function() { },
179
180     endUpdates: function() { },
181
182     onResize: function() { },
183
184     /**
185      * @param {!WebInspector.TextRange} range
186      * @param {string} text
187      * @return {!WebInspector.TextRange}
188      */
189     editRange: function(range, text) { },
190
191     /**
192      * @param {number} lineNumber
193      */
194     scrollToLine: function(lineNumber) { },
195
196     /**
197      * @return {number}
198      */
199     firstVisibleLine: function() { },
200
201     /**
202      * @return {number}
203      */
204     lastVisibleLine: function() { },
205
206     /**
207      * @return {!WebInspector.TextRange}
208      */
209     selection: function() { },
210
211     /**
212      * @return {!Array.<!WebInspector.TextRange>}
213      */
214     selections: function() { },
215
216     /**
217      * @return {?WebInspector.TextRange}
218      */
219     lastSelection: function() { },
220
221     /**
222      * @param {!WebInspector.TextRange} textRange
223      */
224     setSelection: function(textRange) { },
225
226     /**
227      * @param {!WebInspector.TextRange} range
228      * @return {string}
229      */
230     copyRange: function(range) { },
231
232     /**
233      * @param {string} text
234      */
235     setText: function(text) { },
236
237     /**
238      * @return {string}
239      */
240     text: function() { },
241
242     /**
243      * @return {!WebInspector.TextRange}
244      */
245     range: function() { },
246
247     /**
248      * @param {number} lineNumber
249      * @return {string}
250      */
251     line: function(lineNumber) { },
252
253     /**
254      * @return {number}
255      */
256     get linesCount() { },
257
258     /**
259      * @param {number} line
260      * @param {string} name
261      * @param {?Object} value
262      */
263     setAttribute: function(line, name, value) { },
264
265     /**
266      * @param {number} line
267      * @param {string} name
268      * @return {?Object} value
269      */
270     getAttribute: function(line, name) { },
271
272     /**
273      * @param {number} line
274      * @param {string} name
275      */
276     removeAttribute: function(line, name) { },
277
278     wasShown: function() { },
279
280     willHide: function() { },
281
282     /**
283      * @param {?WebInspector.CompletionDictionary} dictionary
284      */
285     setCompletionDictionary: function(dictionary) { },
286
287     /**
288      * @param {number} lineNumber
289      * @param {number} columnNumber
290      * @return {?WebInspector.TextEditorPositionHandle}
291      */
292     textEditorPositionHandle: function(lineNumber, columnNumber) { },
293
294     dispose: function() { }
295 }
296
297 /**
298  * @interface
299  */
300 WebInspector.TextEditorPositionHandle = function()
301 {
302 }
303
304 WebInspector.TextEditorPositionHandle.prototype = {
305     /**
306      * @return {?{lineNumber: number, columnNumber: number}}
307      */
308     resolve: function() { },
309
310     /**
311      * @param {!WebInspector.TextEditorPositionHandle} positionHandle
312      * @return {boolean}
313      */
314     equal: function(positionHandle) { }
315 }
316
317 /**
318  * @interface
319  */
320 WebInspector.TextEditorDelegate = function()
321 {
322 }
323
324 WebInspector.TextEditorDelegate.prototype = {
325     /**
326      * @param {!WebInspector.TextRange} oldRange
327      * @param {!WebInspector.TextRange} newRange
328      */
329     onTextChanged: function(oldRange, newRange) { },
330
331     /**
332      * @param {!WebInspector.TextRange} textRange
333      */
334     selectionChanged: function(textRange) { },
335
336     /**
337      * @param {number} lineNumber
338      */
339     scrollChanged: function(lineNumber) { },
340
341     editorFocused: function() { },
342
343     /**
344      * @param {!WebInspector.ContextMenu} contextMenu
345      * @param {number} lineNumber
346      */
347     populateLineGutterContextMenu: function(contextMenu, lineNumber) { },
348
349     /**
350      * @param {!WebInspector.ContextMenu} contextMenu
351      * @param {number} lineNumber
352      */
353     populateTextAreaContextMenu: function(contextMenu, lineNumber) { },
354
355     /**
356      * @param {?WebInspector.TextRange} from
357      * @param {?WebInspector.TextRange} to
358      */
359     onJumpToPosition: function(from, to) { }
360 }
361
362 /**
363  * @interface
364  */
365 WebInspector.TokenizerFactory = function() { }
366
367 WebInspector.TokenizerFactory.prototype = {
368     /**
369      * @param {string} mimeType
370      * @return {function(string, function(string, ?string, number, number))}
371      */
372     createTokenizer: function(mimeType) { }
373 }