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 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 multiline: true | 1054 multiline: true |
1055 }); | 1055 }); |
1056 }, | 1056 }, |
1057 | 1057 |
1058 _attributeEditingCommitted: function(element, newText, oldText, attributeNam
e, moveDirection) | 1058 _attributeEditingCommitted: function(element, newText, oldText, attributeNam
e, moveDirection) |
1059 { | 1059 { |
1060 delete this._editing; | 1060 delete this._editing; |
1061 | 1061 |
1062 function moveToNextAttributeIfNeeded(error) | 1062 function moveToNextAttributeIfNeeded(error) |
1063 { | 1063 { |
| 1064 if (error) |
| 1065 this._editingCancelled(element, attributeName); |
| 1066 |
| 1067 if (!moveDirection) |
| 1068 return; |
| 1069 |
1064 WebInspector.panels.elements.updateModifiedNodes(); | 1070 WebInspector.panels.elements.updateModifiedNodes(); |
1065 | 1071 |
1066 // Search for the attribute's position, and then decide where to mov
e to. | 1072 // Search for the attribute's position, and then decide where to mov
e to. |
1067 var attributes = this.representedObject.attributes(); | 1073 var attributes = this.representedObject.attributes(); |
1068 for (var i = 0; i < attributes.length; ++i) { | 1074 for (var i = 0; i < attributes.length; ++i) { |
1069 if (attributes[i].name !== attributeName) | 1075 if (attributes[i].name !== attributeName) |
1070 continue; | 1076 continue; |
1071 | 1077 |
1072 if (moveDirection === "backward") { | 1078 if (moveDirection === "backward") { |
1073 if (i === 0) | 1079 if (i === 0) |
(...skipping 21 matching lines...) Expand all Loading... |
1095 this._triggerEditAttribute(attributes[attributes.length
- 2].name); | 1101 this._triggerEditAttribute(attributes[attributes.length
- 2].name); |
1096 } | 1102 } |
1097 } else if (moveDirection === "forward") { | 1103 } else if (moveDirection === "forward") { |
1098 if (!/^\s*$/.test(newText)) | 1104 if (!/^\s*$/.test(newText)) |
1099 this._addNewAttribute(); | 1105 this._addNewAttribute(); |
1100 else | 1106 else |
1101 this._startEditingTagName(); | 1107 this._startEditingTagName(); |
1102 } | 1108 } |
1103 } | 1109 } |
1104 | 1110 |
1105 this.representedObject.setAttribute(attributeName, newText, moveDirectio
n ? moveToNextAttributeIfNeeded.bind(this) : undefined); | 1111 this.representedObject.setAttribute(attributeName, newText, moveToNextAt
tributeIfNeeded.bind(this)); |
1106 }, | 1112 }, |
1107 | 1113 |
1108 _tagNameEditingCommitted: function(element, newText, oldText, tagName, moveD
irection) | 1114 _tagNameEditingCommitted: function(element, newText, oldText, tagName, moveD
irection) |
1109 { | 1115 { |
1110 delete this._editing; | 1116 delete this._editing; |
1111 var self = this; | 1117 var self = this; |
1112 | 1118 |
1113 function cancel() | 1119 function cancel() |
1114 { | 1120 { |
1115 var closingTagElement = self._distinctClosingTagElement(); | 1121 var closingTagElement = self._distinctClosingTagElement(); |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1485 // Fall back for XPath, etc. matches. | 1491 // Fall back for XPath, etc. matches. |
1486 if (!matchRanges.length) | 1492 if (!matchRanges.length) |
1487 matchRanges.push({ offset: 0, length: text.length }); | 1493 matchRanges.push({ offset: 0, length: text.length }); |
1488 | 1494 |
1489 this._highlightResult = []; | 1495 this._highlightResult = []; |
1490 highlightSearchResults(this.listItemElement, matchRanges, this._highligh
tResult); | 1496 highlightSearchResults(this.listItemElement, matchRanges, this._highligh
tResult); |
1491 } | 1497 } |
1492 } | 1498 } |
1493 | 1499 |
1494 WebInspector.ElementsTreeElement.prototype.__proto__ = TreeElement.prototype; | 1500 WebInspector.ElementsTreeElement.prototype.__proto__ = TreeElement.prototype; |
OLD | NEW |