Bug 788431 - Ctrl-C in the Rule View and the Property view doesn't work. r=paul

This commit is contained in:
Michael Ratcliffe 2012-12-18 14:27:04 +00:00
parent fceb034334
commit 3a740f52c0
2 changed files with 16 additions and 0 deletions

View File

@ -133,6 +133,7 @@ this.CssHtmlTree = function CssHtmlTree(aStyleInspector)
this.getRTLAttr = chromeReg.isLocaleRTL("global") ? "rtl" : "ltr";
// Create bound methods.
this.siFocusWindow = this.focusWindow.bind(this);
this.siBoundMenuUpdate = this.computedViewMenuUpdate.bind(this);
this.siBoundCopy = this.computedViewCopy.bind(this);
this.siBoundCopyDeclaration = this.computedViewCopyDeclaration.bind(this);
@ -140,6 +141,7 @@ this.CssHtmlTree = function CssHtmlTree(aStyleInspector)
this.siBoundCopyPropertyValue = this.computedViewCopyPropertyValue.bind(this);
this.styleDocument.addEventListener("copy", this.siBoundCopy);
this.styleDocument.addEventListener("mousedown", this.siFocusWindow);
// Nodes used in templating
this.root = this.styleDocument.getElementById("root");
@ -557,6 +559,17 @@ CssHtmlTree.prototype = {
menuitem.disabled = disablePropertyItems;
},
/**
* Focus the window on mousedown.
*
* @param aEvent The event object
*/
focusWindow: function si_focusWindow(aEvent)
{
let win = this.styleDocument.defaultView;
win.focus();
},
/**
* Copy selected text.
*
@ -704,6 +717,7 @@ CssHtmlTree.prototype = {
// Remove bound listeners
this.styleDocument.removeEventListener("copy", this.siBoundCopy);
this.styleDocument.removeEventListener("mousedown", this.siFocusWindow);
// Nodes used in templating
delete this.root;

View File

@ -1402,6 +1402,8 @@ RuleEditor.prototype = {
}.bind(this), false);
this.element.addEventListener("mousedown", function() {
this.doc.defaultView.focus();
let editorNodes =
this.doc.querySelectorAll(".styleinspector-propertyeditor");