| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> | 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> |
| 4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 | 659 |
| 660 var attributeValue = attributeName && attributeValueElement ? this._node
.getAttribute(attributeName) : undefined; | 660 var attributeValue = attributeName && attributeValueElement ? this._node
.getAttribute(attributeName) : undefined; |
| 661 if (attributeValue !== undefined) | 661 if (attributeValue !== undefined) |
| 662 attributeValueElement.setTextContentTruncatedIfNeeded(attributeValue
, WebInspector.UIString("<value is too large to edit>")); | 662 attributeValueElement.setTextContentTruncatedIfNeeded(attributeValue
, WebInspector.UIString("<value is too large to edit>")); |
| 663 | 663 |
| 664 // Remove zero-width spaces that were added by nodeTitleInfo. | 664 // Remove zero-width spaces that were added by nodeTitleInfo. |
| 665 removeZeroWidthSpaceRecursive(attribute); | 665 removeZeroWidthSpaceRecursive(attribute); |
| 666 | 666 |
| 667 var config = new WebInspector.InplaceEditor.Config(this._attributeEditin
gCommitted.bind(this), this._editingCancelled.bind(this), attributeName); | 667 var config = new WebInspector.InplaceEditor.Config(this._attributeEditin
gCommitted.bind(this), this._editingCancelled.bind(this), attributeName); |
| 668 | 668 |
| 669 function handleKeyDownEvents(event) | 669 /** |
| 670 * @param {!Event} event |
| 671 * @return {string} |
| 672 */ |
| 673 function postKeyDownFinishHandler(event) |
| 670 { | 674 { |
| 671 var isMetaOrCtrl = WebInspector.isMac() ? | 675 WebInspector.handleElementValueModifications(event, attribute); |
| 672 event.metaKey && !event.shiftKey && !event.ctrlKey && !event.alt
Key : | 676 return ""; |
| 673 event.ctrlKey && !event.shiftKey && !event.metaKey && !event.alt
Key; | |
| 674 if (isEnterKey(event) && (event.isMetaOrCtrlForTest || !config.multi
line || isMetaOrCtrl)) | |
| 675 return "commit"; | |
| 676 else if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Esc.co
de || event.keyIdentifier === "U+001B") | |
| 677 return "cancel"; | |
| 678 else if (event.keyIdentifier === "U+0009") // Tab key | |
| 679 return "move-" + (event.shiftKey ? "backward" : "forward"); | |
| 680 else { | |
| 681 WebInspector.handleElementValueModifications(event, attribute); | |
| 682 return ""; | |
| 683 } | |
| 684 } | 677 } |
| 685 | 678 config.setPostKeydownFinishHandler(postKeyDownFinishHandler); |
| 686 config.customFinishHandler = handleKeyDownEvents; | |
| 687 | 679 |
| 688 this._editing = WebInspector.InplaceEditor.startEditing(attribute, confi
g); | 680 this._editing = WebInspector.InplaceEditor.startEditing(attribute, confi
g); |
| 689 | 681 |
| 690 this.listItemElement.getComponentSelection().setBaseAndExtent(elementFor
Selection, 0, elementForSelection, 1); | 682 this.listItemElement.getComponentSelection().setBaseAndExtent(elementFor
Selection, 0, elementForSelection, 1); |
| 691 | 683 |
| 692 return true; | 684 return true; |
| 693 }, | 685 }, |
| 694 | 686 |
| 695 /** | 687 /** |
| 696 * @param {!Element} textNodeElement | 688 * @param {!Element} textNodeElement |
| (...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1525 | 1517 |
| 1526 if (object) | 1518 if (object) |
| 1527 object.callFunction(scrollIntoView); | 1519 object.callFunction(scrollIntoView); |
| 1528 } | 1520 } |
| 1529 | 1521 |
| 1530 this._node.resolveToObject("", scrollIntoViewCallback); | 1522 this._node.resolveToObject("", scrollIntoViewCallback); |
| 1531 }, | 1523 }, |
| 1532 | 1524 |
| 1533 __proto__: TreeElement.prototype | 1525 __proto__: TreeElement.prototype |
| 1534 } | 1526 } |
| OLD | NEW |