if (!AlreadyInQueue(aReflowCommand)) { if (mReflowCommands.AppendElement(aReflowCommand)) { ReflowCommandAdded(aReflowCommand);
if (!AlreadyInQueue(command)) { if (mReflowCommands.AppendElement(command)) { ReflowCommandAdded(command);
PresShell::AppendReflowCommand(nsHTMLReflowCommand* aReflowCommand){  // If we've not yet done the initial reflow, then don't bother  // enqueuing a reflow command yet.  if (! mDidInitialReflow)    return NS_OK;#ifdef DEBUG  //printf("gShellCounter: %d\n", gShellCounter++);  if (mInVerifyReflow) {    return NS_OK;  }    if (VERIFY_REFLOW_NOISY_RC & gVerifyReflowFlags) {    printf("\nPresShell@%p: adding reflow command\n", (void*)this);    aReflowCommand->List(stdout);    if (VERIFY_REFLOW_REALLY_NOISY_RC & gVerifyReflowFlags) {      printf("Current content model:\n");      nsIContent *rootContent = mDocument->GetRootContent();      if (rootContent) {        rootContent->List(stdout, 0);      }    }  }  #endif  // Add the reflow command to the queue  nsresult rv = NS_OK;  if (!AlreadyInQueue(aReflowCommand)) {    if (mReflowCommands.AppendElement(aReflowCommand)) {      ReflowCommandAdded(aReflowCommand);    } else {      // Drop this command.... we're out of memory      PL_DHashTableOperate(&mReflowCommandTable, aReflowCommand,                           PL_DHASH_REMOVE);      delete aReflowCommand;      rv = NS_ERROR_OUT_OF_MEMORY;    }  }  else {    // We're not going to process this reflow command.    delete aReflowCommand;  }  // For async reflow during doc load, post a reflow event if we are not batching reflow commands.  // For sync reflow during doc load, post a reflow event if we are not batching reflow commands  // and the document is not loading.  if ((gAsyncReflowDuringDocLoad && !mBatchReflows) ||      (!gAsyncReflowDuringDocLoad && !mBatchReflows && !mDocumentLoading)) {    // If we're in the middle of a drag, process it right away (needed for mac,    // might as well do it on all platforms just to keep the code paths the same).    if ( !IsDragInProgress() )      PostReflowEvent();  }  return rv;}