Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions | Variables
nsTextControlFrame.cpp File Reference
#include "nsCOMPtr.h"
#include "nsTextControlFrame.h"
#include "nsIDocument.h"
#include "nsIDOMNSHTMLTextAreaElement.h"
#include "nsIDOMNSHTMLInputElement.h"
#include "nsIFormControl.h"
#include "nsIServiceManager.h"
#include "nsIFrameSelection.h"
#include "nsIPlaintextEditor.h"
#include "nsEditorCID.h"
#include "nsLayoutCID.h"
#include "nsFormControlHelper.h"
#include "nsIDocumentEncoder.h"
#include "nsICaret.h"
#include "nsISelectionListener.h"
#include "nsISelectionPrivate.h"
#include "nsIController.h"
#include "nsIControllers.h"
#include "nsIControllerContext.h"
#include "nsGenericHTMLElement.h"
#include "nsIEditorIMESupport.h"
#include "nsIPhonetic.h"
#include "nsIEditorObserver.h"
#include "nsIDOMHTMLTextAreaElement.h"
#include "nsINameSpaceManager.h"
#include "nsINodeInfo.h"
#include "nsIScrollableView.h"
#include "nsIScrollableFrame.h"
#include "nsFormControlFrame.h"
#include "nsIDeviceContext.h"
#include "nsIContent.h"
#include "nsIAtom.h"
#include "nsPresContext.h"
#include "nsHTMLAtoms.h"
#include "nsIComponentManager.h"
#include "nsIView.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsISupportsArray.h"
#include "nsIDOMElement.h"
#include "nsIDOMDocument.h"
#include "nsIPresShell.h"
#include "nsBoxLayoutState.h"
#include "nsLayoutAtoms.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIDOMEventReceiver.h"
#include "nsIStyleSheet.h"
#include "nsIStyleRule.h"
#include "nsIDOMEventListener.h"
#include "nsGUIEvent.h"
#include "nsIDOMEventGroup.h"
#include "nsIDOM3EventTarget.h"
#include "nsIDOMNSEvent.h"
#include "nsIDOMNSUIEvent.h"
#include "nsIEventStateManager.h"
#include "nsIDOMFocusListener.h"
#include "nsIDOMCharacterData.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMRange.h"
#include "nsIScriptGlobalObject.h"
#include "nsIDOMWindowInternal.h"
#include "nsITextContent.h"
#include "nsIDOMNode.h"
#include "nsITextControlElement.h"
#include "nsITransactionManager.h"
#include "nsIDOMText.h"
#include "nsNodeInfoManager.h"
#include "nsContentCreatorFunctions.h"
#include "nsIDOMKeyListener.h"
#include "nsINativeKeyBindings.h"
#include "nsIJSContextStack.h"
#include "nsContentCID.h"

Go to the source code of this file.

Classes

class  nsTextInputListener
class  nsTextInputSelectionImpl

Defines

#define DEFAULT_COLUMN_WIDTH   20
#define FIX_FOR_BUG_40596

Functions

static NS_DEFINE_IID (kRangeCID, NS_RANGE_CID)
static NS_DEFINE_CID (kTextEditorCID, NS_TEXTEDITOR_CID)
static NS_DEFINE_CID (kFrameSelectionCID, NS_FRAMESELECTION_CID)
static void DoCommandCallback (const char *aCommand, void *aData)
static PRBool DOMEventToNativeKeyEvent (nsIDOMEvent *aDOMEvent, nsNativeKeyEvent *aNativeEvent)
nsresult NS_NewTextControlFrame (nsIPresShell *aPresShell, nsIFrame **aNewFrame)
static PRBool SuppressEventHandlers (nsPresContext *aPresContext)
static PRBool IsFocusedContent (nsPresContext *aPresContext, nsIContent *aContent)

Variables

static const PRInt32 DEFAULT_COLS = 20
static const PRInt32 DEFAULT_ROWS = 1
static const PRInt32 DEFAULT_ROWS_TEXTAREA = 2
static const PRInt32 DEFAULT_UNDO_CAP = 1000
static nsINativeKeyBindingssNativeInputBindings = nsnull
static nsINativeKeyBindingssNativeTextAreaBindings = nsnull

Define Documentation

Definition at line 134 of file nsTextControlFrame.cpp.


Function Documentation

static void DoCommandCallback ( const char *  aCommand,
void aData 
) [static]

Definition at line 349 of file nsTextControlFrame.cpp.

{
  nsTextControlFrame *frame = NS_STATIC_CAST(nsTextControlFrame*, aData);
  nsIContent *content = frame->GetContent();

  nsCOMPtr<nsIControllers> controllers;
  nsCOMPtr<nsIDOMNSHTMLInputElement> input = do_QueryInterface(content);
  if (input) {
    input->GetControllers(getter_AddRefs(controllers));
  } else {
    nsCOMPtr<nsIDOMNSHTMLTextAreaElement> textArea =
      do_QueryInterface(content);

    if (textArea) {
      textArea->GetControllers(getter_AddRefs(controllers));
    }
  }

  if (!controllers) {
    NS_WARNING("Could not get controllers");
    return;
  }

  nsCOMPtr<nsIController> controller;
  controllers->GetControllerForCommand(aCommand, getter_AddRefs(controller));
  if (controller) {
    controller->DoCommand(aCommand);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool DOMEventToNativeKeyEvent ( nsIDOMEvent aDOMEvent,
nsNativeKeyEvent aNativeEvent 
) [static]

Definition at line 380 of file nsTextControlFrame.cpp.

{
  nsCOMPtr<nsIDOMNSUIEvent> uievent = do_QueryInterface(aDOMEvent);
  PRBool defaultPrevented;
  uievent->GetPreventDefault(&defaultPrevented);
  if (defaultPrevented)
    return PR_FALSE;

  nsCOMPtr<nsIDOMNSEvent> nsevent = do_QueryInterface(aDOMEvent);
  PRBool trusted = PR_FALSE;
  nsevent->GetIsTrusted(&trusted);
  if (!trusted)
    return PR_FALSE;

  nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aDOMEvent);

  keyEvent->GetCharCode(&aNativeEvent->charCode);
  keyEvent->GetKeyCode(&aNativeEvent->keyCode);
  keyEvent->GetAltKey(&aNativeEvent->altKey);
  keyEvent->GetCtrlKey(&aNativeEvent->ctrlKey);
  keyEvent->GetShiftKey(&aNativeEvent->shiftKey);
  keyEvent->GetMetaKey(&aNativeEvent->metaKey);

  return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool IsFocusedContent ( nsPresContext aPresContext,
nsIContent aContent 
) [static]

Definition at line 2239 of file nsTextControlFrame.cpp.

{
  nsCOMPtr<nsIContent> focusedContent;
  aPresContext->EventStateManager()->
    GetFocusedContent(getter_AddRefs(focusedContent));
  return focusedContent == aContent;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static NS_DEFINE_CID ( kTextEditorCID  ,
NS_TEXTEDITOR_CID   
) [static]
static NS_DEFINE_CID ( kFrameSelectionCID  ,
NS_FRAMESELECTION_CID   
) [static]
static NS_DEFINE_IID ( kRangeCID  ,
NS_RANGE_CID   
) [static]
nsresult NS_NewTextControlFrame ( nsIPresShell aPresShell,
nsIFrame **  aNewFrame 
)

Definition at line 1233 of file nsTextControlFrame.cpp.

{
  NS_PRECONDITION(aNewFrame, "null OUT ptr");
  if (nsnull == aNewFrame) {
    return NS_ERROR_NULL_POINTER;
  }
  nsTextControlFrame* it = new (aPresShell) nsTextControlFrame(aPresShell);
  if (!it) {
    return NS_ERROR_OUT_OF_MEMORY;
  }
  *aNewFrame = it;
  return NS_OK;
}

Here is the caller graph for this function:

static PRBool SuppressEventHandlers ( nsPresContext aPresContext) [static]

Definition at line 1314 of file nsTextControlFrame.cpp.

{
  PRBool suppressHandlers = PR_FALSE;

  if (aPresContext)
  {
    // Right now we only suppress event handlers and controller manipulation
    // when in a print preview or print context!

#ifdef USE_QI_IN_SUPPRESS_EVENT_HANDLERS

    // Using QI to see if we're printing or print previewing is more
    // accurate, but a bit more heavy weight then just checking
    // the pagination bool, which will return the right answer to us
    // with the current implementation.

    nsCOMPtr<nsIPrintContext> printContext = do_QueryInterface(aPresContext);
    if (printContext)
      suppressHandlers = PR_TRUE;
    else
    {
      nsCOMPtr<nsIPrintPreviewContext> printPreviewContext = do_QueryInterface(aPresContext);
      if (printPreviewContext)
        suppressHandlers = PR_TRUE;
    }

#else

    // In the current implementation, we only paginate when
    // printing or in print preview.

    suppressHandlers = aPresContext->IsPaginated();

#endif
  }

  return suppressHandlers;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

const PRInt32 DEFAULT_COLS = 20 [static]

Definition at line 142 of file nsTextControlFrame.cpp.

const PRInt32 DEFAULT_ROWS = 1 [static]

Definition at line 143 of file nsTextControlFrame.cpp.

Definition at line 144 of file nsTextControlFrame.cpp.

const PRInt32 DEFAULT_UNDO_CAP = 1000 [static]

Definition at line 145 of file nsTextControlFrame.cpp.

Definition at line 147 of file nsTextControlFrame.cpp.

Definition at line 148 of file nsTextControlFrame.cpp.