| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 199 |
| 200 this._revertElement = createElement("span"); | 200 this._revertElement = createElement("span"); |
| 201 this._revertElement.className = "revision-history-link"; | 201 this._revertElement.className = "revision-history-link"; |
| 202 this._revertElement.textContent = WebInspector.UIString("apply revision cont
ent"); | 202 this._revertElement.textContent = WebInspector.UIString("apply revision cont
ent"); |
| 203 this._revertElement.addEventListener("click", event => {this._revision.rever
tToThis();}, false); | 203 this._revertElement.addEventListener("click", event => {this._revision.rever
tToThis();}, false); |
| 204 if (!allowRevert) | 204 if (!allowRevert) |
| 205 this._revertElement.classList.add("hidden"); | 205 this._revertElement.classList.add("hidden"); |
| 206 }; | 206 }; |
| 207 | 207 |
| 208 WebInspector.RevisionHistoryTreeElement.prototype = { | 208 WebInspector.RevisionHistoryTreeElement.prototype = { |
| 209 /** |
| 210 * @override |
| 211 */ |
| 209 onattach: function() | 212 onattach: function() |
| 210 { | 213 { |
| 211 this.listItemElement.classList.add("revision-history-revision"); | 214 this.listItemElement.classList.add("revision-history-revision"); |
| 212 }, | 215 }, |
| 213 | 216 |
| 217 /** |
| 218 * @override |
| 219 */ |
| 214 onpopulate: function() | 220 onpopulate: function() |
| 215 { | 221 { |
| 216 this.listItemElement.appendChild(this._revertElement); | 222 this.listItemElement.appendChild(this._revertElement); |
| 217 | 223 |
| 218 this.childrenListElement.classList.add("source-code"); | 224 this.childrenListElement.classList.add("source-code"); |
| 219 Promise.all([ | 225 Promise.all([ |
| 220 this._baseRevision ? this._baseRevision.requestContent() : this._rev
ision.uiSourceCode.requestOriginalContent(), | 226 this._baseRevision ? this._baseRevision.requestContent() : this._rev
ision.uiSourceCode.requestOriginalContent(), |
| 221 this._revision.requestContent() | 227 this._revision.requestContent() |
| 222 ]).spread(diff.bind(this)); | 228 ]).spread(diff.bind(this)); |
| 223 | 229 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 252 } else if (code === WebInspector.Diff.Operation.Insert) { | 258 } else if (code === WebInspector.Diff.Operation.Insert) { |
| 253 lastWasSeparator = false; | 259 lastWasSeparator = false; |
| 254 for (var i = 0; i < rowCount; ++i) | 260 for (var i = 0; i < rowCount; ++i) |
| 255 this._createLine(null, newLineNumber + i, newLines[newLi
neNumber + i], "added"); | 261 this._createLine(null, newLineNumber + i, newLines[newLi
neNumber + i], "added"); |
| 256 newLineNumber += rowCount; | 262 newLineNumber += rowCount; |
| 257 } | 263 } |
| 258 } | 264 } |
| 259 } | 265 } |
| 260 }, | 266 }, |
| 261 | 267 |
| 268 /** |
| 269 * @override |
| 270 */ |
| 262 oncollapse: function() | 271 oncollapse: function() |
| 263 { | 272 { |
| 264 this._revertElement.remove(); | 273 this._revertElement.remove(); |
| 265 }, | 274 }, |
| 266 | 275 |
| 267 /** | 276 /** |
| 268 * @param {?number} baseLineNumber | 277 * @param {?number} baseLineNumber |
| 269 * @param {?number} newLineNumber | 278 * @param {?number} newLineNumber |
| 270 * @param {string} lineContent | 279 * @param {string} lineContent |
| 271 * @param {string} changeType | 280 * @param {string} changeType |
| (...skipping 23 matching lines...) Expand all Loading... |
| 295 contentSpan.classList.add("revision-history-line-" + changeType); | 304 contentSpan.classList.add("revision-history-line-" + changeType); |
| 296 }, | 305 }, |
| 297 | 306 |
| 298 allowRevert: function() | 307 allowRevert: function() |
| 299 { | 308 { |
| 300 this._revertElement.classList.remove("hidden"); | 309 this._revertElement.classList.remove("hidden"); |
| 301 }, | 310 }, |
| 302 | 311 |
| 303 __proto__: TreeElement.prototype | 312 __proto__: TreeElement.prototype |
| 304 }; | 313 }; |
| OLD | NEW |