зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1446913 - document and fix event object usage, r=felipe
This commit is contained in:
Родитель
6785fbc950
Коммит
cfe18d0c3e
|
@ -6127,6 +6127,11 @@ function handleLinkClick(event, href, linkNode) {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles paste on middle mouse clicks.
|
||||
*
|
||||
* @param event {Event | Object} Event or JSON object.
|
||||
*/
|
||||
function middleMousePaste(event) {
|
||||
let clipboard = readFromClipboard();
|
||||
if (!clipboard)
|
||||
|
@ -6170,7 +6175,9 @@ function middleMousePaste(event) {
|
|||
}
|
||||
});
|
||||
|
||||
event.stopPropagation();
|
||||
if (event instanceof Event) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
}
|
||||
|
||||
function stripUnsafeProtocolOnPaste(pasteData) {
|
||||
|
|
|
@ -83,10 +83,20 @@ function doGetProtocolFlags(aURI) {
|
|||
handler.protocolFlags;
|
||||
}
|
||||
|
||||
/* openUILink handles clicks on UI elements that cause URLs to load.
|
||||
/**
|
||||
* openUILink handles clicks on UI elements that cause URLs to load.
|
||||
*
|
||||
* As the third argument, you may pass an object with the same properties as
|
||||
* accepted by openUILinkIn, plus "ignoreButton" and "ignoreAlt".
|
||||
*
|
||||
* @param url {string}
|
||||
* @param event {Event | Object} Event or JSON object representing an Event
|
||||
* @param {Boolean | Object} aIgnoreButton
|
||||
* @param {Boolean} aIgnoreButton
|
||||
* @param {Boolean} aIgnoreAlt
|
||||
* @param {Boolean} aAllowThirdPartyFixup
|
||||
* @param {Object} aPostData
|
||||
* @param {nsIURI} aReferrerURI
|
||||
*/
|
||||
function openUILink(url, event, aIgnoreButton, aIgnoreAlt, aAllowThirdPartyFixup,
|
||||
aPostData, aReferrerURI) {
|
||||
|
@ -115,7 +125,8 @@ function openUILink(url, event, aIgnoreButton, aIgnoreAlt, aAllowThirdPartyFixup
|
|||
}
|
||||
|
||||
|
||||
/* whereToOpenLink() looks at an event to decide where to open a link.
|
||||
/**
|
||||
* whereToOpenLink() looks at an event to decide where to open a link.
|
||||
*
|
||||
* The event may be a mouse event (click, double-click, middle-click) or keypress event (enter).
|
||||
*
|
||||
|
@ -133,6 +144,11 @@ function openUILink(url, event, aIgnoreButton, aIgnoreAlt, aAllowThirdPartyFixup
|
|||
* - Alt is hard to use in context menus, because pressing Alt closes the menu.
|
||||
* - Alt can't be used on the bookmarks toolbar because Alt is used for "treat this as something draggable".
|
||||
* - The button is ignored for the middle-click-paste-URL feature, since it's always a middle-click.
|
||||
*
|
||||
* @param e {Event|Object} Event or JSON Object
|
||||
* @param ignoreButton {Boolean}
|
||||
* @param ignoreAlt {Boolean}
|
||||
* @returns {"current" | "tabshifted" | "tab" | "save" | "window"}
|
||||
*/
|
||||
function whereToOpenLink(e, ignoreButton, ignoreAlt) {
|
||||
// This method must treat a null event like a left click without modifier keys (i.e.
|
||||
|
|
|
@ -25,6 +25,12 @@ var ContentClick = {
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Handles clicks in the content area.
|
||||
*
|
||||
* @param json {Object} JSON object that looks like an Event
|
||||
* @param browser {Element<browser>}
|
||||
*/
|
||||
contentAreaClick(json, browser) {
|
||||
// This is heavily based on contentAreaClick from browser.js (Bug 903016)
|
||||
// The json is set up in a way to look like an Event.
|
||||
|
|
Загрузка…
Ссылка в новой задаче