B2G/gecko/browser/base/content/browser.js
/**
 * Called whenever the user clicks in the content area.
 *
 * @param event
 *        The click event.
 * @param isPanelClick
 *        Whether the event comes from a web panel.
 * @note default event is prevented if the click is handled.
 */
Called whenever the user clicks in the content area.
@param event
The click event.
@param isPanelClick
Whether the event comes from a web panel.
@note default event is prevented if the click is handled.
Called whenever the user clicks in the content area . @param event The click event . @param isPanelClick Whether the event comes from a web panel . @note default event is prevented if the click is handled .
function contentAreaClick(event, isPanelClick)
{
  if (!event.isTrusted || event.defaultPrevented || event.button == 2)
    return;
  let [href, linkNode] = hrefAndLinkNodeForClickEvent(event);
  if (!href) {
    if (event.button == 1 &&
        gPrefService.getBoolPref("middlemouse.contentLoadURL") &&
        !gPrefService.getBoolPref("general.autoScroll")) {
      middleMousePaste(event);
      event.preventDefault();
    }
    return;
  }
  if (linkNode && event.button == 0 &&
      !event.ctrlKey && !event.shiftKey && !event.altKey && !event.metaKey) {
    let target = linkNode.target;
    let mainTarget = !target || target == "_content" || target  == "_main";
    if (isPanelClick && mainTarget) {
      if (linkNode.getAttribute("onclick") ||
          href.substr(0, 11) === "javascript:" ||
          href.substr(0, 5) === "data:")
        return;
      try {
        urlSecurityCheck(href, linkNode.ownerDocument.nodePrincipal);
      }
      catch(ex) {
        event.preventDefault();
        return;
      }
      let postData = {};
      let url = getShortcutOrURI(href, postData);
      if (!url)
        return;
      loadURI(url, null, postData.value, false);
      event.preventDefault();
      return;
    }
    if (linkNode.getAttribute("rel") == "sidebar") {
      PlacesUIUtils.showBookmarkDialog({ action: "add"
                                       , type: "bookmark"
                                       , uri: makeURI(href)
                                       , title: linkNode.getAttribute("title")
                                       , loadBookmarkInSidebar: true
                                       , hiddenRows: [ "description"
                                                     , "location"
                                                     , "keyword" ]
                                       }, window);
      event.preventDefault();
      return;
    }
  }
  handleLinkClick(event, href, linkNode);
  try {
    PlacesUIUtils.markPageAsFollowedLink(href);
  } catch (ex) {  }
}
function contentAreaClick ( event , isPanelClick ) { if ( ! event . isTrusted || event . defaultPrevented || event . button == 2 ) return ; let [ href , linkNode ] = hrefAndLinkNodeForClickEvent ( event ) ; if ( ! href ) { if ( event . button == 1 && gPrefService . getBoolPref ( "middlemouse.contentLoadURL" ) && ! gPrefService . getBoolPref ( "general.autoScroll" ) ) { middleMousePaste ( event ) ; event . preventDefault ( ) ; } return ; } if ( linkNode && event . button == 0 && ! event . ctrlKey && ! event . shiftKey && ! event . altKey && ! event . metaKey ) { let target = linkNode . target ; let mainTarget = ! target || target == "_content" || target == "_main" ; if ( isPanelClick && mainTarget ) { if ( linkNode . getAttribute ( "onclick" ) || href . substr ( 0 , 11 ) === "javascript:" || href . substr ( 0 , 5 ) === "data:" ) return ; try { urlSecurityCheck ( href , linkNode . ownerDocument . nodePrincipal ) ; } catch ( ex ) { event . preventDefault ( ) ; return ; } let postData = { } ; let url = getShortcutOrURI ( href , postData ) ; if ( ! url ) return ; loadURI ( url , null , postData . value , false ) ; event . preventDefault ( ) ; return ; } if ( linkNode . getAttribute ( "rel" ) == "sidebar" ) { PlacesUIUtils . showBookmarkDialog ( { action : "add" , type : "bookmark" , uri : makeURI ( href ) , title : linkNode . getAttribute ( "title" ) , loadBookmarkInSidebar : true , hiddenRows : [ "description" , "location" , "keyword" ] } , window ) ; event . preventDefault ( ) ; return ; } } handleLinkClick ( event , href , linkNode ) ; try { PlacesUIUtils . markPageAsFollowedLink ( href ) ; } catch ( ex ) { } }
Called whenever the user clicks in the content area.
Called whenever the user clicks in the content area .
// Not a link, handle middle mouse navigation. // This code only applies if we have a linkNode (i.e. clicks on real anchor // elements, as opposed to XLink). // A Web panel's links should target the main content area.  Do this // if no modifier keys are down and if there's no target or the target // equals _main (the IE convention) or _content (the Mozilla convention). // javascript and data links should be executed in the current browser. // Prevent loading unsecure destinations. // This is the Opera convention for a special link that, when clicked, // allows to add a sidebar panel.  The link's title attribute contains // the title that should be used for the sidebar panel. // Mark the page as a user followed link.  This is done so that history can // distinguish automatic embed visits from user activated ones.  For example // pages loaded in frames are embed visits and lost with the session, while // visits across frames should be preserved. /* Skip invalid URIs. */