Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions
nsDocumentViewer.cpp File Reference
#include "nscore.h"
#include "nsCOMPtr.h"
#include "nsCRT.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsISupports.h"
#include "nsIContent.h"
#include "nsIContentViewerContainer.h"
#include "nsIDocumentViewer.h"
#include "nsIDOMWindowInternal.h"
#include "nsIDocumentViewerPrint.h"
#include "nsIDocument.h"
#include "nsPresContext.h"
#include "nsIPresShell.h"
#include "nsIEventStateManager.h"
#include "nsStyleSet.h"
#include "nsIStyleSheet.h"
#include "nsICSSStyleSheet.h"
#include "nsIFrame.h"
#include "nsIScriptGlobalObject.h"
#include "nsILinkHandler.h"
#include "nsIDOMDocument.h"
#include "nsISelectionListener.h"
#include "nsISelectionPrivate.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMNSHTMLDocument.h"
#include "nsIDOMHTMLCollection.h"
#include "nsIDOMHTMLElement.h"
#include "nsIDOMRange.h"
#include "nsContentCID.h"
#include "nsLayoutCID.h"
#include "nsContentUtils.h"
#include "nsLayoutStylesheetCache.h"
#include "nsViewsCID.h"
#include "nsWidgetsCID.h"
#include "nsIDeviceContext.h"
#include "nsIDeviceContextSpec.h"
#include "nsIDeviceContextSpecFactory.h"
#include "nsIViewManager.h"
#include "nsIView.h"
#include "nsView.h"
#include "nsIPageSequenceFrame.h"
#include "nsIURL.h"
#include "nsNetUtil.h"
#include "nsIChromeEventHandler.h"
#include "nsIContentViewerEdit.h"
#include "nsIContentViewerFile.h"
#include "nsICSSLoader.h"
#include "nsIMarkupDocumentViewer.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeNode.h"
#include "nsIDocShellTreeOwner.h"
#include "nsIDocShell.h"
#include "nsIBaseWindow.h"
#include "nsIFrameDebug.h"
#include "nsILayoutHistoryState.h"
#include "nsLayoutAtoms.h"
#include "nsIParser.h"
#include "nsGUIEvent.h"
#include "nsHTMLReflowState.h"
#include "nsIDOMHTMLAnchorElement.h"
#include "nsIDOMHTMLAreaElement.h"
#include "nsIDOMHTMLLinkElement.h"
#include "nsIImageLoadingContent.h"
#include "nsCopySupport.h"
#include "nsIDOMHTMLFrameSetElement.h"
#include "nsPrintfCString.h"
#include "nsIClipboardHelper.h"
#include "nsIEventQueueService.h"
#include "nsIEventQueue.h"
#include "nsPIDOMWindow.h"
#include "nsIFocusController.h"
#include "nsIMenuParent.h"
#include "nsIScrollableView.h"
#include "nsIHTMLDocument.h"
#include "nsITimelineService.h"
#include "nsGfxCIID.h"
#include "nsStyleSheetService.h"
#include "nsIWebBrowserPrint.h"
#include "imgIContainer.h"
#include "nsIPrompt.h"
#include "nsIWindowWatcher.h"
#include "nsINodeInfo.h"
#include "nsHTMLAtoms.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMFocusListener.h"
#include "nsISelectionController.h"
#include "nsBidiUtils.h"
#include "nsISHEntry.h"
#include "nsISHistory.h"
#include "nsISHistoryInternal.h"
#include "nsIWebNavigation.h"
#include "nsWeakPtr.h"
#include "prenv.h"
#include <stdio.h>
#include "prlog.h"

Go to the source code of this file.

Classes

class  nsDocViewerSelectionListener
class  nsDocViewerFocusListener
 editor Implementation of the FocusListener interface More...
class  DocumentViewerImpl
struct  TextZoomInfo

Defines

#define PRT_YESNO(_p)
#define PR_PL(_p1)

Functions

static NS_DEFINE_CID (kViewManagerCID, NS_VIEW_MANAGER_CID)
static NS_DEFINE_CID (kWidgetCID, NS_CHILD_CID)
nsresult NS_NewDocumentViewer (nsIDocumentViewer **aResult)
 NS_IMPL_ISUPPORTS9 (DocumentViewerImpl, nsIContentViewer, nsIContentViewer_MOZILLA_1_8_BRANCH, nsIContentViewer_MOZILLA_1_8_BRANCH2, nsIDocumentViewer, nsIMarkupDocumentViewer, nsIContentViewerFile, nsIContentViewerEdit, nsIWebBrowserPrint, nsIDocumentViewerPrint) DocumentViewerImpl
static void AttachContainerRecurse (nsIDocShell *aShell)
static void DetachContainerRecurse (nsIDocShell *aShell)
 NS_DEFINE_CID (kCSSLoaderCID, NS_CSS_LOADER_CID)
 AppendAgentSheet (nsIStyleSheet *aSheet, void *aData)
 PrependUserSheet (nsIStyleSheet *aSheet, void *aData)
static void SetChildTextZoom (nsIMarkupDocumentViewer *aChild, void *aClosure)
static void SetChildAuthorStyleDisabled (nsIMarkupDocumentViewer *aChild, void *aClosure)
static void SetChildDefaultCharacterSet (nsIMarkupDocumentViewer *aChild, void *aClosure)
static void SetChildForceCharacterSet (nsIMarkupDocumentViewer *aChild, void *aClosure)
static void SetChildPrevDocCharacterSet (nsIMarkupDocumentViewer *aChild, void *aClosure)
static void SetChildHintCharacterSetSource (nsIMarkupDocumentViewer *aChild, void *aClosure)
static void SetChildHintCharacterSet (nsIMarkupDocumentViewer *aChild, void *aClosure)
static void SetChildBidiOptions (nsIMarkupDocumentViewer *aChild, void *aClosure)
 NS_IMPL_ISUPPORTS2 (nsDocViewerFocusListener, nsIDOMFocusListener, nsIDOMEventListener) nsDocViewerFocusListener
static void ResetFocusState (nsIDocShell *aDocShell)

Class Documentation

struct TextZoomInfo

Definition at line 2697 of file nsDocumentViewer.cpp.

Class Members
float mTextZoom

Define Documentation

#define PR_PL (   _p1)

Definition at line 225 of file nsDocumentViewer.cpp.

#define PRT_YESNO (   _p)

Definition at line 224 of file nsDocumentViewer.cpp.


Function Documentation

AppendAgentSheet ( nsIStyleSheet aSheet,
void aData 
)

Definition at line 2130 of file nsDocumentViewer.cpp.

Here is the call graph for this function:

static void AttachContainerRecurse ( nsIDocShell aShell) [static]

Definition at line 1227 of file nsDocumentViewer.cpp.

{
  nsCOMPtr<nsIContentViewer> viewer;
  aShell->GetContentViewer(getter_AddRefs(viewer));
  nsCOMPtr<nsIDocumentViewer> docViewer = do_QueryInterface(viewer);
  if (docViewer) {
    nsCOMPtr<nsIDocument> doc;
    docViewer->GetDocument(getter_AddRefs(doc));
    if (doc) {
      doc->SetContainer(aShell);
    }
    nsCOMPtr<nsPresContext> pc;
    docViewer->GetPresContext(getter_AddRefs(pc));
    if (pc) {
      pc->SetContainer(aShell);
      pc->SetLinkHandler(nsCOMPtr<nsILinkHandler>(do_QueryInterface(aShell)));
    }
    nsCOMPtr<nsIPresShell> presShell;
    docViewer->GetPresShell(getter_AddRefs(presShell));
    if (presShell) {
      presShell->SetForwardingContainer(nsnull);
    }
  }

  // Now recurse through the children
  nsCOMPtr<nsIDocShellTreeNode> node = do_QueryInterface(aShell);
  NS_ASSERTION(node, "docshells must implement nsIDocShellTreeNode");

  PRInt32 childCount;
  node->GetChildCount(&childCount);
  for (PRInt32 i = 0; i < childCount; ++i) {
    nsCOMPtr<nsIDocShellTreeItem> childItem;
    node->GetChildAt(i, getter_AddRefs(childItem));
    AttachContainerRecurse(nsCOMPtr<nsIDocShell>(do_QueryInterface(childItem)));
  }
}

Here is the call graph for this function:

static void DetachContainerRecurse ( nsIDocShell aShell) [static]

Definition at line 1372 of file nsDocumentViewer.cpp.

{
  // Unhook this docshell's presentation
  nsCOMPtr<nsIContentViewer> viewer;
  aShell->GetContentViewer(getter_AddRefs(viewer));
  nsCOMPtr<nsIDocumentViewer> docViewer = do_QueryInterface(viewer);
  if (docViewer) {
    nsCOMPtr<nsIDocument> doc;
    docViewer->GetDocument(getter_AddRefs(doc));
    if (doc) {
      doc->SetContainer(nsnull);
    }
    nsCOMPtr<nsPresContext> pc;
    docViewer->GetPresContext(getter_AddRefs(pc));
    if (pc) {
      pc->SetContainer(nsnull);
      pc->SetLinkHandler(nsnull);
    }
    nsCOMPtr<nsIPresShell> presShell;
    docViewer->GetPresShell(getter_AddRefs(presShell));
    if (presShell) {
      presShell->SetForwardingContainer(nsWeakPtr(do_GetWeakReference(aShell)));
    }
  }

  // Now recurse through the children
  nsCOMPtr<nsIDocShellTreeNode> node = do_QueryInterface(aShell);
  NS_ASSERTION(node, "docshells must implement nsIDocShellTreeNode");

  PRInt32 childCount;
  node->GetChildCount(&childCount);
  for (PRInt32 i = 0; i < childCount; ++i) {
    nsCOMPtr<nsIDocShellTreeItem> childItem;
    node->GetChildAt(i, getter_AddRefs(childItem));
    DetachContainerRecurse(nsCOMPtr<nsIDocShell>(do_QueryInterface(childItem)));
  }
}

Here is the call graph for this function:

static NS_DEFINE_CID ( kViewManagerCID  ,
NS_VIEW_MANAGER_CID   
) [static]
static NS_DEFINE_CID ( kWidgetCID  ,
NS_CHILD_CID   
) [static]
NS_DEFINE_CID ( kCSSLoaderCID  ,
NS_CSS_LOADER_CID   
)

Definition at line 3347 of file nsDocumentViewer.cpp.

:mDocViewer(nsnull)
{
}

Definition at line 515 of file nsDocumentViewer.cpp.

{
  if (mDocument) {
    Close(nsnull);
    mDocument->Destroy();
  }

  NS_ASSERTION(!mPresShell && !mPresContext,
               "User did not call nsIContentViewer::Destroy");
  if (mPresShell || mPresContext) {
    // Make sure we don't hand out a reference to the content viewer to
    // the SHEntry!
    mSHEntry = nsnull;

    Destroy();
  }

  // XXX(?) Revoke pending invalidate events
}

Here is the call graph for this function:

Definition at line 465 of file nsDocumentViewer.cpp.

{
  *aResult = new DocumentViewerImpl(nsnull);
  if (!*aResult) {
    return NS_ERROR_OUT_OF_MEMORY;
  }

  NS_ADDREF(*aResult);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PrependUserSheet ( nsIStyleSheet aSheet,
void aData 
)

Definition at line 2138 of file nsDocumentViewer.cpp.

Here is the call graph for this function:

static void ResetFocusState ( nsIDocShell aDocShell) [static]

Definition at line 4119 of file nsDocumentViewer.cpp.

{
  nsCOMPtr<nsISimpleEnumerator> docShellEnumerator;
  aDocShell->GetDocShellEnumerator(nsIDocShellTreeItem::typeContent,
                                   nsIDocShell::ENUMERATE_FORWARDS,
                                   getter_AddRefs(docShellEnumerator));
  
  nsCOMPtr<nsIDocShell> currentDocShell;
  nsCOMPtr<nsISupports> currentContainer;
  PRBool hasMoreDocShells;
  while (NS_SUCCEEDED(docShellEnumerator->HasMoreElements(&hasMoreDocShells))
         && hasMoreDocShells) {
    docShellEnumerator->GetNext(getter_AddRefs(currentContainer));
    currentDocShell = do_QueryInterface(currentContainer);
    if (!currentDocShell) {
      break;
    }
    nsCOMPtr<nsPresContext> presContext;
    currentDocShell->GetPresContext(getter_AddRefs(presContext));
    nsIEventStateManager* esm =
      presContext ? presContext->EventStateManager() : nsnull;
    if (esm) {
       esm->SetContentState(nsnull, NS_EVENT_STATE_FOCUS);
       esm->SetFocusedContent(nsnull);
    }
  }
}

Here is the call graph for this function:

static void SetChildAuthorStyleDisabled ( nsIMarkupDocumentViewer aChild,
void aClosure 
) [static]

Definition at line 2750 of file nsDocumentViewer.cpp.

{
  PRBool styleDisabled  = *NS_STATIC_CAST(PRBool*, aClosure);
  aChild->SetAuthorStyleDisabled(styleDisabled);
}
static void SetChildBidiOptions ( nsIMarkupDocumentViewer aChild,
void aClosure 
) [static]

Definition at line 2920 of file nsDocumentViewer.cpp.

{
  aChild->SetBidiOptions(NS_PTR_TO_INT32(aClosure));
}
static void SetChildDefaultCharacterSet ( nsIMarkupDocumentViewer aChild,
void aClosure 
) [static]

Definition at line 2798 of file nsDocumentViewer.cpp.

{
  const nsACString* charset = NS_STATIC_CAST(nsACString*, aClosure);
  aChild->SetDefaultCharacterSet(*charset);
}
static void SetChildForceCharacterSet ( nsIMarkupDocumentViewer aChild,
void aClosure 
) [static]

Definition at line 2823 of file nsDocumentViewer.cpp.

{
  const nsACString* charset = NS_STATIC_CAST(nsACString*, aClosure);
  aChild->SetForceCharacterSet(*charset);
}
static void SetChildHintCharacterSet ( nsIMarkupDocumentViewer aChild,
void aClosure 
) [static]

Definition at line 2904 of file nsDocumentViewer.cpp.

{
  const nsACString* charset = NS_STATIC_CAST(nsACString*, aClosure);
  aChild->SetHintCharacterSet(*charset);
}
static void SetChildHintCharacterSetSource ( nsIMarkupDocumentViewer aChild,
void aClosure 
) [static]

Definition at line 2888 of file nsDocumentViewer.cpp.

{
  aChild->SetHintCharacterSetSource(NS_PTR_TO_INT32(aClosure));
}
static void SetChildPrevDocCharacterSet ( nsIMarkupDocumentViewer aChild,
void aClosure 
) [static]

Definition at line 2871 of file nsDocumentViewer.cpp.

{
  const nsACString* charset = NS_STATIC_CAST(nsACString*, aClosure);
  aChild->SetPrevDocCharacterSet(*charset);
}
static void SetChildTextZoom ( nsIMarkupDocumentViewer aChild,
void aClosure 
) [static]

Definition at line 2703 of file nsDocumentViewer.cpp.

{
  struct TextZoomInfo* textZoomInfo = (struct TextZoomInfo*) aClosure;
  aChild->SetTextZoom(textZoomInfo->mTextZoom);
}