doc->GetLineBreaker(aLineBreaker);
NS_IF_ADDREF(*aLineBreaker = doc->GetLineBreaker());
nsresult nsTextFrame::GetTextInfoForPainting(nsIPresContext*          aPresContext,                                             nsIRenderingContext&     aRenderingContext,                                             nsIPresShell**           aPresShell,                                             nsISelectionController** aSelectionController,                                             PRBool&                  aDisplayingSelection,                                             PRBool&                  aIsPaginated,                                             PRBool&                  aIsSelected,                                             PRInt16&                 aSelectionValue,                                             nsILineBreaker**         aLineBreaker){  NS_ENSURE_ARG_POINTER(aPresContext);  NS_ENSURE_ARG_POINTER(aPresShell);  NS_ENSURE_ARG_POINTER(aSelectionController);  NS_ENSURE_ARG_POINTER(aLineBreaker);  //get the presshell  nsresult rv = aPresContext->GetShell(aPresShell);  if (NS_FAILED(rv) || (*aPresShell) == nsnull)    return NS_ERROR_FAILURE;  //get the selection controller  rv = GetSelectionController(aPresContext, aSelectionController);  if (NS_FAILED(rv) || !(*aSelectionController))    return NS_ERROR_FAILURE;  aPresContext->IsPaginated(&aIsPaginated);  PRBool isRenderingOnlySelection;  aPresContext->IsRenderingOnlySelection(&isRenderingOnlySelection);  (*aSelectionController)->GetDisplaySelection(&aSelectionValue);  if(aIsPaginated){    aDisplayingSelection = isRenderingOnlySelection;  } else {    //if greater than hidden then we display some kind of selection    aDisplayingSelection = (aSelectionValue > nsISelectionController::SELECTION_HIDDEN);  }  PRInt16 textSel=0;   (*aSelectionController)->GetSelectionFlags(&textSel);  if (!(textSel & nsISelectionDisplay::DISPLAY_TEXT))    aDisplayingSelection = PR_FALSE;  // Transform text from content into renderable form  // XXX If the text fragment is already Unicode and the text wasn't  // transformed when we formatted it, then there's no need to do all  // this and we should just render the text fragment directly. See  // PaintAsciiText()...  nsCOMPtr<nsIDocument> doc;  (*aPresShell)->GetDocument(getter_AddRefs(doc));  if (!doc)    return NS_ERROR_FAILURE;  doc->GetLineBreaker(aLineBreaker);  aIsSelected = (GetStateBits() & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT;  return NS_OK;}