Back to index

lightning-sunbird  0.9+nobinonly
Defines | Enumerations | Functions | Variables
nsEventStateManager.cpp File Reference
#include "nsCOMPtr.h"
#include "nsEventStateManager.h"
#include "nsEventListenerManager.h"
#include "nsIContent.h"
#include "nsINodeInfo.h"
#include "nsIDocument.h"
#include "nsIFrame.h"
#include "nsIWidget.h"
#include "nsPresContext.h"
#include "nsIPresShell.h"
#include "nsDOMEvent.h"
#include "nsHTMLAtoms.h"
#include "nsIEditorDocShell.h"
#include "nsIFormControl.h"
#include "nsIComboboxControlFrame.h"
#include "nsIDOMHTMLAnchorElement.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMNSHTMLInputElement.h"
#include "nsIDOMHTMLSelectElement.h"
#include "nsIDOMHTMLTextAreaElement.h"
#include "nsIDOMHTMLAreaElement.h"
#include "nsIDOMHTMLButtonElement.h"
#include "nsIDOMHTMLObjectElement.h"
#include "nsIDOMHTMLImageElement.h"
#include "nsIDOMHTMLMapElement.h"
#include "nsIDOMHTMLBodyElement.h"
#include "nsIDOMXULControlElement.h"
#include "nsImageMapUtils.h"
#include "nsIHTMLDocument.h"
#include "nsINameSpaceManager.h"
#include "nsIBaseWindow.h"
#include "nsIScrollableView.h"
#include "nsISelection.h"
#include "nsIFrameSelection.h"
#include "nsIDeviceContext.h"
#include "nsIScriptGlobalObject.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIDOMWindowInternal.h"
#include "nsPIDOMWindow.h"
#include "nsIDOMEventTarget.h"
#include "nsIEnumerator.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeNode.h"
#include "nsIWebNavigation.h"
#include "nsIContentViewer.h"
#include "nsIPrefBranch2.h"
#include "nsIServiceManager.h"
#include "nsIScriptSecurityManager.h"
#include "nsIChromeEventHandler.h"
#include "nsIFocusController.h"
#include "nsXULAtoms.h"
#include "nsIDOMXULElement.h"
#include "nsIDOMDocument.h"
#include "nsIDOMKeyEvent.h"
#include "nsIObserverService.h"
#include "nsIDocShell.h"
#include "nsIMarkupDocumentViewer.h"
#include "nsIScrollableViewProvider.h"
#include "nsIDOMDocumentRange.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIDOMMouseEvent.h"
#include "nsIDOMDocumentView.h"
#include "nsIDOMAbstractView.h"
#include "nsIDOMNSUIEvent.h"
#include "nsIDOMRange.h"
#include "nsICaret.h"
#include "nsILookAndFeel.h"
#include "nsWidgetsCID.h"
#include "nsIFrameFrame.h"
#include "nsIFrameTraversal.h"
#include "nsLayoutAtoms.h"
#include "nsLayoutCID.h"
#include "nsLayoutUtils.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsUnicharUtils.h"
#include "nsContentUtils.h"
#include "imgIContainer.h"
#include "nsIProperties.h"
#include "nsISupportsPrimitives.h"

Go to the source code of this file.

Defines

#define NON_KEYBINDING   0
#define NS_MODIFIER_SHIFT   1
#define NS_MODIFIER_CONTROL   2
#define NS_MODIFIER_ALT   4
#define NS_MODIFIER_META   8

Enumerations

enum  nsTextfieldSelectModel { eTextfieldSelect_unset = -1, eTextfieldSelect_manual = 0, eTextfieldSelect_auto = 1 }
enum  {
  MOUSE_SCROLL_N_LINES, MOUSE_SCROLL_PAGE, MOUSE_SCROLL_HISTORY, MOUSE_SCROLL_TEXTSIZE,
  MOUSE_SCROLL_PIXELS
}

Functions

static NS_DEFINE_CID (kFrameTraversalCID, NS_FRAMETRAVERSAL_CID)
static NS_DEFINE_CID (kLookAndFeelCID, NS_LOOKANDFEEL_CID)
static nsIScriptGlobalObjectGetDocumentOuterWindow (nsIDocument *aDocument)
static nsIDocumentGetDocumentFromWindow (nsIDOMWindow *aWindow)
static PRInt32 GetAccessModifierMaskFromPref (PRInt32 aItemType)
void SetFrameExternalReference (nsIFrame *aFrame)
static PRInt32 GetAccessModifierMask (nsISupports *aDocShell)
PRBool ShouldScrollRootView (nsPresContext *aPresContext)
static nsIContentFindCommonAncestor (nsIContent *aNode1, nsIContent *aNode2)

Variables

nsIContentgLastFocusedContent = 0
nsIDocumentgLastFocusedDocument = 0
nsPresContextgLastFocusedPresContext = 0
static PRInt8 sTextfieldSelectModel = eTextfieldSelect_unset
static PRBool sLeftClickOnly = PR_TRUE
static PRBool sKeyCausesActivation = PR_TRUE
static PRUint32 sESMInstanceCount = 0
static PRInt32 sChromeAccessModifier = 0
static PRInt32 sContentAccessModifier = 0

Define Documentation

Definition at line 142 of file nsEventStateManager.cpp.

Definition at line 176 of file nsEventStateManager.cpp.

Definition at line 175 of file nsEventStateManager.cpp.

Definition at line 177 of file nsEventStateManager.cpp.

Definition at line 174 of file nsEventStateManager.cpp.


Enumeration Type Documentation

anonymous enum
Enumerator:
MOUSE_SCROLL_N_LINES 
MOUSE_SCROLL_PAGE 
MOUSE_SCROLL_HISTORY 
MOUSE_SCROLL_TEXTSIZE 
MOUSE_SCROLL_PIXELS 

Definition at line 165 of file nsEventStateManager.cpp.

Enumerator:
eTextfieldSelect_unset 
eTextfieldSelect_manual 
eTextfieldSelect_auto 

Definition at line 150 of file nsEventStateManager.cpp.

                            {
  eTextfieldSelect_unset = -1,
  eTextfieldSelect_manual = 0,
  eTextfieldSelect_auto = 1   // select textfields when focused with keyboard
};

Function Documentation

static nsIContent* FindCommonAncestor ( nsIContent aNode1,
nsIContent aNode2 
) [static]

Definition at line 3956 of file nsEventStateManager.cpp.

{
  // Find closest common ancestor
  if (aNode1 && aNode2) {
    // Find the nearest common ancestor by counting the distance to the
    // root and then walking up again, in pairs.
    PRInt32 offset = 0;
    nsIContent *anc1 = aNode1;
    for (;;) {
      ++offset;
      nsIContent* parent = anc1->GetParent();
      if (!parent)
        break;
      anc1 = parent;
    }
    nsIContent *anc2 = aNode2;
    for (;;) {
      --offset;
      nsIContent* parent = anc2->GetParent();
      if (!parent)
        break;
      anc2 = parent;
    }
    if (anc1 == anc2) {
      anc1 = aNode1;
      anc2 = aNode2;
      while (offset > 0) {
        anc1 = anc1->GetParent();
        --offset;
      }
      while (offset < 0) {
        anc2 = anc2->GetParent();
        ++offset;
      }
      while (anc1 != anc2) {
        anc1 = anc1->GetParent();
        anc2 = anc2->GetParent();
      }
      return anc1;
    }
  }
  return nsnull;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRInt32 GetAccessModifierMask ( nsISupports *  aDocShell) [static]

Definition at line 1025 of file nsEventStateManager.cpp.

{
  nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(aDocShell));
  if (!treeItem)
    return -1; // invalid modifier

  PRInt32 itemType;
  treeItem->GetItemType(&itemType);
  switch (itemType) {

  case nsIDocShellTreeItem::typeChrome:
    return sChromeAccessModifier;

  case nsIDocShellTreeItem::typeContent:
    return sContentAccessModifier;

  default:
    return -1; // invalid modifier
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRInt32 GetAccessModifierMaskFromPref ( PRInt32  aItemType) [static]

Definition at line 214 of file nsEventStateManager.cpp.

{
  PRInt32 accessKey = nsContentUtils::GetIntPref("ui.key.generalAccessKey", -1);
  switch (accessKey) {
    case -1:                             break; // use the individual prefs
    case nsIDOMKeyEvent::DOM_VK_SHIFT:   return NS_MODIFIER_SHIFT;
    case nsIDOMKeyEvent::DOM_VK_CONTROL: return NS_MODIFIER_CONTROL;
    case nsIDOMKeyEvent::DOM_VK_ALT:     return NS_MODIFIER_ALT;
    case nsIDOMKeyEvent::DOM_VK_META:    return NS_MODIFIER_META;
    default:                             return 0;
  }

  switch (aItemType) {
  case nsIDocShellTreeItem::typeChrome:
    return nsContentUtils::GetIntPref("ui.key.chromeAccess", 0);
  case nsIDocShellTreeItem::typeContent:
    return nsContentUtils::GetIntPref("ui.key.contentAccess", 0);
  default:
    return 0;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static nsIDocument* GetDocumentFromWindow ( nsIDOMWindow aWindow) [static]

Definition at line 200 of file nsEventStateManager.cpp.

{
  nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(aWindow);
  nsPIDOMWindow *innerWin;
  nsCOMPtr<nsIDocument> doc;

  if (win) {
    doc = do_QueryInterface(win->GetExtantDocument());
  }

  return doc;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static nsIScriptGlobalObject* GetDocumentOuterWindow ( nsIDocument aDocument) [static]

Definition at line 180 of file nsEventStateManager.cpp.

{
  if (aDocument) {
    nsIScriptGlobalObject *sgo = aDocument->GetScriptGlobalObject();
    nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(sgo);

    if (win) {
      nsCOMPtr<nsIScriptGlobalObject> outersgo =
        do_QueryInterface(win->GetOuterWindow());

      return outersgo;
    }

    return sgo;
  }

  return nsnull;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static NS_DEFINE_CID ( kFrameTraversalCID  ,
NS_FRAMETRAVERSAL_CID   
) [static]
static NS_DEFINE_CID ( kLookAndFeelCID  ,
NS_LOOKANDFEEL_CID   
) [static]
void SetFrameExternalReference ( nsIFrame aFrame) [inline]

Definition at line 462 of file nsEventStateManager.cpp.

Here is the caller graph for this function:

PRBool ShouldScrollRootView ( nsPresContext aPresContext) [inline]

Definition at line 1783 of file nsEventStateManager.cpp.

{
  return (aPresContext->Type() == nsPresContext::eContext_PrintPreview);
}

Here is the caller graph for this function:


Variable Documentation

Definition at line 146 of file nsEventStateManager.cpp.

Definition at line 147 of file nsEventStateManager.cpp.

Definition at line 148 of file nsEventStateManager.cpp.

Definition at line 162 of file nsEventStateManager.cpp.

Definition at line 162 of file nsEventStateManager.cpp.

Definition at line 161 of file nsEventStateManager.cpp.

Definition at line 160 of file nsEventStateManager.cpp.

Definition at line 159 of file nsEventStateManager.cpp.

Definition at line 158 of file nsEventStateManager.cpp.