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 2132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2143 { | 2143 { |
2144 // BUG 53242. This cannot go into editingEnded(), as it should always ha
ppen first for any editing outcome. | 2144 // BUG 53242. This cannot go into editingEnded(), as it should always ha
ppen first for any editing outcome. |
2145 if (this._prompt) { | 2145 if (this._prompt) { |
2146 this._prompt.detach(); | 2146 this._prompt.detach(); |
2147 delete this._prompt; | 2147 delete this._prompt; |
2148 } | 2148 } |
2149 }, | 2149 }, |
2150 | 2150 |
2151 _hasBeenModifiedIncrementally: function() | 2151 _hasBeenModifiedIncrementally: function() |
2152 { | 2152 { |
2153 // New properties applied via up/down or live editing have an originalPr
opertyText and will be deleted later | 2153 // New properties applied via up/down have an originalPropertyText and w
ill be deleted later |
2154 // on, if cancelled, when the empty string gets applied as their style t
ext. | 2154 // on, if cancelled, when the empty string gets applied as their style t
ext. |
2155 return typeof this.originalPropertyText === "string" || (!!this.property
.propertyText && this._newProperty); | 2155 return typeof this.originalPropertyText === "string"; |
2156 }, | 2156 }, |
2157 | 2157 |
2158 applyStyleText: function(styleText, updateInterface, majorChange, isRevert) | 2158 applyStyleText: function(styleText, updateInterface, majorChange, isRevert) |
2159 { | 2159 { |
2160 function userOperationFinishedCallback(parentPane, updateInterface) | 2160 function userOperationFinishedCallback(parentPane, updateInterface) |
2161 { | 2161 { |
2162 if (updateInterface) | 2162 if (updateInterface) |
2163 delete parentPane._userOperation; | 2163 delete parentPane._userOperation; |
2164 } | 2164 } |
2165 | 2165 |
2166 // Leave a way to cancel editing after incremental changes. | 2166 // Leave a way to cancel editing after incremental changes. |
2167 if (!isRevert && !updateInterface && !this._hasBeenModifiedIncrementally
()) { | 2167 if (!isRevert && !updateInterface && !this._hasBeenModifiedIncrementally
()) { |
2168 // Remember the rule's original CSS text on [Page](Up|Down), so it c
an be restored | 2168 // Remember the rule's original CSS text on [Page](Up|Down), so it c
an be restored |
2169 // if the editing is canceled. | 2169 // if the editing is canceled. |
2170 this.originalPropertyText = this.property.propertyText; | 2170 this.originalPropertyText = this.property.propertyText; |
2171 } | 2171 } |
2172 | 2172 |
2173 if (!this.treeOutline) | 2173 if (!this.treeOutline) |
2174 return; | 2174 return; |
2175 | 2175 |
2176 var section = this.treeOutline.section; | 2176 var section = this.treeOutline.section; |
2177 var elementsPanel = WebInspector.panels.elements; | 2177 var elementsPanel = WebInspector.panels.elements; |
2178 styleText = styleText.replace(/\s/g, " ").trim(); // Replace with
whitespace. | 2178 styleText = styleText.replace(/\s/g, " ").trim(); // Replace with
whitespace. |
2179 var styleTextLength = styleText.length; | 2179 var styleTextLength = styleText.length; |
2180 if (!styleTextLength && updateInterface && !isRevert && this._newPropert
y && !this._hasBeenModifiedIncrementally()) { | 2180 if (!styleTextLength && updateInterface && !isRevert && this._newPropert
y && !this._hasBeenModifiedIncrementally()) { |
2181 // The user deleted everything and never applied a new property valu
e via Up/Down scrolling/live editing, so remove the tree element and update. | 2181 // The user deleted everything and never applied a new property valu
e via Up/Down scrolling, so remove the tree element and update. |
2182 this.parent.removeChild(this); | 2182 this.parent.removeChild(this); |
2183 section.afterUpdate(); | 2183 section.afterUpdate(); |
2184 return; | 2184 return; |
2185 } | 2185 } |
2186 | 2186 |
2187 var currentNode = this._parentPane.node; | 2187 var currentNode = this._parentPane.node; |
2188 if (updateInterface) | 2188 if (updateInterface) |
2189 this._parentPane._userOperation = true; | 2189 this._parentPane._userOperation = true; |
2190 | 2190 |
2191 function callback(userCallback, originalPropertyText, newStyle) | 2191 function callback(userCallback, originalPropertyText, newStyle) |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2245 switch (event.keyIdentifier) { | 2245 switch (event.keyIdentifier) { |
2246 case "Up": | 2246 case "Up": |
2247 case "Down": | 2247 case "Down": |
2248 case "PageUp": | 2248 case "PageUp": |
2249 case "PageDown": | 2249 case "PageDown": |
2250 if (this._handleNameOrValueUpDown(event)) { | 2250 if (this._handleNameOrValueUpDown(event)) { |
2251 event.preventDefault(); | 2251 event.preventDefault(); |
2252 return; | 2252 return; |
2253 } | 2253 } |
2254 break; | 2254 break; |
| 2255 case "U+0009": |
| 2256 if (this.isSuggestBoxVisible()) { |
| 2257 this._suggestBox.acceptSuggestion(); |
| 2258 return !this._isEditingName; |
| 2259 } |
| 2260 return this.acceptAutoComplete(); |
2255 } | 2261 } |
2256 | 2262 |
2257 WebInspector.TextPrompt.prototype.onKeyDown.call(this, event); | 2263 WebInspector.TextPrompt.prototype.onKeyDown.call(this, event); |
2258 }, | 2264 }, |
2259 | 2265 |
2260 tabKeyPressed: function() | |
2261 { | |
2262 this.acceptAutoComplete(); | |
2263 | |
2264 // Always tab to the next field. | |
2265 return false; | |
2266 }, | |
2267 | |
2268 _handleNameOrValueUpDown: function(event) | 2266 _handleNameOrValueUpDown: function(event) |
2269 { | 2267 { |
2270 // Handle numeric value increment/decrement only at this point. | 2268 // Handle numeric value increment/decrement only at this point. |
2271 if (!this._isEditingName && this._handleUpOrDownValue(event)) | 2269 if (!this._isEditingName && this._handleUpOrDownValue(event)) |
2272 return true; | 2270 return true; |
2273 | 2271 |
2274 return false; | 2272 return false; |
2275 }, | 2273 }, |
2276 | 2274 |
2277 _handleUpOrDownValue: function(event) | 2275 _handleUpOrDownValue: function(event) |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2346 var prefix = wordRange.toString().toLowerCase(); | 2344 var prefix = wordRange.toString().toLowerCase(); |
2347 if (!prefix && !force) | 2345 if (!prefix && !force) |
2348 return; | 2346 return; |
2349 | 2347 |
2350 var results = this._cssCompletions.startsWith(prefix); | 2348 var results = this._cssCompletions.startsWith(prefix); |
2351 completionsReadyCallback(results); | 2349 completionsReadyCallback(results); |
2352 } | 2350 } |
2353 } | 2351 } |
2354 | 2352 |
2355 WebInspector.StylesSidebarPane.CSSPropertyPrompt.prototype.__proto__ = WebInspec
tor.TextPrompt.prototype; | 2353 WebInspector.StylesSidebarPane.CSSPropertyPrompt.prototype.__proto__ = WebInspec
tor.TextPrompt.prototype; |
OLD | NEW |