| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 1691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1702 this.originalPropertyText = this.property.propertyText; | 1702 this.originalPropertyText = this.property.propertyText; |
| 1703 } | 1703 } |
| 1704 | 1704 |
| 1705 // Synthesize property text disregarding any comments, custom whites
pace etc. | 1705 // Synthesize property text disregarding any comments, custom whites
pace etc. |
| 1706 this.applyStyleText(this.nameElement.textContent + ": " + this.value
Element.textContent); | 1706 this.applyStyleText(this.nameElement.textContent + ": " + this.value
Element.textContent); |
| 1707 } | 1707 } |
| 1708 }, | 1708 }, |
| 1709 | 1709 |
| 1710 editingEnded: function(context) | 1710 editingEnded: function(context) |
| 1711 { | 1711 { |
| 1712 if (this._prompt) { | |
| 1713 this._prompt.removeFromElement(); | |
| 1714 delete this._prompt; | |
| 1715 } | |
| 1716 this.hasChildren = context.hasChildren; | 1712 this.hasChildren = context.hasChildren; |
| 1717 if (context.expanded) | 1713 if (context.expanded) |
| 1718 this.expand(); | 1714 this.expand(); |
| 1719 var editedElement = context.isEditingName ? this.nameElement : this.valu
eElement; | 1715 var editedElement = context.isEditingName ? this.nameElement : this.valu
eElement; |
| 1720 if (!context.isEditingName) | 1716 if (!context.isEditingName) |
| 1721 editedElement.removeEventListener("keydown", context.keyDownListener
, false); | 1717 editedElement.removeEventListener("keydown", context.keyDownListener
, false); |
| 1722 if (editedElement.parentElement) | 1718 if (editedElement.parentElement) |
| 1723 editedElement.parentElement.removeStyleClass("child-editing"); | 1719 editedElement.parentElement.removeStyleClass("child-editing"); |
| 1724 | 1720 |
| 1725 delete this.originalPropertyText; | 1721 delete this.originalPropertyText; |
| 1726 }, | 1722 }, |
| 1727 | 1723 |
| 1728 editingCancelled: function(element, context) | 1724 editingCancelled: function(element, context) |
| 1729 { | 1725 { |
| 1726 this._removePrompt(); |
| 1730 if ("originalPropertyText" in this) | 1727 if ("originalPropertyText" in this) |
| 1731 this.applyStyleText(this.originalPropertyText, true); | 1728 this.applyStyleText(this.originalPropertyText, true); |
| 1732 else { | 1729 else { |
| 1733 if (this._newProperty) | 1730 if (this._newProperty) |
| 1734 this.treeOutline.removeChild(this); | 1731 this.treeOutline.removeChild(this); |
| 1735 else | 1732 else |
| 1736 this.updateTitle(); | 1733 this.updateTitle(); |
| 1737 } | 1734 } |
| 1738 | 1735 |
| 1739 // This should happen last, as it clears the info necessary to restore t
he property value after [Page]Up/Down changes. | 1736 // This should happen last, as it clears the info necessary to restore t
he property value after [Page]Up/Down changes. |
| 1740 this.editingEnded(context); | 1737 this.editingEnded(context); |
| 1741 }, | 1738 }, |
| 1742 | 1739 |
| 1743 editingCommitted: function(element, userInput, previousContent, context, mov
eDirection) | 1740 editingCommitted: function(element, userInput, previousContent, context, mov
eDirection) |
| 1744 { | 1741 { |
| 1742 this._removePrompt(); |
| 1745 this.editingEnded(context); | 1743 this.editingEnded(context); |
| 1746 var isEditingName = context.isEditingName; | 1744 var isEditingName = context.isEditingName; |
| 1747 | 1745 |
| 1748 // Determine where to move to before making changes | 1746 // Determine where to move to before making changes |
| 1749 var createNewProperty, moveToPropertyName, moveToSelector; | 1747 var createNewProperty, moveToPropertyName, moveToSelector; |
| 1750 var moveTo = this; | 1748 var moveTo = this; |
| 1751 var moveToOther = (isEditingName ^ (moveDirection === "forward")); | 1749 var moveToOther = (isEditingName ^ (moveDirection === "forward")); |
| 1752 var abandonNewProperty = this._newProperty && !userInput && (moveToOther
|| isEditingName); | 1750 var abandonNewProperty = this._newProperty && !userInput && (moveToOther
|| isEditingName); |
| 1753 if (moveDirection === "forward" && !isEditingName || moveDirection === "
backward" && isEditingName) { | 1751 if (moveDirection === "forward" && !isEditingName || moveDirection === "
backward" && isEditingName) { |
| 1754 do { | 1752 do { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1832 if (sectionToEdit && sectionToEdit.rule) | 1830 if (sectionToEdit && sectionToEdit.rule) |
| 1833 sectionToEdit.startEditingSelector(); | 1831 sectionToEdit.startEditingSelector(); |
| 1834 return; | 1832 return; |
| 1835 } | 1833 } |
| 1836 | 1834 |
| 1837 if (moveToSelector) | 1835 if (moveToSelector) |
| 1838 section.startEditingSelector(); | 1836 section.startEditingSelector(); |
| 1839 } | 1837 } |
| 1840 }, | 1838 }, |
| 1841 | 1839 |
| 1840 _removePrompt: function() |
| 1841 { |
| 1842 // BUG 53242. This cannot go into editingEnded(), as it should always ha
ppen first for any editing outcome. |
| 1843 if (this._prompt) { |
| 1844 this._prompt.removeFromElement(); |
| 1845 delete this._prompt; |
| 1846 } |
| 1847 }, |
| 1848 |
| 1842 _hasBeenAppliedToPageViaUpDown: function() | 1849 _hasBeenAppliedToPageViaUpDown: function() |
| 1843 { | 1850 { |
| 1844 // New properties applied via up/down have an originalPropertyText and w
ill be deleted later | 1851 // New properties applied via up/down have an originalPropertyText and w
ill be deleted later |
| 1845 // on, if cancelled, when the empty string gets applied as their style t
ext. | 1852 // on, if cancelled, when the empty string gets applied as their style t
ext. |
| 1846 return ("originalPropertyText" in this); | 1853 return ("originalPropertyText" in this); |
| 1847 }, | 1854 }, |
| 1848 | 1855 |
| 1849 applyStyleText: function(styleText, updateInterface) | 1856 applyStyleText: function(styleText, updateInterface) |
| 1850 { | 1857 { |
| 1851 var section = this.treeOutline.section; | 1858 var section = this.treeOutline.section; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1941 return completionsReadyCallback(results); | 1948 return completionsReadyCallback(results); |
| 1942 } | 1949 } |
| 1943 | 1950 |
| 1944 results = this._cssCompletions.startsWith(prefix); | 1951 results = this._cssCompletions.startsWith(prefix); |
| 1945 if (results) | 1952 if (results) |
| 1946 completionsReadyCallback(results); | 1953 completionsReadyCallback(results); |
| 1947 } | 1954 } |
| 1948 } | 1955 } |
| 1949 | 1956 |
| 1950 WebInspector.StylesSidebarPane.CSSPropertyPrompt.prototype.__proto__ = WebInspec
tor.TextPrompt.prototype; | 1957 WebInspector.StylesSidebarPane.CSSPropertyPrompt.prototype.__proto__ = WebInspec
tor.TextPrompt.prototype; |
| OLD | NEW |