nsCOMPtr<nsIDocShellTreeNode> docShellNode(do_QueryInterface(mContainer)); if (docShellNode) { PRInt32 i; PRInt32 n; docShellNode->GetChildCount(&n); for (i=0; i < n; i++) { nsCOMPtr<nsIDocShellTreeItem> child; docShellNode->GetChildAt(i, getter_AddRefs(child)); nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child)); NS_ASSERTION(childAsShell, "null child in docshell"); if (childAsShell) { nsCOMPtr<nsIContentViewer> childCV; childAsShell->GetContentViewer(getter_AddRefs(childCV)); if (childCV) { nsCOMPtr<nsIMarkupDocumentViewer> markupCV = do_QueryInterface(childCV); if (markupCV) { markupCV->SetHintCharacterSetSource(aHintCharacterSetSource); } } } } } return NS_OK;
return CallChildren(SetChildHintCharacterSetSource, (void*) aHintCharacterSetSource);
NS_IMETHODIMP DocumentViewerImpl::SetHintCharacterSetSource(PRInt32 aHintCharacterSetSource){  mHintCharsetSource = (nsCharsetSource)aHintCharacterSetSource;  // now set the force char set on all children of mContainer  nsCOMPtr<nsIDocShellTreeNode> docShellNode(do_QueryInterface(mContainer));  if (docShellNode)  {    PRInt32 i;    PRInt32 n;    docShellNode->GetChildCount(&n);    for (i=0; i < n; i++)     {      nsCOMPtr<nsIDocShellTreeItem> child;      docShellNode->GetChildAt(i, getter_AddRefs(child));      nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));      NS_ASSERTION(childAsShell, "null child in docshell");      if (childAsShell)       {        nsCOMPtr<nsIContentViewer> childCV;        childAsShell->GetContentViewer(getter_AddRefs(childCV));        if (childCV)         {          nsCOMPtr<nsIMarkupDocumentViewer> markupCV = do_QueryInterface(childCV);          if (markupCV) {            markupCV->SetHintCharacterSetSource(aHintCharacterSetSource);          }        }      }    }  }  return NS_OK;}