else #endif result = aInnerIter->Init(aContent); nsIFrame *frame; if (NS_SUCCEEDED(result)) {  result = mFrameSelection->GetTracker()->GetPrimaryFrameFor(aContent, &frame); if (NS_SUCCEEDED(result) && frame)  frame->SetSelected(aPresContext, aRange, aFlags, eSpreadDown);   nsCOMPtr<nsIContent> innercontent; while (NS_ENUMERATOR_FALSE == aInnerIter->IsDone()) { result = aInnerIter->CurrentNode(getter_AddRefs(innercontent)); if (NS_SUCCEEDED(result) && innercontent) { result = mFrameSelection->GetTracker()->GetPrimaryFrameFor(innercontent, &frame); if (NS_SUCCEEDED(result) && frame)  frame->SetSelected(aPresContext, aRange,aFlags,eSpreadDown); } result = aInnerIter->Next(); if (NS_FAILED(result)) return result; } #if 0 result = mFrameSelection->GetTracker()->GetPrimaryFrameFor(content, &frame); if (NS_SUCCEEDED(result) && frame) frame->SetSelected(aRange,aFlags,eSpreadDown); #endif return NS_OK; } return NS_ERROR_FAILURE;
return result;
nsDOMSelection::selectFrames(nsIPresContext* aPresContext,                             nsIContentIterator *aInnerIter,                             nsIContent *aContent,                             nsIDOMRange *aRange,                             nsIPresShell *aPresShell,                             PRBool aFlags){  if (!mFrameSelection)    return NS_OK;//nothing to do  nsresult result;  if (!aInnerIter)    return NS_ERROR_NULL_POINTER;#ifdef USE_SELECTION_GENERATED_CONTENT_ITERATOR_CODE  nsCOMPtr<nsIGeneratedContentIterator> genericiter = do_QueryInterface(aInnerIter);  if (genericiter && aPresShell)  {    result = genericiter->Init(aPresShell,aContent);  }  else#endif // USE_SELECTION_GENERATED_CONTENT_ITERATOR_CODE    result = aInnerIter->Init(aContent);  nsIFrame *frame;  if (NS_SUCCEEDED(result))  {    // First select frame of content passed in    result = mFrameSelection->GetTracker()->GetPrimaryFrameFor(aContent, &frame);    if (NS_SUCCEEDED(result) && frame)      //NOTE: aRange and eSpreadDown are now IGNORED. Selected state is set only for given frame      frame->SetSelected(aPresContext, aRange, aFlags, eSpreadDown);        // Now iterated through the child frames and set them    nsCOMPtr<nsIContent> innercontent;    while (NS_ENUMERATOR_FALSE == aInnerIter->IsDone())    {      result = aInnerIter->CurrentNode(getter_AddRefs(innercontent));      if (NS_SUCCEEDED(result) && innercontent)      {        result = mFrameSelection->GetTracker()->GetPrimaryFrameFor(innercontent, &frame);        if (NS_SUCCEEDED(result) && frame)          //NOTE: aRange and eSpreadDown are now IGNORED. Selected state is set only for given frame          frame->SetSelected(aPresContext, aRange,aFlags,eSpreadDown);//spread from here to hit all frames in flow      }      result = aInnerIter->Next();      if (NS_FAILED(result))        return result;    }#if 0    result = mFrameSelection->GetTracker()->GetPrimaryFrameFor(content, &frame);    if (NS_SUCCEEDED(result) && frame)      frame->SetSelected(aRange,aFlags,eSpreadDown);//spread from here to hit all frames in flow#endif    return NS_OK;  }  return NS_ERROR_FAILURE;}