示例#1
0
nsNewFrame*
nsFileControlFrame::GetTextControlFrame(nsPresContext* aPresContext, nsIFrame* aStart)
{
  nsNewFrame* result = nsnull;
#ifndef DEBUG_NEWFRAME
  // find the text control frame.
  nsIFrame* childFrame = aStart->GetFirstChild(nsnull);

  while (childFrame) {
    // see if the child is a text control
    nsCOMPtr<nsIFormControl> formCtrl =
      do_QueryInterface(childFrame->GetContent());

    if (formCtrl && formCtrl->GetType() == NS_FORM_INPUT_TEXT) {
      result = (nsNewFrame*)childFrame;
    }

    // if not continue looking
    nsNewFrame* frame = GetTextControlFrame(aPresContext, childFrame);
    if (frame)
       result = frame;
     
    childFrame = childFrame->GetNextSibling();
  }

  return result;
#else
  return nsnull;
#endif
}
示例#2
0
NS_IMETHODIMP nsFileControlFrame::Reflow(nsPresContext*          aPresContext,
        nsHTMLReflowMetrics&     aDesiredSize,
        const nsHTMLReflowState& aReflowState,
        nsReflowStatus&          aStatus)
{
    DO_GLOBAL_REFLOW_COUNT("nsFileControlFrame");
    DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);

    aStatus = NS_FRAME_COMPLETE;

    if (mState & NS_FRAME_FIRST_REFLOW) {
        mTextFrame = GetTextControlFrame(aPresContext, this);
        NS_ENSURE_TRUE(mTextFrame, NS_ERROR_UNEXPECTED);
    }

    // nsBlockFrame takes care of all our reflow
    return nsBlockFrame::Reflow(aPresContext, aDesiredSize, aReflowState,
                                aStatus);
}
示例#3
0
NS_IMETHODIMP nsFileControlFrame::Reflow(nsPresContext*          aPresContext, 
                                         nsHTMLReflowMetrics&     aDesiredSize,
                                         const nsHTMLReflowState& aReflowState, 
                                         nsReflowStatus&          aStatus)
{
  DO_GLOBAL_REFLOW_COUNT("nsFileControlFrame");
  DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);

  aStatus = NS_FRAME_COMPLETE;

  if (mState & NS_FRAME_FIRST_REFLOW) {
    mTextFrame = GetTextControlFrame(aPresContext, this);
    NS_ENSURE_TRUE(mTextFrame, NS_ERROR_UNEXPECTED);
    if (mCachedState) {
      mTextFrame->SetFormProperty(nsGkAtoms::value, *mCachedState);
      delete mCachedState;
      mCachedState = nsnull;
    }
  }

  // The Areaframe takes care of all our reflow
  return nsAreaFrame::Reflow(aPresContext, aDesiredSize, aReflowState,
                             aStatus);
}