OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 var token = this.textEditor.tokenAtTextPosition(selection.startLine, sel
ection.startColumn); | 77 var token = this.textEditor.tokenAtTextPosition(selection.startLine, sel
ection.startColumn); |
78 if (!token) { | 78 if (!token) { |
79 if (selection.startColumn > 0) | 79 if (selection.startColumn > 0) |
80 token = this.textEditor.tokenAtTextPosition(selection.startLine,
selection.startColumn - 1); | 80 token = this.textEditor.tokenAtTextPosition(selection.startLine,
selection.startColumn - 1); |
81 if (!token) | 81 if (!token) |
82 return false; | 82 return false; |
83 } | 83 } |
84 if (token.type !== "css-number") | 84 if (token.type !== "css-number") |
85 return false; | 85 return false; |
86 | 86 |
87 var cssUnitRange = new WebInspector.TextRange(selection.startLine, token
.startColumn, selection.startLine, token.endColumn + 1); | 87 var cssUnitRange = new WebInspector.TextRange(selection.startLine, token
.startColumn, selection.startLine, token.endColumn); |
88 var cssUnitText = this.textEditor.copyRange(cssUnitRange); | 88 var cssUnitText = this.textEditor.copyRange(cssUnitRange); |
89 var newUnitText = this._modifyUnit(cssUnitText, change); | 89 var newUnitText = this._modifyUnit(cssUnitText, change); |
90 if (!newUnitText) | 90 if (!newUnitText) |
91 return false; | 91 return false; |
92 this.textEditor.editRange(cssUnitRange, newUnitText); | 92 this.textEditor.editRange(cssUnitRange, newUnitText); |
93 selection.startColumn = token.startColumn; | 93 selection.startColumn = token.startColumn; |
94 selection.endColumn = selection.startColumn + newUnitText.length; | 94 selection.endColumn = selection.startColumn + newUnitText.length; |
95 this.textEditor.setSelection(selection); | 95 this.textEditor.setSelection(selection); |
96 return true; | 96 return true; |
97 }, | 97 }, |
98 | 98 |
99 __proto__: WebInspector.UISourceCodeFrame.prototype | 99 __proto__: WebInspector.UISourceCodeFrame.prototype |
100 } | 100 } |
OLD | NEW |