Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions
nsImageBoxFrame.cpp File Reference
#include "nsImageBoxFrame.h"
#include "nsIDeviceContext.h"
#include "nsIFontMetrics.h"
#include "nsHTMLAtoms.h"
#include "nsXULAtoms.h"
#include "nsStyleContext.h"
#include "nsStyleConsts.h"
#include "nsCOMPtr.h"
#include "nsPresContext.h"
#include "nsBoxLayoutState.h"
#include "nsHTMLParts.h"
#include "nsString.h"
#include "nsLeafFrame.h"
#include "nsIRenderingContext.h"
#include "nsIPresShell.h"
#include "nsIImage.h"
#include "nsIWidget.h"
#include "nsLayoutAtoms.h"
#include "nsIDocument.h"
#include "nsIHTMLDocument.h"
#include "nsImageMap.h"
#include "nsILinkHandler.h"
#include "nsIURL.h"
#include "nsILoadGroup.h"
#include "nsIView.h"
#include "nsIViewManager.h"
#include "nsHTMLContainerFrame.h"
#include "prprf.h"
#include "nsCSSRendering.h"
#include "nsIDOMHTMLImageElement.h"
#include "nsINameSpaceManager.h"
#include "nsTextFragment.h"
#include "nsIDOMHTMLMapElement.h"
#include "nsIDOMDocument.h"
#include "nsIEventQueueService.h"
#include "nsTransform2D.h"
#include "nsITheme.h"
#include "nsIServiceManager.h"
#include "nsIURI.h"
#include "nsNetUtil.h"
#include "nsGUIEvent.h"
#include "nsContentUtils.h"

Go to the source code of this file.

Defines

#define ONLOAD_CALLED_TOO_EARLY   1

Functions

static void PR_CALLBACK HandleImagePLEvent (nsIContent *aContent, PRUint32 aMessage, PRUint32 aFlags)
static void PR_CALLBACK HandleImageOnloadPLEvent (PLEvent *aEvent)
static void PR_CALLBACK HandleImageOnerrorPLEvent (PLEvent *aEvent)
static void PR_CALLBACK DestroyImagePLEvent (PLEvent *aEvent)
void FireImageDOMEvent (nsIContent *aContent, PRUint32 aMessage)
nsresult NS_NewImageBoxFrame (nsIPresShell *aPresShell, nsIFrame **aNewFrame)

Define Documentation

Definition at line 97 of file nsImageBoxFrame.cpp.


Function Documentation

static void PR_CALLBACK DestroyImagePLEvent ( PLEvent aEvent) [static]

Definition at line 152 of file nsImageBoxFrame.cpp.

{
  delete aEvent;
}

Here is the caller graph for this function:

void FireImageDOMEvent ( nsIContent aContent,
PRUint32  aMessage 
)

Definition at line 166 of file nsImageBoxFrame.cpp.

{
  static NS_DEFINE_CID(kEventQueueServiceCID,   NS_EVENTQUEUESERVICE_CID);

  nsCOMPtr<nsIEventQueueService> event_service =
    do_GetService(kEventQueueServiceCID);

  if (!event_service) {
    NS_WARNING("Failed to get event queue service");

    return;
  }

  nsCOMPtr<nsIEventQueue> event_queue;

  event_service->GetThreadEventQueue(NS_CURRENT_THREAD,
                                     getter_AddRefs(event_queue));

  if (!event_queue) {
    NS_WARNING("Failed to get event queue from service");

    return;
  }

  PLEvent *event = new PLEvent;

  if (!event) {
    // Out of memory, but none of our callers care, so just warn and
    // don't fire the event

    NS_WARNING("Out of memory?");

    return;
  }

  PLHandleEventProc f;

  switch (aMessage) {
  case NS_IMAGE_LOAD :
    f = (PLHandleEventProc)::HandleImageOnloadPLEvent;

    break;
  case NS_IMAGE_ERROR :
    f = (PLHandleEventProc)::HandleImageOnerrorPLEvent;

    break;
  default:
    NS_WARNING("Huh, I don't know how to fire this type of event?!");

    return;
  }

  PL_InitEvent(event, aContent, f, (PLDestroyEventProc)::DestroyImagePLEvent);

  // The event owns the content pointer now.
  NS_ADDREF(aContent);

  event_queue->PostEvent(event);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void PR_CALLBACK HandleImageOnerrorPLEvent ( PLEvent aEvent) [static]

Definition at line 142 of file nsImageBoxFrame.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

static void PR_CALLBACK HandleImageOnloadPLEvent ( PLEvent aEvent) [static]

Definition at line 131 of file nsImageBoxFrame.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

static void PR_CALLBACK HandleImagePLEvent ( nsIContent aContent,
PRUint32  aMessage,
PRUint32  aFlags 
) [static]

Definition at line 100 of file nsImageBoxFrame.cpp.

{
  if (!aContent) {
    NS_ERROR("null node passed to HandleImagePLEvent!");

    return;
  }

  nsIDocument* doc = aContent->GetOwnerDoc();

  if (!doc) {
    return;
  }

  nsIPresShell *pres_shell = doc->GetShellAt(0);
  if (!pres_shell) {
    return;
  }

  nsCOMPtr<nsPresContext> pres_context = pres_shell->GetPresContext();
  if (!pres_context) {
    return;
  }

  nsEventStatus status = nsEventStatus_eIgnore;
  nsEvent event(PR_TRUE, aMessage);

  aContent->HandleDOMEvent(pres_context, &event, nsnull, aFlags, &status);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult NS_NewImageBoxFrame ( nsIPresShell aPresShell,
nsIFrame **  aNewFrame 
)

Definition at line 232 of file nsImageBoxFrame.cpp.

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

  *aNewFrame = it;
  return NS_OK;
  
} // NS_NewTitledButtonFrame

Here is the caller graph for this function: