OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 var context = { box: box, styleProperty: styleProperty, computedStyle: c
omputedStyle }; | 334 var context = { box: box, styleProperty: styleProperty, computedStyle: c
omputedStyle }; |
335 var boundKeyDown = this._handleKeyDown.bind(this, context, styleProperty
); | 335 var boundKeyDown = this._handleKeyDown.bind(this, context, styleProperty
); |
336 context.keyDownHandler = boundKeyDown; | 336 context.keyDownHandler = boundKeyDown; |
337 targetElement.addEventListener("keydown", boundKeyDown, false); | 337 targetElement.addEventListener("keydown", boundKeyDown, false); |
338 | 338 |
339 this._isEditingMetrics = true; | 339 this._isEditingMetrics = true; |
340 | 340 |
341 var config = new WebInspector.InplaceEditor.Config(this.editingCommitted
.bind(this), this.editingCancelled.bind(this), context); | 341 var config = new WebInspector.InplaceEditor.Config(this.editingCommitted
.bind(this), this.editingCancelled.bind(this), context); |
342 WebInspector.InplaceEditor.startEditing(targetElement, config); | 342 WebInspector.InplaceEditor.startEditing(targetElement, config); |
343 | 343 |
344 window.getSelection().setBaseAndExtent(targetElement, 0, targetElement,
1); | 344 targetElement.window().getSelection().setBaseAndExtent(targetElement, 0,
targetElement, 1); |
345 }, | 345 }, |
346 | 346 |
347 _handleKeyDown: function(context, styleProperty, event) | 347 _handleKeyDown: function(context, styleProperty, event) |
348 { | 348 { |
349 var element = event.currentTarget; | 349 var element = event.currentTarget; |
350 | 350 |
351 /** | 351 /** |
352 * @param {string} originalValue | 352 * @param {string} originalValue |
353 * @param {string} replacementString | 353 * @param {string} replacementString |
354 * @this {WebInspector.MetricsSidebarPane} | 354 * @this {WebInspector.MetricsSidebarPane} |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 }, | 475 }, |
476 | 476 |
477 editingCommitted: function(element, userInput, previousContent, context) | 477 editingCommitted: function(element, userInput, previousContent, context) |
478 { | 478 { |
479 this.editingEnded(element, context); | 479 this.editingEnded(element, context); |
480 this._applyUserInput(element, userInput, previousContent, context, true)
; | 480 this._applyUserInput(element, userInput, previousContent, context, true)
; |
481 }, | 481 }, |
482 | 482 |
483 __proto__: WebInspector.ElementsSidebarPane.prototype | 483 __proto__: WebInspector.ElementsSidebarPane.prototype |
484 } | 484 } |
OLD | NEW |