Bug 638479 - No Copy/paste of content in certain input field types in prefs [r=mbrubeck,a=approval2.0+]
authorVivien Nicolas <21@vingtetun.org>
Tue, 08 Mar 2011 21:44:04 +0100
changeset 67482 6c948b73221a95014627a784b09d55973e6cc933
parent 67481 4e328fade26174302dd3ed6a3c434ee0732f990e
child 67483 36be7ad4c720bae2435d7ecd90e4ea973bfc5d8b
push idunknown
push userunknown
push dateunknown
reviewersmbrubeck, approval2.0
bugs638479
Bug 638479 - No Copy/paste of content in certain input field types in prefs [r=mbrubeck,a=approval2.0+]
mobile/chrome/content/BookmarkHelper.js
mobile/chrome/content/input.js
--- a/mobile/chrome/content/BookmarkHelper.js
+++ b/mobile/chrome/content/BookmarkHelper.js
@@ -10,59 +10,63 @@ var BookmarkHelper = {
   edit: function BH_edit(aURI) {
     if (!aURI)
       aURI = getBrowser().currentURI;
 
     let itemId = PlacesUtils.getMostRecentBookmarkForURI(aURI);
     if (itemId == -1)
       return;
 
+    // When opening the bookmark helper dialog be sure there is not others
+    // popup opened like the bookmakr popup
+    BookmarkPopup.hide();
+
     let title = PlacesUtils.bookmarks.getItemTitle(itemId);
     let tags = PlacesUtils.tagging.getTagsForURI(aURI, {});
 
     const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
     this._editor = document.createElementNS(XULNS, "placeitem");
     this._editor.setAttribute("id", "bookmark-item");
     this._editor.setAttribute("flex", "1");
     this._editor.setAttribute("type", "bookmark");
     this._editor.setAttribute("ui", "manage");
     this._editor.setAttribute("title", title);
     this._editor.setAttribute("uri", aURI.spec);
     this._editor.setAttribute("itemid", itemId);
     this._editor.setAttribute("tags", tags.join(", "));
-    this._editor.setAttribute("onclose", "BookmarkHelper.hide()");
+    this._editor.setAttribute("onclose", "BookmarkHelper.close()");
     document.getElementById("bookmark-form").appendChild(this._editor);
 
     this.box.hidden = false;
-    BrowserUI.pushPopup(this, this.box);
+    BrowserUI.pushDialog(this);
 
     function waitForWidget(self) {
       try {
         self._editor.startEditing();
       } catch(e) {
         setTimeout(waitForWidget, 0, self);
       }
     }
     setTimeout(waitForWidget, 0, this);
   },
 
   save: function BH_save() {
     this._editor.stopEditing(true);
   },
 
-  hide: function BH_hide() {
+  close: function BH_close() {
     BrowserUI.updateStar();
 
     // Note: the _editor will have already saved the data, if needed, by the time
     // this method is called, since this method is called via the "close" event.
     this._editor.parentNode.removeChild(this._editor);
     this._editor = null;
 
+    BrowserUI.popDialog();
     this.box.hidden = true;
-    BrowserUI.popPopup(this);
   },
 
   removeBookmarksForURI: function BH_removeBookmarksForURI(aURI) {
     //XXX blargle xpconnect! might not matter, but a method on
     // nsINavBookmarksService that takes an array of items to
     // delete would be faster. better yet, a method that takes a URI!
     let itemIds = PlacesUtils.getBookmarksForURI(aURI);
     itemIds.forEach(PlacesUtils.bookmarks.removeItem);
--- a/mobile/chrome/content/input.js
+++ b/mobile/chrome/content/input.js
@@ -467,30 +467,30 @@ MouseModule.prototype = {
     if (dx*dx + dy*dy < radius*radius) {
       this._dispatchTap("TapDouble", mouseUp1);
     } else {
       this._dispatchTap("TapSingle", mouseUp1);
       this._dispatchTap("TapSingle", mouseUp2);
     }
   },
 
-  _dispatchTap: function _dispatchTap(aType, aMouseUpEvent) {
+  _dispatchTap: function _dispatchTap(aType, aMouseEvent) {
     // borrowed from nsIDOMNSEvent.idl
     let modifiers =
-      (aMouseUpEvent.altKey   ? Ci.nsIDOMNSEvent.ALT_MASK     : 0) |
-      (aMouseUpEvent.ctrlKey  ? Ci.nsIDOMNSEvent.CONTROL_MASK : 0) |
-      (aMouseUpEvent.shiftKey ? Ci.nsIDOMNSEvent.SHIFT_MASK   : 0) |
-      (aMouseUpEvent.metaKey  ? Ci.nsIDOMNSEvent.META_MASK    : 0);
+      (aMouseEvent.altKey   ? Ci.nsIDOMNSEvent.ALT_MASK     : 0) |
+      (aMouseEvent.ctrlKey  ? Ci.nsIDOMNSEvent.CONTROL_MASK : 0) |
+      (aMouseEvent.shiftKey ? Ci.nsIDOMNSEvent.SHIFT_MASK   : 0) |
+      (aMouseEvent.metaKey  ? Ci.nsIDOMNSEvent.META_MASK    : 0);
 
     let event = document.createEvent("Events");
     event.initEvent(aType, true, false);
-    event.clientX = aMouseUpEvent.clientX;
-    event.clientY = aMouseUpEvent.clientY;
+    event.clientX = aMouseEvent.clientX;
+    event.clientY = aMouseEvent.clientY;
     event.modifiers = modifiers;
-    aMouseUpEvent.target.dispatchEvent(event);
+    aMouseEvent.originalTarget.dispatchEvent(event);
   },
 
   /**
    * Record a mousedown/mouseup event for later redispatch via
    * _redispatchDownUpEvents()
    */
   _recordEvent: function _recordEvent(aEvent) {
     this._downUpEvents.push(aEvent);