Changeset 84136 in webkit
- Timestamp:
- Apr 18, 2011 6:36:07 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r84135 r84136 1 2011-04-18 Andrey Adaikin <aandrey@google.com> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: TAB should not move focus from the text editor while live editing 6 https://bugs.webkit.org/show_bug.cgi?id=58537 7 8 * inspector/front-end/TextViewer.js: 9 (WebInspector.TextViewer.prototype._registerShortcuts): 10 (WebInspector.TextViewer.prototype._cancelEditing): 11 (WebInspector.TextEditorMainPanel.prototype.handleUndoRedo): 12 (WebInspector.TextEditorMainPanel.prototype.handleTabKeyPress): 13 (WebInspector.TextEditorMainPanel.prototype._setCaretLocation): 14 (WebInspector.TextEditorMainPanel.prototype._applyDomUpdates): 15 (WebInspector.TextEditorMainPanel.prototype._setText): 16 1 17 2011-04-18 Alexander Pavlov <apavlov@chromium.org> 2 18 -
trunk/Source/WebCore/inspector/front-end/TextViewer.js
r83951 r84136 254 254 this._shortcuts[WebInspector.KeyboardShortcut.makeKey(keys.Esc.code)] = cancelEditing; 255 255 256 var handleUndo = this._ handleUndoRedo.bind(this, 0);257 var handleRedo = this._ handleUndoRedo.bind(this, 1);256 var handleUndo = this._mainPanel.handleUndoRedo.bind(this._mainPanel, false); 257 var handleRedo = this._mainPanel.handleUndoRedo.bind(this._mainPanel, true); 258 258 this._shortcuts[WebInspector.KeyboardShortcut.makeKey("z", modifiers.CtrlOrMeta)] = handleUndo; 259 259 this._shortcuts[WebInspector.KeyboardShortcut.makeKey("z", modifiers.Shift | modifiers.CtrlOrMeta)] = handleRedo; 260 261 var handleTabKey = this._mainPanel.handleTabKeyPress.bind(this._mainPanel, false); 262 var handleShiftTabKey = this._mainPanel.handleTabKeyPress.bind(this._mainPanel, true); 263 this._shortcuts[WebInspector.KeyboardShortcut.makeKey(keys.Tab.code)] = handleTabKey; 264 this._shortcuts[WebInspector.KeyboardShortcut.makeKey(keys.Tab.code, modifiers.Shift)] = handleShiftTabKey; 260 265 }, 261 266 … … 295 300 this._delegate.cancelEditing(); 296 301 return true; 297 },298 299 _handleUndoRedo: function(redo)300 {301 return this._mainPanel.handleUndoRedo(redo);302 302 } 303 303 } … … 938 938 var range = redo ? this._textModel.redo(callback) : this._textModel.undo(callback); 939 939 if (range) 940 this._ restoreSelection(new WebInspector.TextRange(range.endLine, range.endColumn, range.endLine, range.endColumn), true);940 this._setCaretLocation(range.endLine, range.endColumn, true); 941 941 942 942 this._exitTextChangeMode(null, null); 943 943 this.endUpdates(); 944 944 945 return true; 946 }, 947 948 handleTabKeyPress: function(shiftKey) 949 { 950 if (this._readOnly || this._dirtyLines) 951 return false; 952 953 var selection = this._getSelection(); 954 if (!selection) 955 return false; 956 957 if (shiftKey) 958 return true; 959 960 this.beginUpdates(); 961 this._enterTextChangeMode(); 962 963 var range = selection; 964 if (range.startLine > range.endLine || (range.startLine === range.endLine && range.startColumn > range.endColumn)) 965 range = new WebInspector.TextRange(range.endLine, range.endColumn, range.startLine, range.startColumn); 966 967 var newRange = this._setText(range, "\t"); 968 969 this._exitTextChangeMode(range, newRange); 970 this.endUpdates(); 971 972 this._setCaretLocation(newRange.endLine, newRange.endColumn, true); 945 973 return true; 946 974 }, … … 1228 1256 }, 1229 1257 1258 _setCaretLocation: function(line, column, scrollIntoView) 1259 { 1260 var range = new WebInspector.TextRange(line, column, line, column); 1261 this._restoreSelection(range, scrollIntoView); 1262 }, 1263 1230 1264 _selectionToPosition: function(container, offset) 1231 1265 { … … 1507 1541 var oldRange = new WebInspector.TextRange(startLine, startColumn, endLine - 1, endColumn); 1508 1542 1509 if (this._lastEditedRange && (lines.length !== 1 || this._lastEditedRange.endLine !== oldRange.startLine || this._lastEditedRange.endColumn !== oldRange.startColumn)) 1510 this._textModel.markUndoableState(); 1511 1512 var newRange = this._textModel.setText(oldRange, lines.join("\n")); 1513 this._lastEditedRange = newRange; 1514 1543 var newRange = this._setText(oldRange, lines.join("\n")); 1544 1515 1545 this._paintScheduledLines(true); 1516 1546 this._restoreSelection(selection); … … 1526 1556 this._updateHighlightsForRange(newRange); 1527 1557 this.endDomUpdates(); 1558 }, 1559 1560 _setText: function(range, text) 1561 { 1562 if (this._lastEditedRange && (!text || text.indexOf("\n") !== -1 || this._lastEditedRange.endLine !== range.startLine || this._lastEditedRange.endColumn !== range.startColumn)) 1563 this._textModel.markUndoableState(); 1564 1565 var newRange = this._textModel.setText(range, text); 1566 this._lastEditedRange = newRange; 1567 1568 return newRange; 1528 1569 }, 1529 1570
Note: See TracChangeset
for help on using the changeset viewer.