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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 if (this.startLine < other.startLine) | 147 if (this.startLine < other.startLine) |
148 return -1; | 148 return -1; |
149 if (this.startColumn > other.startColumn) | 149 if (this.startColumn > other.startColumn) |
150 return 1; | 150 return 1; |
151 if (this.startColumn < other.startColumn) | 151 if (this.startColumn < other.startColumn) |
152 return -1; | 152 return -1; |
153 return 0; | 153 return 0; |
154 }, | 154 }, |
155 | 155 |
156 /** | 156 /** |
| 157 * @param {!WebInspector.TextRange} other |
| 158 * @return {boolean} |
| 159 */ |
| 160 equal: function(other) |
| 161 { |
| 162 return this.startLine === other.startLine && this.endLine === other.endL
ine && |
| 163 this.startColumn === other.startColumn && this.endColumn === other.e
ndColumn; |
| 164 }, |
| 165 |
| 166 /** |
157 * @param {number} lineOffset | 167 * @param {number} lineOffset |
158 * @return {!WebInspector.TextRange} | 168 * @return {!WebInspector.TextRange} |
159 */ | 169 */ |
160 shift: function(lineOffset) | 170 shift: function(lineOffset) |
161 { | 171 { |
162 return new WebInspector.TextRange(this.startLine + lineOffset, this.star
tColumn, this.endLine + lineOffset, this.endColumn); | 172 return new WebInspector.TextRange(this.startLine + lineOffset, this.star
tColumn, this.endLine + lineOffset, this.endColumn); |
163 }, | 173 }, |
164 | 174 |
165 /** | 175 /** |
166 * @return {string} | 176 * @return {string} |
167 */ | 177 */ |
168 toString: function() | 178 toString: function() |
169 { | 179 { |
170 return JSON.stringify(this); | 180 return JSON.stringify(this); |
171 } | 181 } |
172 } | 182 } |
173 | 183 |
174 /** | 184 /** |
175 * @constructor | 185 * @constructor |
176 * @param {number} offset | 186 * @param {number} offset |
177 * @param {number} length | 187 * @param {number} length |
178 */ | 188 */ |
179 WebInspector.SourceRange = function(offset, length) | 189 WebInspector.SourceRange = function(offset, length) |
180 { | 190 { |
181 this.offset = offset; | 191 this.offset = offset; |
182 this.length = length; | 192 this.length = length; |
183 } | 193 } |
OLD | NEW |