Back to index

lightning-sunbird  0.9+nobinonly
Classes | Functions | Variables
nsContentUtils.cpp File Reference
#include "nsJSUtils.h"
#include "nsCOMPtr.h"
#include "nsAString.h"
#include "nsPrintfCString.h"
#include "nsUnicharUtils.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIPrefLocalizedString.h"
#include "nsServiceManagerUtils.h"
#include "nsIScriptGlobalObject.h"
#include "nsIScriptContext.h"
#include "nsIDOMScriptObjectFactory.h"
#include "nsDOMCID.h"
#include "nsContentUtils.h"
#include "nsIXPConnect.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsINodeInfo.h"
#include "nsReadableUtils.h"
#include "nsIDOMDocument.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMNode.h"
#include "nsIDOM3Node.h"
#include "nsIIOService.h"
#include "nsIURI.h"
#include "nsNetCID.h"
#include "nsNetUtil.h"
#include "nsIScriptSecurityManager.h"
#include "nsDOMError.h"
#include "nsPIDOMWindow.h"
#include "nsIJSContextStack.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h"
#include "nsParserCIID.h"
#include "nsIParserService.h"
#include "nsIServiceManager.h"
#include "nsIAttribute.h"
#include "nsContentList.h"
#include "nsIHTMLDocument.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMHTMLCollection.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIForm.h"
#include "nsIFormControl.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLParts.h"
#include "nsISupportsPrimitives.h"
#include "nsLayoutAtoms.h"
#include "imgIDecoderObserver.h"
#include "imgIRequest.h"
#include "imgIContainer.h"
#include "imgILoader.h"
#include "nsIImage.h"
#include "gfxIImageFrame.h"
#include "nsIImageLoadingContent.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsILink.h"
#include "nsILoadGroup.h"
#include "nsContentPolicyUtils.h"
#include "nsDOMString.h"
#include "nsGenericElement.h"
#include "nsNodeInfoManager.h"
#include "nsCRT.h"
#include "nsIMIMEService.h"
#include "jsdbgapi.h"
#include "nsIJSRuntimeService.h"
#include "nsIFragmentContentSink.h"
#include "nsIScriptObjectPrincipal.h"
#include "nsIStringBundle.h"
#include "nsIScriptError.h"
#include "nsIConsoleService.h"

Go to the source code of this file.

Classes

struct  NormalizeNewlinesCharTraits< OutputIterator >
struct  NormalizeNewlinesCharTraits< char * >
struct  NormalizeNewlinesCharTraits< PRUnichar * >
class  CopyNormalizeNewlines< OutputIterator >

Functions

static NS_DEFINE_IID (kParserServiceCID, NS_PARSERSERVICE_CID)
static JSContextGetContextFromDocument (nsIDocument *aDocument, JSObject **aGlobalObject)
PRBool IsCharInSet (const char *aSet, const PRUnichar aChar)
static void KeyAppendSep (nsACString &aKey)
static void KeyAppendString (const nsAString &aString, nsACString &aKey)
static void KeyAppendString (const nsACString &aString, nsACString &aKey)
static void KeyAppendInt (PRInt32 aInt, nsACString &aKey)
static void KeyAppendAtom (nsIAtom *aAtom, nsACString &aKey)
static PRBool IsAutocompleteOff (nsIDOMElement *aElement)
static PRBool MatchFormControls (nsIContent *aContent, PRInt32 aNamespaceID, nsIAtom *aAtom, const nsAString &aData)

Variables

static const char kJSStackContractID [] = "@mozilla.org/js/xpc/ContextStack;1"
static const char gEventName [] = "event"
static const char gSVGEventName [] = "evt"
static const char gPropertiesFiles [nsContentUtils::PropertiesFile_COUNT][56]

Function Documentation

static JSContext* GetContextFromDocument ( nsIDocument aDocument,
JSObject **  aGlobalObject 
) [static]

Definition at line 852 of file nsContentUtils.cpp.

{
  nsCOMPtr<nsIDocument_MOZILLA_1_8_0_BRANCH> doc18 =
    do_QueryInterface(aDocument);
  if (!doc18) {
    NS_ERROR("What kind of crazy document was passed in?");
    return nsnull;
  }
  nsIScriptGlobalObject *sgo = doc18->GetScopeObject();
  if (!sgo) {
    // No script global, no context.

    *aGlobalObject = nsnull;

    return nsnull;
  }

  *aGlobalObject = sgo->GetGlobalJSObject();

  nsIScriptContext *scx = sgo->GetContext();
  if (!scx) {
    // No context left in the old scope...

    return nsnull;
  }

  return (JSContext *)scx->GetNativeContext();
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool IsAutocompleteOff ( nsIDOMElement aElement) [inline, static]

Definition at line 1571 of file nsContentUtils.cpp.

{
  nsAutoString autocomplete;
  aElement->GetAttribute(NS_LITERAL_STRING("autocomplete"), autocomplete);
  return autocomplete.LowerCaseEqualsLiteral("off");
}

Here is the caller graph for this function:

PRBool IsCharInSet ( const char *  aSet,
const PRUnichar  aChar 
) [inline]

Definition at line 1440 of file nsContentUtils.cpp.

{
  PRUnichar ch;
  while ((ch = *aSet)) {
    if (aChar == PRUnichar(ch)) {
      return PR_TRUE;
    }
    ++aSet;
  }
  return PR_FALSE;
}

Here is the caller graph for this function:

static void KeyAppendAtom ( nsIAtom aAtom,
nsACString &  aKey 
) [inline, static]

Definition at line 1561 of file nsContentUtils.cpp.

{
  NS_PRECONDITION(aAtom, "KeyAppendAtom: aAtom can not be null!\n");

  const char* atomString = nsnull;
  aAtom->GetUTF8String(&atomString);

  KeyAppendString(nsDependentCString(atomString), aKey);
}

Here is the call graph for this function:

static void KeyAppendInt ( PRInt32  aInt,
nsACString &  aKey 
) [inline, static]

Definition at line 1554 of file nsContentUtils.cpp.

{
  KeyAppendSep(aKey);

  aKey.Append(nsPrintfCString("%d", aInt));
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void KeyAppendSep ( nsACString &  aKey) [inline, static]

Definition at line 1527 of file nsContentUtils.cpp.

{
  if (!aKey.IsEmpty()) {
    aKey.Append('>');
  }
}

Here is the caller graph for this function:

static void KeyAppendString ( const nsAString &  aString,
nsACString &  aKey 
) [inline, static]

Definition at line 1534 of file nsContentUtils.cpp.

{
  KeyAppendSep(aKey);

  // Could escape separator here if collisions happen.  > is not a legal char
  // for a name or type attribute, so we should be safe avoiding that extra work.

  AppendUTF16toUTF8(aString, aKey);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void KeyAppendString ( const nsACString &  aString,
nsACString &  aKey 
) [inline, static]

Definition at line 1544 of file nsContentUtils.cpp.

{
  KeyAppendSep(aKey);

  // Could escape separator here if collisions happen.  > is not a legal char
  // for a name or type attribute, so we should be safe avoiding that extra work.

  aKey.Append(aString);
}

Here is the call graph for this function:

static PRBool MatchFormControls ( nsIContent aContent,
PRInt32  aNamespaceID,
nsIAtom aAtom,
const nsAString &  aData 
) [static]

Definition at line 2522 of file nsContentUtils.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

static NS_DEFINE_IID ( kParserServiceCID  ,
NS_PARSERSERVICE_CID   
) [static]

Variable Documentation

const char gEventName[] = "event" [static]

Definition at line 2306 of file nsContentUtils.cpp.

Initial value:
 {
  
  "chrome://global/locale/css.properties",
  "chrome://global/locale/xbl.properties",
  "chrome://global/locale/xul.properties",
  "chrome://global/locale/layout_errors.properties",
  "chrome://global/locale/layout/HtmlForm.properties",
  "chrome://global/locale/printing.properties",
  "chrome://global/locale/dom/dom.properties",
  "chrome://branding/locale/brand.properties"
}

Definition at line 2423 of file nsContentUtils.cpp.

const char gSVGEventName[] = "evt" [static]

Definition at line 2307 of file nsContentUtils.cpp.

const char kJSStackContractID[] = "@mozilla.org/js/xpc/ContextStack;1" [static]

Definition at line 124 of file nsContentUtils.cpp.