Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Friends
nsComboboxControlFrame Class Reference

#include <nsComboboxControlFrame.h>

Inheritance diagram for nsComboboxControlFrame:
Inheritance graph
[legend]
Collaboration diagram for nsComboboxControlFrame:
Collaboration graph
[legend]

List of all members.

Public Types

typedef nsLineList::iterator line_iterator
typedef nsLineList::const_iterator const_line_iterator
typedef
nsLineList::reverse_iterator 
reverse_line_iterator
typedef
nsLineList::const_reverse_iterator 
const_reverse_line_iterator
enum  SpecialStateID { eNoID = 0, eDocumentScrollState }

Public Member Functions

 nsComboboxControlFrame ()
 ~nsComboboxControlFrame ()
NS_IMETHOD QueryInterface (const nsIID &aIID, void **aInstancePtr)
NS_IMETHOD CreateAnonymousContent (nsPresContext *aPresContext, nsISupportsArray &aChildList)
NS_IMETHOD CreateFrameFor (nsPresContext *aPresContext, nsIContent *aContent, nsIFrame **aFrame)
NS_IMETHOD Init (nsPresContext *aPresContext, nsIContent *aContent, nsIFrame *aParent, nsStyleContext *aContext, nsIFrame *aPrevInFlow)
NS_IMETHOD Reflow (nsPresContext *aCX, nsHTMLReflowMetrics &aDesiredSize, const nsHTMLReflowState &aReflowState, nsReflowStatus &aStatus)
NS_IMETHOD HandleEvent (nsPresContext *aPresContext, nsGUIEvent *aEvent, nsEventStatus *aEventStatus)
NS_IMETHOD Paint (nsPresContext *aPresContext, nsIRenderingContext &aRenderingContext, const nsRect &aDirtyRect, nsFramePaintLayer aWhichLayer, PRUint32 aFlags=0)
NS_IMETHOD Destroy (nsPresContext *aPresContext)
virtual nsIFrameGetFirstChild (nsIAtom *aListName) const
NS_IMETHOD SetInitialChildList (nsPresContext *aPresContext, nsIAtom *aListName, nsIFrame *aChildList)
virtual nsIAtomGetAdditionalChildListName (PRInt32 aIndex) const
NS_IMETHOD GetFrameForPoint (const nsPoint &aPoint, nsFramePaintLayer aWhichLayer, nsIFrame **aFrame)
virtual nsIFrameGetContentInsertionFrame ()
NS_IMETHOD SetSuggestedSize (nscoord aWidth, nscoord aHeight)
 Set the suggested size for the form element.
NS_IMETHOD GetName (nsAString *aName)
 NS_IMETHOD_ (PRInt32) GetFormControlType() const
NS_IMETHOD SetProperty (nsPresContext *aPresContext, nsIAtom *aName, const nsAString &aValue)
 Set a property on the form control frame.
NS_IMETHOD GetProperty (nsIAtom *aName, nsAString &aValue)
 Get a property from the form control frame.
void SetFocus (PRBool aOn, PRBool aRepaint)
 Inform the control that it got (or lost) focus.
void ScrollIntoView (nsPresContext *aPresContext)
virtual void InitializeControl (nsPresContext *aPresContext)
NS_IMETHOD OnContentReset ()
 Notification that the content has been reset.
NS_IMETHOD GetFormContent (nsIContent *&aContent) const
 Get the content object associated with this frame.
virtual nscoord GetVerticalBorderWidth (float aPixToTwip) const
virtual nscoord GetHorizontalBorderWidth (float aPixToTwip) const
virtual nscoord GetVerticalInsidePadding (nsPresContext *aPresContext, float aPixToTwip, nscoord aInnerHeight) const
virtual nscoord GetHorizontalInsidePadding (nsPresContext *aPresContext, float aPixToTwip, nscoord aInnerWidth, nscoord aCharWidth) const
NS_IMETHOD IsDroppedDown (PRBool *aDoDropDown)
 Indicates whether the list is dropped down.
NS_IMETHOD ShowDropDown (PRBool aDoDropDown)
NS_IMETHOD GetDropDown (nsIFrame **aDropDownFrame)
 Gets the Drop Down List.
NS_IMETHOD SetDropDown (nsIFrame *aDropDownFrame)
 Sets the Drop Down List.
NS_IMETHOD RollupFromList (nsPresContext *aPresContext)
NS_IMETHOD AbsolutelyPositionDropDown ()
NS_IMETHOD GetAbsoluteRect (nsRect *aRect)
NS_IMETHOD GetIndexOfDisplayArea (PRInt32 *aSelectedIndex)
 This returns the index of the item that is currently being displayed in the display area.
NS_IMETHOD RedisplaySelectedText ()
 Redisplay the selected text (will do nothing if text has not changed)
 NS_IMETHOD_ (PRInt32) UpdateRecentIndex(PRInt32 aIndex)
 Method for the listbox to set and get the recent index.
NS_IMETHOD AddOption (nsPresContext *aPresContext, PRInt32 index)
 Adds an option to the list at index.
NS_IMETHOD RemoveOption (nsPresContext *aPresContext, PRInt32 index)
 Removes the option at index.
NS_IMETHOD GetOptionSelected (PRInt32 aIndex, PRBool *aValue)
 Sets the select state of the option at index.
NS_IMETHOD DoneAddingChildren (PRBool aIsDone)
 Sets whether the parser is done adding children.
NS_IMETHOD OnOptionSelected (nsPresContext *aPresContext, PRInt32 aIndex, PRBool aSelected)
 Notify the frame when an option is selected.
NS_IMETHOD GetDummyFrame (nsIFrame **aFrame)
 For the content model to tell if there's a dummy frame or not.
NS_IMETHOD SetDummyFrame (nsIFrame *aFrame)
NS_IMETHOD OnSetSelectedIndex (PRInt32 aOldIndex, PRInt32 aNewIndex)
 Notify the frame when selectedIndex was changed.
NS_IMETHOD Rollup ()
 Hide the dropdown menu and stop capturing mouse events.
NS_IMETHOD ShouldRollupOnMouseWheelEvent (PRBool *aShouldRollup)
 A combobox should roll up if a mousewheel event happens outside of the popup area.
NS_IMETHOD ShouldRollupOnMouseActivate (PRBool *aShouldRollup)
 A combobox should not roll up if activated by a mouse activate message (eg.
virtual nsIScrollableViewGetScrollableView ()
NS_IMETHOD SaveState (nsPresContext *aPresContext, nsPresState **aState)
NS_IMETHOD RestoreState (nsPresContext *aPresContext, nsPresState *aState)
nsresult PositionDropdown (nsPresContext *aPresContext, nscoord aHeight, nsRect aAbsoluteTwipsRect, nsRect aAbsolutePixelRect)
virtual nsIAtomGetType () const
 Get the "type" of the frame.
line_iterator begin_lines ()
const_line_iterator begin_lines () const
line_iterator end_lines ()
const_line_iterator end_lines () const
reverse_line_iterator rbegin_lines ()
const_reverse_line_iterator rbegin_lines () const
reverse_line_iterator rend_lines ()
const_reverse_line_iterator rend_lines () const
NS_IMETHOD AppendFrames (nsIAtom *aListName, nsIFrame *aFrameList)
NS_IMETHOD InsertFrames (nsIAtom *aListName, nsIFrame *aPrevFrame, nsIFrame *aFrameList)
NS_IMETHOD RemoveFrame (nsIAtom *aListName, nsIFrame *aOldFrame)
NS_IMETHOD SetParent (const nsIFrame *aParent)
NS_IMETHOD IsSplittable (nsSplittableType &aIsSplittable) const
virtual PRBool IsContainingBlock () const
virtual PRBool IsFloatContainingBlock () const
void ClearLineCursor ()
nsLineBoxGetFirstLineContaining (nscoord y)
void SetupLineCursor ()
nsresult GetFrameForPointUsing (const nsPoint &aPoint, nsIAtom *aList, nsFramePaintLayer aWhichLayer, PRBool aConsiderSelf, nsIFrame **aFrame)
NS_IMETHOD ReflowDirtyChild (nsIPresShell *aPresShell, nsIFrame *aChild)
NS_IMETHOD IsVisibleForPainting (nsPresContext *aPresContext, nsIRenderingContext &aRenderingContext, PRBool aCheckVis, PRBool *aIsVisible)
virtual PRBool IsEmpty ()
virtual PRBool IsSelfEmpty ()
NS_IMETHOD AttributeChanged (nsIContent *aChild, PRInt32 aNameSpaceID, nsIAtom *aAttribute, PRInt32 aModType)
virtual void DeleteNextInFlowChild (nsPresContext *aPresContext, nsIFrame *aNextInFlow)
PRBool CheckForCollapsedBottomMarginFromClearanceLine ()
 Determines whether the collapsed margin carried out of the last line includes the margin-top of a line with clearance (in which case we must avoid collapsing that margin with our bottom margin)
nsIFrameGetTopBlockChild (nsPresContext *aPresContext)
 return the topmost block child based on y-index.
line_iterator FindLineFor (nsIFrame *aFrame)
nscoord GetAscent ()
nsresult SplitPlaceholder (nsBlockReflowState &aState, nsIFrame *aPlaceholder)
void UndoSplitPlaceholders (nsBlockReflowState &aState, nsIFrame *aLastPlaceholder)
virtual void PaintChild (nsPresContext *aPresContext, nsIRenderingContext &aRenderingContext, const nsRect &aDirtyRect, nsIFrame *aFrame, nsFramePaintLayer aWhichLayer, PRUint32 aFlags=0)
PRBool HandleOverflowPlaceholdersForPulledFrame (nsBlockReflowState &aState, nsIFrame *aFrame)
 Call this when a frame will be pulled from the block's next-in-flow into this frame.
PRBool HandleOverflowPlaceholdersOnPulledLine (nsBlockReflowState &aState, nsLineBox *aLine)
 Call this when a line will be pulled from the block's next-in-flow's line.
nsresult DoRemoveFrame (nsIFrame *aDeletedFrame, PRBool aDestroyFrames=PR_TRUE)
 does all the real work for removing aDeletedFrame from this finds the line containing aFrame.
void ReparentFloats (nsIFrame *aFirstFrame, nsBlockFrame *aOldParent, PRBool aFromOverflow, PRBool aReparentSiblings)
 Reparent a whole list of floats from aOldParent to this block.
nsLineListGetOverflowLines () const
virtual void PostCreateFrames ()
void ShouldRollupOnMouseWheelEvent (out PRBool aShould)
 Asks the RollupListener if it should rollup on mousevents.
void ShouldRollupOnMouseActivate (out PRBool aShould)
 Asks the RollupListener if it should rollup on mouse activate, eg.

Static Public Member Functions

static PRBool ToolkitHasNativePopup ()
static nsresult GetCurrentLine (nsBlockReflowState *aState, nsLineBox **aOutCurrentLine)

Protected Member Functions

NS_IMETHOD CreateDisplayFrame (nsPresContext *aPresContext)
virtual PRIntn GetSkipSides () const
nsresult ReflowComboChildFrame (nsIFrame *aFrame, nsPresContext *aPresContext, nsHTMLReflowMetrics &aDesiredSize, const nsHTMLReflowState &aReflowState, nsReflowStatus &aStatus, nscoord aAvailableWidth, nscoord aAvailableHeight)
void ShowPopup (PRBool aShowPopup)
 Show or hide the dropdown list.
PRBool ShowList (nsPresContext *aPresContext, PRBool aShowList)
 Show or hide the dropdown list.
void SetChildFrameSize (nsIFrame *aFrame, nscoord aWidth, nscoord aHeight)
void CheckFireOnChange ()
void FireValueChangeEvent ()
nsresult RedisplayText (PRInt32 aIndex)
void HandleRedisplayTextEvent ()
void ActuallyDisplayText (PRBool aNotify)
nsresult GetPrimaryComboFrame (nsPresContext *aPresContext, nsIContent *aContent, nsIFrame **aFrame)
void ReflowCombobox (nsPresContext *aPresContext, const nsHTMLReflowState &aReflowState, nsHTMLReflowMetrics &aDesiredSize, nsReflowStatus &aStatus, nsIFrame *aDisplayFrame, nsIFrame *aDropDownBtn, nscoord &aDisplayWidth, nscoord aBtnWidth, const nsMargin &aBorderPadding, nscoord aFallBackHgt=-1, PRBool aCheckHeight=PR_FALSE)
virtual void PaintTextDecorationLines (nsIRenderingContext &aRenderingContext, nscolor aColor, nscoord aOffset, nscoord aAscent, nscoord aSize)
nsresult GetClosestLine (nsILineIterator *aLI, const nsPoint &aPoint, PRInt32 &aClosestLine)
 GetClosestLine will return the line that VERTICALLY owns the point closest to aPoint.y aPoint is the point to search for, relative to the origin of the frame that aLI iterates over.
void TryAllLines (nsLineList::iterator *aIterator, nsLineList::iterator *aEndIterator, PRBool *aInOverflowLines)
 This helps us iterate over the list of all normal + overflow lines.
void SetFlags (PRUint32 aFlags)
PRBool HaveOutsideBullet () const
void SlideLine (nsBlockReflowState &aState, nsLineBox *aLine, nscoord aDY)
 move the frames contained by aLine by aDY if aLine is a block, it's child floats are added to the state manager
virtual void ComputeFinalSize (const nsHTMLReflowState &aReflowState, nsBlockReflowState &aState, nsHTMLReflowMetrics &aMetrics)
void ComputeCombinedArea (const nsHTMLReflowState &aReflowState, nsHTMLReflowMetrics &aMetrics)
nsresult AddFrames (nsIFrame *aFrameList, nsIFrame *aPrevSibling)
 add the frames in aFrameList to this block after aPrevSibling this block thinks in terms of lines, but the frame construction code knows nothing about lines at all.
PRBool DrainOverflowLines (nsBlockReflowState &aState)
 grab overflow lines from this block's prevInFlow, and make them part of this block's mLines list.
line_iterator RemoveFloat (nsIFrame *aFloat)
 Remove a float from our float list and also the float cache for the line its placeholder is on.
void CollectFloats (nsIFrame *aFrame, nsFrameList &aList, nsIFrame **aTail, PRBool aFromOverflow, PRBool aCollectFromSiblings)
nsresult PrepareInitialReflow (nsBlockReflowState &aState)
 set up the conditions necessary for an initial reflow
nsresult PrepareStyleChangedReflow (nsBlockReflowState &aState)
 set up the conditions necessary for an styleChanged reflow
nsresult PrepareChildIncrementalReflow (nsBlockReflowState &aState)
 set up the conditions necessary for an incremental reflow.
void RetargetInlineIncrementalReflow (nsReflowPath::iterator &aFrame, line_iterator &aLine, nsIFrame *aPrevInFlow)
 Retarget an inline incremental reflow from continuing frames that will be destroyed.
nsresult PrepareResizeReflow (nsBlockReflowState &aState)
 set up the conditions necessary for an resize reflow the primary task is to mark the minimumly sufficient lines dirty.
nsresult ReflowDirtyLines (nsBlockReflowState &aState, PRBool aTryPull)
 reflow all lines that have been marked dirty.
nsresult ReflowLine (nsBlockReflowState &aState, line_iterator aLine, PRBool aTryPull, PRBool *aKeepReflowGoing, PRBool aDamageDirtyArea=PR_FALSE)
 Reflow a line.
PRBool PlaceLine (nsBlockReflowState &aState, nsLineLayout &aLineLayout, line_iterator aLine, PRBool *aKeepReflowGoing, PRBool aUpdateMaximumWidth)
nsresult MarkLineDirty (line_iterator aLine)
 Mark |aLine| dirty, and, if necessary because of possible pull-up, mark the previous line dirty as well.
void PostPlaceLine (nsBlockReflowState &aState, nsLineBox *aLine, nscoord aMaxElementWidth)
PRBool ShouldJustifyLine (nsBlockReflowState &aState, line_iterator aLine)
void DeleteLine (nsBlockReflowState &aState, nsLineList::iterator aLine, nsLineList::iterator aLineEnd)
PRBool ShouldApplyTopMargin (nsBlockReflowState &aState, nsLineBox *aLine)
nsresult ReflowBlockFrame (nsBlockReflowState &aState, line_iterator aLine, PRBool *aKeepGoing)
nsresult ReflowInlineFrames (nsBlockReflowState &aState, line_iterator aLine, PRBool aTryPull, PRBool *aKeepLineGoing, PRBool aDamageDirtyArea, PRBool aUpdateMaximumWidth=PR_FALSE)
nsresult DoReflowInlineFrames (nsBlockReflowState &aState, nsLineLayout &aLineLayout, line_iterator aLine, PRBool *aKeepReflowGoing, PRUint8 *aLineReflowStatus, PRBool aUpdateMaximumWidth, PRBool aDamageDirtyArea, PRBool aAllowPullUp)
nsresult ReflowInlineFrame (nsBlockReflowState &aState, nsLineLayout &aLineLayout, line_iterator aLine, nsIFrame *aFrame, PRUint8 *aLineReflowStatus)
 Reflow an inline frame.
nsresult ReflowFloat (nsBlockReflowState &aState, nsPlaceholderFrame *aPlaceholder, nsFloatCache *aFloatCache, nsReflowStatus &aReflowStatus)
virtual nsresult CreateContinuationFor (nsBlockReflowState &aState, nsLineBox *aLine, nsIFrame *aFrame, PRBool &aMadeNewFrame)
 Create a continuation, if necessary, for aFrame.
void PushTruncatedPlaceholderLine (nsBlockReflowState &aState, line_iterator aLine, nsIFrame *aLastPlaceholder, PRBool &aKeepReflowGoing)
nsresult SplitLine (nsBlockReflowState &aState, nsLineLayout &aLineLayout, line_iterator aLine, nsIFrame *aFrame)
nsresult PullFrame (nsBlockReflowState &aState, line_iterator aLine, PRBool aDamageDeletedLine, nsIFrame *&aFrameResult)
 Pull frame from the next available location (one of our lines or one of our next-in-flows lines).
PRBool PullFrameFrom (nsBlockReflowState &aState, nsLineBox *aLine, nsBlockFrame *aFromContainer, PRBool aFromOverflowLine, nsLineList::iterator aFromLine, PRBool aDamageDeletedLines, nsIFrame *&aFrameResult)
 Try to pull a frame out of a line pointed at by aFromLine.
void PushLines (nsBlockReflowState &aState, nsLineList::iterator aLineBefore)
virtual void PaintChildren (nsPresContext *aPresContext, nsIRenderingContext &aRenderingContext, const nsRect &aDirtyRect, nsFramePaintLayer aWhichLayer, PRUint32 aFlags=0)
void PaintFloats (nsPresContext *aPresContext, nsIRenderingContext &aRenderingContext, const nsRect &aDirtyRect)
void PropagateFloatDamage (nsBlockReflowState &aState, nsLineBox *aLine, nscoord aDeltaY)
 Propagate reflow "damage" from from earlier lines to the current line.
void CheckFloats (nsBlockReflowState &aState)
void RenumberLists (nsPresContext *aPresContext)
PRBool RenumberListsInBlock (nsPresContext *aPresContext, nsBlockFrame *aContainerFrame, PRInt32 *aOrdinal, PRInt32 aDepth)
PRBool RenumberListsFor (nsPresContext *aPresContext, nsIFrame *aKid, PRInt32 *aOrdinal, PRInt32 aDepth)
nsresult UpdateBulletPosition (nsBlockReflowState &aState)
void ReflowBullet (nsBlockReflowState &aState, nsHTMLReflowMetrics &aMetrics)
nsLineListRemoveOverflowLines ()
nsresult SetOverflowLines (nsLineList *aOverflowLines)
nsFrameListGetOverflowPlaceholders () const
nsFrameList GetOverflowOutOfFlows () const
void SetOverflowOutOfFlows (const nsFrameList &aList)
nsIFrameLastChild ()

Static Protected Member Functions

static void DoRemoveOutOfFlowFrame (nsIFrame *aFrame)
static PRBool FrameStartsCounterScope (nsIFrame *aFrame)

Protected Attributes

nsFrameList mPopupFrames
nsPresContextmPresContext
nsCOMPtr< nsITextContentmDisplayContent
nsIFramemDisplayFrame
nsIFramemButtonFrame
nsIFramemDropdownFrame
nsIFramemTextFrame
nsIListControlFramemListControlFrame
nsSize mCacheSize
nsSize mCachedAvailableSize
nscoord mCachedMaxElementWidth
nscoord mCachedAscent
nsSize mCachedUncDropdownSize
nsSize mCachedUncComboSize
nscoord mItemDisplayWidth
PRPackedBool mDroppedDown
PRPackedBool mGoodToGo
PRPackedBool mInRedisplayText
PRPackedBool mRedisplayTextEventPosted
PRInt32 mRecentSelectedIndex
PRInt32 mDisplayedIndex
nsString mDisplayedOptionText
nsCOMPtr< nsIDOMMouseListenermButtonListener
nsCOMPtr< nsIEventQueueServicemEventQueueService
nscoord mAscent
nsLineList mLines
nsFrameList mFloats
nsBulletFramemBullet

Static Protected Attributes

static nsComboboxControlFramemFocused = nsnull

Private Member Functions

 NS_IMETHOD_ (nsrefcnt) AddRef()
 NS_IMETHOD_ (nsrefcnt) Release()

Friends

class RedisplayTextEvent
nsresult NS_NewComboboxControlFrame (nsIPresShell *aPresShell, nsIFrame **aNewFrame, PRUint32 aFlags)
nsresult NS_NewAreaFrame (nsIPresShell *aPresShell, nsIFrame **aResult, PRUint32 aFlags)
struct nsAutoOOFFrameList
class nsBlockReflowState
nsresult NS_NewBlockFrame (nsIPresShell *aPresShell, nsIFrame **aNewFrame, PRUint32 aFlags)

Detailed Description

Definition at line 83 of file nsComboboxControlFrame.h.


Member Typedef Documentation

Definition at line 121 of file nsBlockFrame.h.

Definition at line 123 of file nsBlockFrame.h.

Definition at line 120 of file nsBlockFrame.h.

Definition at line 122 of file nsBlockFrame.h.


Member Enumeration Documentation

Enumerator:
eNoID 
eDocumentScrollState 

Definition at line 23 of file nsIStatefulFrame.h.


Constructor & Destructor Documentation

Definition at line 357 of file nsComboboxControlFrame.cpp.


Member Function Documentation

Implements nsIComboboxControlFrame.

Definition at line 1755 of file nsComboboxControlFrame.cpp.

{
  nsRect absoluteTwips;
  nsRect absolutePixels;

  if (NS_SUCCEEDED(nsFormControlFrame::GetAbsoluteFramePosition(mPresContext, this,  absoluteTwips, absolutePixels))) {
    PositionDropdown(mPresContext, GetRect().height, absoluteTwips, absolutePixels);
  }
  return NS_OK;
}

Here is the call graph for this function:

Definition at line 1859 of file nsComboboxControlFrame.cpp.

{
  if (mDisplayedOptionText.IsEmpty()) {
    // Have to use a non-breaking space for line-height calculations
    // to be right
    static const PRUnichar space = 0xA0;
    mDisplayContent->SetText(&space, 1, aNotify);
  } else {
    mDisplayContent->SetText(mDisplayedOptionText, aNotify);
  }
}

Here is the caller graph for this function:

nsresult nsBlockFrame::AddFrames ( nsIFrame aFrameList,
nsIFrame aPrevSibling 
) [protected, inherited]

add the frames in aFrameList to this block after aPrevSibling this block thinks in terms of lines, but the frame construction code knows nothing about lines at all.

So we need to find the line that contains aPrevSibling and add aFrameList after aPrevSibling on that line. new lines are created as necessary to handle block data in aFrameList.

Definition at line 5371 of file nsBlockFrame.cpp.

{
  // Clear our line cursor, since our lines may change.
  ClearLineCursor();

  if (nsnull == aFrameList) {
    return NS_OK;
  }

  // If we're inserting at the beginning of our list and we have an
  // inside bullet, insert after that bullet.
  if (!aPrevSibling && mBullet && !HaveOutsideBullet()) {
    NS_ASSERTION(!nsFrameList(aFrameList).ContainsFrame(mBullet),
                 "Trying to make mBullet prev sibling to itself");
    aPrevSibling = mBullet;
  }
  
  nsIPresShell *presShell = GetPresContext()->PresShell();

  // Attempt to find the line that contains the previous sibling
  nsLineList::iterator prevSibLine = end_lines();
  PRInt32 prevSiblingIndex = -1;
  if (aPrevSibling) {
    // XXX_perf This is technically O(N^2) in some cases, but by using
    // RFind instead of Find, we make it O(N) in the most common case,
    // which is appending cotent.

    // Find the line that contains the previous sibling
    if (! nsLineBox::RFindLineContaining(aPrevSibling,
                                         begin_lines(), prevSibLine,
                                         &prevSiblingIndex)) {
      // Note: defensive code! RFindLineContaining must not return
      // false in this case, so if it does...
      NS_NOTREACHED("prev sibling not in line list");
      aPrevSibling = nsnull;
      prevSibLine = end_lines();
    }
  }

  // Find the frame following aPrevSibling so that we can join up the
  // two lists of frames.
  nsIFrame* prevSiblingNextFrame = nsnull;
  if (aPrevSibling) {
    prevSiblingNextFrame = aPrevSibling->GetNextSibling();

    // Split line containing aPrevSibling in two if the insertion
    // point is somewhere in the middle of the line.
    PRInt32 rem = prevSibLine->GetChildCount() - prevSiblingIndex - 1;
    if (rem) {
      // Split the line in two where the frame(s) are being inserted.
      nsLineBox* line = NS_NewLineBox(presShell, prevSiblingNextFrame, rem, PR_FALSE);
      if (!line) {
        return NS_ERROR_OUT_OF_MEMORY;
      }
      mLines.after_insert(prevSibLine, line);
      prevSibLine->SetChildCount(prevSibLine->GetChildCount() - rem);
      prevSibLine->MarkDirty();
    }

    // Now (partially) join the sibling lists together
    aPrevSibling->SetNextSibling(aFrameList);
  }
  else if (! mLines.empty()) {
    prevSiblingNextFrame = mLines.front()->mFirstChild;
  }

  // Walk through the new frames being added and update the line data
  // structures to fit.
  nsIFrame* newFrame = aFrameList;
  while (newFrame) {
    PRBool isBlock = nsLineLayout::TreatFrameAsBlock(newFrame);

    // If the frame is a block frame, or if there is no previous line or if the
    // previous line is a block line or ended with a <br> then make a new line.
    if (isBlock || prevSibLine == end_lines() || prevSibLine->IsBlock() ||
        (aPrevSibling && ShouldPutNextSiblingOnNewLine(aPrevSibling))) {
      // Create a new line for the frame and add its line to the line
      // list.
      nsLineBox* line = NS_NewLineBox(presShell, newFrame, 1, isBlock);
      if (!line) {
        return NS_ERROR_OUT_OF_MEMORY;
      }
      if (prevSibLine != end_lines()) {
        // Append new line after prevSibLine
        mLines.after_insert(prevSibLine, line);
        ++prevSibLine;
      }
      else {
        // New line is going before the other lines
        mLines.push_front(line);
        prevSibLine = begin_lines();
      }
    }
    else {
      prevSibLine->SetChildCount(prevSibLine->GetChildCount() + 1);
      prevSibLine->MarkDirty();
    }

    aPrevSibling = newFrame;
    newFrame = newFrame->GetNextSibling();
  }
  if (prevSiblingNextFrame) {
    // Connect the last new frame to the remainder of the sibling list
    aPrevSibling->SetNextSibling(prevSiblingNextFrame);
  }

#ifdef DEBUG
  VerifyLines(PR_TRUE);
#endif
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsComboboxControlFrame::AddOption ( nsPresContext aPresContext,
PRInt32  index 
) [virtual]

Adds an option to the list at index.

Implements nsISelectControlFrame.

Definition at line 1897 of file nsComboboxControlFrame.cpp.

{
  if (aIndex <= mDisplayedIndex) {
    ++mDisplayedIndex;
  }

  nsListControlFrame* lcf = NS_STATIC_CAST(nsListControlFrame*, mDropdownFrame);
  return lcf->AddOption(aPresContext, aIndex);
}

Here is the call graph for this function:

NS_IMETHODIMP nsBlockFrame::AppendFrames ( nsIAtom aListName,
nsIFrame aFrameList 
) [inherited]

Reimplemented in nsMathMLmathBlockFrame, nsMathMLForeignFrameWrapper, and nsSVGForeignObjectFrame.

Definition at line 5275 of file nsBlockFrame.cpp.

{
  if (nsnull == aFrameList) {
    return NS_OK;
  }
  if (mAbsoluteContainer.GetChildListName() == aListName) {
    return mAbsoluteContainer.AppendFrames(this, aListName, aFrameList);
  }
  else if (nsLayoutAtoms::floatList == aListName) {
    mFloats.AppendFrames(nsnull, aFrameList);
    return NS_OK;
  }
  else if (nsnull != aListName) {
    return NS_ERROR_INVALID_ARG;
  }

  // Find the proper last-child for where the append should go
  nsIFrame* lastKid = nsnull;
  nsLineBox* lastLine = mLines.empty() ? nsnull : mLines.back();
  if (lastLine) {
    lastKid = lastLine->LastChild();
  }

  // Add frames after the last child
#ifdef NOISY_REFLOW_REASON
  ListTag(stdout);
  printf(": append ");
  nsFrame::ListTag(stdout, aFrameList);
  if (lastKid) {
    printf(" after ");
    nsFrame::ListTag(stdout, lastKid);
  }
  printf("\n");
#endif
  nsresult rv = AddFrames(aFrameList, lastKid);
  if (NS_SUCCEEDED(rv)) {
    // Ask the parent frame to reflow me.
    ReflowDirtyChild(GetPresContext()->PresShell(), nsnull);
  }
  return rv;
}

Here is the call graph for this function:

NS_IMETHODIMP nsBlockFrame::AttributeChanged ( nsIContent aChild,
PRInt32  aNameSpaceID,
nsIAtom aAttribute,
PRInt32  aModType 
) [inherited]

Reimplemented in nsIsIndexFrame, and nsFileControlFrame.

Definition at line 3046 of file nsBlockFrame.cpp.

{
  nsresult rv = nsBlockFrameSuper::AttributeChanged(aChild, aNameSpaceID,
                                                    aAttribute, aModType);

  if (NS_FAILED(rv)) {
    return rv;
  }
  if (nsHTMLAtoms::start == aAttribute) {
    nsPresContext* presContext = GetPresContext();

    // XXX Not sure if this is necessary anymore
    RenumberLists(presContext);

    rv = presContext->PresShell()->
      AppendReflowCommand(this, eReflowType_ContentChanged, nsnull);
  }
  else if (nsHTMLAtoms::value == aAttribute) {
    const nsStyleDisplay* styleDisplay = GetStyleDisplay();
    if (NS_STYLE_DISPLAY_LIST_ITEM == styleDisplay->mDisplay) {
      nsIFrame* nextAncestor = mParent;
      nsBlockFrame* blockParent = nsnull;
      
      // Search for the closest ancestor that's a block frame. We
      // make the assumption that all related list items share a
      // common block parent.
      // XXXldb I think that's a bad assumption.
      while (nextAncestor) {
        if (NS_OK == nextAncestor->QueryInterface(kBlockFrameCID, 
                                                  (void**)&blockParent)) {
          break;
        }
        nextAncestor = nextAncestor->GetParent();
      }

      // Tell the enclosing block frame to renumber list items within
      // itself
      if (nsnull != blockParent) {
        nsPresContext* presContext = GetPresContext();
        // XXX Not sure if this is necessary anymore
        blockParent->RenumberLists(presContext);

        rv = presContext->PresShell()->
          AppendReflowCommand(blockParent, eReflowType_ContentChanged, nsnull);
      }
    }
  }

  return rv;
}

Here is the call graph for this function:

line_iterator nsBlockFrame::begin_lines ( ) [inline, inherited]

Definition at line 125 of file nsBlockFrame.h.

{ return mLines.begin(); }

Here is the call graph for this function:

Here is the caller graph for this function:

const_line_iterator nsBlockFrame::begin_lines ( ) const [inline, inherited]

Definition at line 127 of file nsBlockFrame.h.

{ return mLines.begin(); }

Here is the call graph for this function:

void nsBlockFrame::CheckFloats ( nsBlockReflowState aState) [protected, inherited]

Definition at line 7581 of file nsBlockFrame.cpp.

{
#ifdef DEBUG
  // Check that the float list is what we would have built
  nsAutoVoidArray lineFloats;
  for (line_iterator line = begin_lines(), line_end = end_lines();
       line != line_end; ++line) {
    if (line->HasFloats()) {
      nsFloatCache* fc = line->GetFirstFloat();
      while (fc) {
        nsIFrame* floatFrame = fc->mPlaceholder->GetOutOfFlowFrame();
        lineFloats.AppendElement(floatFrame);
        fc = fc->Next();
      }
    }
  }
  
  nsAutoVoidArray storedFloats;
  PRBool equal = PR_TRUE;
  PRInt32 i = 0;
  for (nsIFrame* f = mFloats.FirstChild(); f; f = f->GetNextSibling()) {
    storedFloats.AppendElement(f);
    if (i < lineFloats.Count() && lineFloats.ElementAt(i) != f) {
      equal = PR_FALSE;
    }
    ++i;
  }

  if (!equal || lineFloats.Count() != storedFloats.Count()) {
    NS_WARNING("nsBlockFrame::CheckFloats: Explicit float list is out of sync with float cache");
#if defined(DEBUG_roc)
    nsIFrameDebug::RootFrameList(GetPresContext(), stdout, 0);
    for (i = 0; i < lineFloats.Count(); ++i) {
      printf("Line float: %p\n", lineFloats.ElementAt(i));
    }
    for (i = 0; i < storedFloats.Count(); ++i) {
      printf("Stored float: %p\n", storedFloats.ElementAt(i));
    }
#endif
  }
#endif

  nsFrameList oofs = GetOverflowOutOfFlows();
  if (oofs.NotEmpty()) {
    // Floats that were pushed should be removed from our space
    // manager.  Otherwise the space manager's YMost or XMost might
    // be larger than necessary, causing this block to get an
    // incorrect desired height (or width).  Some of these floats
    // may not actually have been added to the space manager because
    // they weren't reflowed before being pushed; that's OK,
    // RemoveRegions will ignore them. It is safe to do this here
    // because we know from here on the space manager will only be
    // used for its XMost and YMost, not to place new floats and
    // lines.
    aState.mSpaceManager->RemoveTrailingRegions(oofs.FirstChild());
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Determines whether the collapsed margin carried out of the last line includes the margin-top of a line with clearance (in which case we must avoid collapsing that margin with our bottom margin)

Definition at line 1208 of file nsBlockFrame.cpp.

{
  line_iterator begin = begin_lines();
  line_iterator line = end_lines();

  while (PR_TRUE) {
    if (begin == line) {
      return PR_FALSE;
    }
    --line;
    if (line->mBounds.height != 0 || !line->CachedIsEmpty()) {
      return PR_FALSE;
    }
    if (line->HasClearance()) {
      return PR_TRUE;
    }
  }
  // not reached
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 6840 of file nsBlockFrame.cpp.

                                   {
  if (!(GetStateBits() & NS_BLOCK_HAS_LINE_CURSOR)) {
    return;
  }

  UnsetProperty(nsLayoutAtoms::lineCursorProperty);
  RemoveStateBits(NS_BLOCK_HAS_LINE_CURSOR);
}

Here is the caller graph for this function:

void nsBlockFrame::CollectFloats ( nsIFrame aFrame,
nsFrameList aList,
nsIFrame **  aTail,
PRBool  aFromOverflow,
PRBool  aCollectFromSiblings 
) [protected, inherited]

Definition at line 7547 of file nsBlockFrame.cpp.

                                                                                {
  while (aFrame) {
    // Don't descend into float containing blocks.
    if (!aFrame->IsFloatContainingBlock()) {
      nsIFrame *outOfFlowFrame = nsLayoutUtils::GetFloatFromPlaceholder(aFrame);
      if (outOfFlowFrame) {
        // Make sure that its parent is us. Otherwise we don't want
        // to mess around with it because it belongs to someone
        // else. I think this could happen if the overflow lines
        // contain a block descendant which owns its own floats.
        NS_ASSERTION(outOfFlowFrame->GetParent() == this,
                     "Out of flow frame doesn't have the expected parent");
        if (aFromOverflow) {
          nsAutoOOFFrameList oofs(this);
          oofs.mList.RemoveFrame(outOfFlowFrame);
        } else {
          mFloats.RemoveFrame(outOfFlowFrame);
          
        }
        aList.InsertFrame(nsnull, *aTail, outOfFlowFrame);
        *aTail = outOfFlowFrame;
      }

      CollectFloats(aFrame->GetFirstChild(nsnull), aList, aTail, aFromOverflow,
                      PR_TRUE);
    }
    if (!aCollectSiblings)
      break;
    aFrame = aFrame->GetNextSibling();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsBlockFrame::ComputeCombinedArea ( const nsHTMLReflowState aReflowState,
nsHTMLReflowMetrics aMetrics 
) [protected, inherited]

Definition at line 1538 of file nsBlockFrame.cpp.

{
  // Compute the combined area of our children
  // XXX_perf: This can be done incrementally.  It is currently one of
  // the things that makes incremental reflow O(N^2).
  nsRect area(0, 0, aMetrics.width, aMetrics.height);
  if (NS_STYLE_OVERFLOW_CLIP != aReflowState.mStyleDisplay->mOverflowX) {
    for (line_iterator line = begin_lines(), line_end = end_lines();
         line != line_end;
         ++line) {
      area.UnionRect(area, line->GetCombinedArea());
    }

    // Factor the bullet in; normally the bullet will be factored into
    // the line-box's combined area. However, if the line is a block
    // line then it won't; if there are no lines, it won't. So just
    // factor it in anyway (it can't hurt if it was already done).
    // XXXldb Can we just fix GetCombinedArea instead?
    if (mBullet) {
      area.UnionRect(area, mBullet->GetRect());
    }
  }
#ifdef NOISY_COMBINED_AREA
  ListTag(stdout);
  printf(": ca=%d,%d,%d,%d\n", area.x, area.y, area.width, area.height);
#endif

  aMetrics.mOverflowArea = area;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsBlockFrame::ComputeFinalSize ( const nsHTMLReflowState aReflowState,
nsBlockReflowState aState,
nsHTMLReflowMetrics aMetrics 
) [protected, virtual, inherited]

Definition at line 1229 of file nsBlockFrame.cpp.

{
  const nsMargin& borderPadding = aState.BorderPadding();
#ifdef NOISY_FINAL_SIZE
  ListTag(stdout);
  printf(": mY=%d mIsBottomMarginRoot=%s mPrevBottomMargin=%d bp=%d,%d\n",
         aState.mY, aState.GetFlag(BRS_ISBOTTOMMARGINROOT) ? "yes" : "no",
         aState.mPrevBottomMargin,
         borderPadding.top, borderPadding.bottom);
#endif

  // XXXldb Handling min-width/max-width stuff after reflowing children
  // seems wrong.  But IIRC this function only does more than a little
  // bit in rare cases (or something like that, I'm not really sure).
  // What are those cases, and do we get the wrong behavior?

  // Compute final width
  nscoord maxElementWidth = 0;
#ifdef NOISY_KIDXMOST
  printf("%p aState.mKidXMost=%d\n", this, aState.mKidXMost); 
#endif
  if (!HaveAutoWidth(aReflowState)) {
    // Use style defined width
    aMetrics.width = borderPadding.left + aReflowState.mComputedWidth +
      borderPadding.right;

    if (aState.GetFlag(BRS_COMPUTEMAXELEMENTWIDTH)) {
      if (GetStylePosition()->mWidth.GetUnit() == eStyleUnit_Percent) {
        // for percentage widths, |HaveAutoWidth| is sometimes true and
        // sometimes false (XXXldb check that this is really true), and
        // we want the max-element-width to be the same either way
        // (i.e., whether it's an uncontsrained reflow or a fixed-width
        // reflow).  Thus, do the same thing we do below.
        maxElementWidth = aState.mMaxElementWidth +
          borderPadding.left + borderPadding.right;
      } else {
        // When style defines the width use it for the max-element-width
        // because we can't shrink any smaller.
        maxElementWidth = aMetrics.width;
      }
    }
  }
  else {
    nscoord computedWidth;

    // XXX Misleading comment:
    // There are two options here. We either shrink wrap around our
    // contents or we fluff out to the maximum block width. Note:
    // We always shrink wrap when given an unconstrained width.
    if ((0 == (NS_BLOCK_SHRINK_WRAP & mState)) &&
        !aState.GetFlag(BRS_UNCONSTRAINEDWIDTH) &&
        !aState.GetFlag(BRS_SHRINKWRAPWIDTH)) {
      // XXX Misleading comment:
      // Set our width to the max width if we aren't already that
      // wide. Note that the max-width has nothing to do with our
      // contents (CSS2 section XXX)
      // XXXldb In what cases do we reach this code?
      computedWidth = borderPadding.left + aState.mContentArea.width +
        borderPadding.right;
    } else {
      computedWidth = aState.mKidXMost;
      if (NS_BLOCK_SPACE_MGR & mState) {
        // Include the space manager's state to properly account for the
        // extent of floated elements.
        nscoord xmost;
        if (aReflowState.mSpaceManager->XMost(xmost) &&
            computedWidth < xmost)
          computedWidth = xmost;
      }
      computedWidth += borderPadding.right;
    }

    if (aState.GetFlag(BRS_COMPUTEMAXELEMENTWIDTH)) {
      // Add in border and padding dimensions to already computed
      // max-element-width values.
      maxElementWidth = aState.mMaxElementWidth +
        borderPadding.left + borderPadding.right;
    }

    // Apply min/max values
    computedWidth -= borderPadding.left + borderPadding.right;
    aReflowState.ApplyMinMaxConstraints(&computedWidth, nsnull);
    computedWidth += borderPadding.left + borderPadding.right;
    if (aState.GetFlag(BRS_COMPUTEMAXELEMENTWIDTH)) {
      nscoord computedMinWidth = aReflowState.mComputedMinWidth +
        borderPadding.left + borderPadding.right;
      if (maxElementWidth < computedMinWidth &&
          GetStylePosition()->mMinWidth.GetUnit() != eStyleUnit_Percent) {
        maxElementWidth = computedMinWidth;
      }
    }
    aMetrics.width = computedWidth;

    // If we're shrink wrapping, then now that we know our final width we
    // need to do horizontal alignment of the inline lines and make sure
    // blocks are correctly sized and positioned. Any lines that need
    // final adjustment will have been marked as dirty
    if (aState.GetFlag(BRS_SHRINKWRAPWIDTH) && aState.GetFlag(BRS_NEEDRESIZEREFLOW)) {
      // If the closest block ancestor (and anything in between) is also
      // shrink wrap width, then we don't need to do this, because it
      // will reflow us after it calculates the final width
      PRBool rewrap = PR_TRUE;
      for (const nsHTMLReflowState *prs = aReflowState.parentReflowState;
           prs && prs->mComputedWidth == NS_SHRINKWRAPWIDTH;
           prs = prs->parentReflowState) {
        if (prs->frame->GetType() == nsLayoutAtoms::blockFrame ||
            prs->frame->GetType() == nsLayoutAtoms::areaFrame) {
          rewrap = PR_FALSE;
          break;
        }
      }
      if (rewrap) {
        // XXX Is this only used on things that are already NS_BLOCK_SPACE_MGR
        // and NS_BLOCK_MARGIN_ROOT?
        nsHTMLReflowState reflowState(aReflowState);

        reflowState.mComputedWidth = aMetrics.width - borderPadding.left -
                                     borderPadding.right;
        reflowState.reason = eReflowReason_Resize;
        reflowState.mSpaceManager->ClearRegions();

#ifdef DEBUG
        nscoord oldDesiredWidth = aMetrics.width;
#endif
        nsBlockReflowState state(reflowState, aState.mPresContext, this,
                                 aMetrics,
                                 aReflowState.mFlags.mHasClearance || (NS_BLOCK_MARGIN_ROOT & mState),
                                 (NS_BLOCK_MARGIN_ROOT & mState));
        // Don't try to pull up any new content from our next in flow. Shrinkwrapping
        // shouldn't make us shorter anyway.
        ReflowDirtyLines(state, PR_FALSE);
        aState.mY = state.mY;
        NS_ASSERTION(oldDesiredWidth == aMetrics.width, "bad desired width");
      }
    }
  }

  // Return bottom margin information
  // rbs says he hit this assertion occasionally (see bug 86947), so
  // just set the margin to zero and we'll figure out why later
  //NS_ASSERTION(aMetrics.mCarriedOutBottomMargin.IsZero(),
  //             "someone else set the margin");
  nscoord nonCarriedOutVerticalMargin = 0;
  if (!aState.GetFlag(BRS_ISBOTTOMMARGINROOT)) {
    // Apply rule from CSS 2.1 section 8.3.1. If we have some empty
    // line with clearance and a non-zero top margin and all
    // subsequent lines are empty, then we do not allow our childrens'
    // carried out bottom margin to be carried out of us and collapse
    // with our own bottom margin.
    if (CheckForCollapsedBottomMarginFromClearanceLine()) {
      // Convert the children's carried out margin to something that
      // we will include in our height
      nonCarriedOutVerticalMargin = aState.mPrevBottomMargin.get();
      aState.mPrevBottomMargin.Zero();
    }
    aMetrics.mCarriedOutBottomMargin = aState.mPrevBottomMargin;
  } else {
    aMetrics.mCarriedOutBottomMargin.Zero();
  }

  // Compute final height
  if (NS_UNCONSTRAINEDSIZE != aReflowState.mComputedHeight) {
    if (NS_FRAME_IS_COMPLETE(aState.mReflowStatus)) {
      // Figure out how much of the computed height should be
      // applied to this frame.
      nscoord computedHeightLeftOver = aReflowState.mComputedHeight;
      if (mPrevInFlow) {
        // Reduce the height by the computed height of prev-in-flows.
        for (nsIFrame* prev = mPrevInFlow; prev; prev = prev->GetPrevInFlow()) {
          nscoord contentHeight = prev->GetRect().height;
          if (prev == mPrevInFlow) {
            // subtract off the style top borderpadding to get the
            // content height
            contentHeight -= aReflowState.mComputedBorderPadding.top;
          }
          computedHeightLeftOver -= contentHeight;
        }
        // We may have stretched the frame beyond its computed height. Oh well.
        computedHeightLeftOver = PR_MAX(0, computedHeightLeftOver);
      }

      aMetrics.height = borderPadding.top + computedHeightLeftOver + borderPadding.bottom;
      if (computedHeightLeftOver > 0 &&
          aMetrics.height > aReflowState.availableHeight) {
        // We don't fit and we consumed some of the computed height,
        // so we should consume all the available height and then
        // break.  If our bottom border/padding straddles the break
        // point, then this will increase our height and push the
        // border/padding to the next page/column.
        aMetrics.height = aReflowState.availableHeight;
        aState.mReflowStatus |= NS_FRAME_NOT_COMPLETE;
      }
    }
    else {
      // Use the current height; continuations will take up the rest.
      // Do extend the height to at least consume the available
      // height, otherwise our left/right borders (for example) won't
      // extend all the way to the break.
      aMetrics.height = PR_MAX(aReflowState.availableHeight,
                               aState.mY + nonCarriedOutVerticalMargin);
    }

    // Don't carry out a bottom margin when our height is fixed.
    aMetrics.mCarriedOutBottomMargin.Zero();
  }
  else {
    nscoord autoHeight = aState.mY + nonCarriedOutVerticalMargin;

    // Shrink wrap our height around our contents.
    if (aState.GetFlag(BRS_ISBOTTOMMARGINROOT)) {
      // When we are a bottom-margin root make sure that our last
      // childs bottom margin is fully applied.
      // Apply the margin only if there's space for it.
      if (autoHeight < aState.mReflowState.availableHeight)
      {
        // Truncate bottom margin if it doesn't fit to our available height.
        autoHeight = PR_MIN(autoHeight + aState.mPrevBottomMargin.get(), aState.mReflowState.availableHeight);
      }
    }

    if (NS_BLOCK_SPACE_MGR & mState) {
      // Include the space manager's state to properly account for the
      // bottom margin of any floated elements; e.g., inside a table cell.
      nscoord ymost;
      if (aReflowState.mSpaceManager->YMost(ymost) &&
          autoHeight < ymost)
        autoHeight = ymost;
    }

    // Apply min/max values
    autoHeight -= borderPadding.top;
    nscoord oldAutoHeight = autoHeight;
    aReflowState.ApplyMinMaxConstraints(nsnull, &autoHeight);
    if (autoHeight != oldAutoHeight) {
      // Our min-height or max-height made our height change.  Don't carry out
      // our kids' bottom margins.
      aMetrics.mCarriedOutBottomMargin.Zero();
    }
    autoHeight += borderPadding.top + borderPadding.bottom;
    aMetrics.height = autoHeight;
  }

  aMetrics.ascent = mAscent;
  aMetrics.descent = aMetrics.height - aMetrics.ascent;

  if (aState.GetFlag(BRS_COMPUTEMAXELEMENTWIDTH)) {
    // Store away the final value
    aMetrics.mMaxElementWidth = maxElementWidth;
#ifdef DEBUG
    if (gNoisyMaxElementWidth) {
      IndentBy(stdout, gNoiseIndent);
      printf ("nsBlockFrame::CFS: %p returning MEW %d\n", 
              NS_STATIC_CAST(void*, this), aMetrics.mMaxElementWidth);
    }
#endif
  }

#ifdef DEBUG_blocks
  if (CRAZY_WIDTH(aMetrics.width) || CRAZY_HEIGHT(aMetrics.height)) {
    ListTag(stdout);
    printf(": WARNING: desired:%d,%d\n", aMetrics.width, aMetrics.height);
  }
  if (aState.GetFlag(BRS_COMPUTEMAXELEMENTWIDTH) &&
      (maxElementWidth > aMetrics.width))) {
    ListTag(stdout);
    printf(": WARNING: max-element-width:%d desired:%d,%d maxSize:%d,%d\n",
           maxElementWidth, aMetrics.width, aMetrics.height,
           aState.mReflowState.availableWidth,
           aState.mReflowState.availableHeight);
  }
#endif
#ifdef DEBUG
  if (gNoisyMaxElementWidth) {
    if (aState.GetFlag(BRS_COMPUTEMAXELEMENTWIDTH)) {
      IndentBy(stdout, gNoiseIndent);
      if (NS_UNCONSTRAINEDSIZE == aState.mReflowState.availableWidth) {
        printf("PASS1 ");
      }
      ListTag(stdout);
      printf(": max-element-width:%d desired:%d,%d maxSize:%d,%d\n",
             maxElementWidth, aMetrics.width, aMetrics.height,
             aState.mReflowState.availableWidth,
             aState.mReflowState.availableHeight);
    }
  }
#endif

  // If we're requested to update our maximum width, then compute it
  if (aState.GetFlag(BRS_COMPUTEMAXWIDTH)) {
    if (!HaveAutoWidth(aReflowState) &&
        aReflowState.mStylePosition->mWidth.GetUnit() != eStyleUnit_Percent) {
      aMetrics.mMaximumWidth = aMetrics.width;
    } else {
      // We need to add in for the right border/padding
      // The maximum width in the reflow state includes the left
      // border/padding but not the right.
      aMetrics.mMaximumWidth = aState.mMaximumWidth + borderPadding.right;
    }
#ifdef NOISY_MAXIMUM_WIDTH
    printf("nsBlockFrame::ComputeFinalSize block %p setting aMetrics.mMaximumWidth to %d\n", this, aMetrics.mMaximumWidth);
#endif
  }

  ComputeCombinedArea(aReflowState, aMetrics);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Implements nsIAnonymousContentCreator.

Definition at line 2082 of file nsComboboxControlFrame.cpp.

{
  // The frames used to display the combo box and the button used to popup the dropdown list
  // are created through anonymous content. The dropdown list is not created through anonymous
  // content because it's frame is initialized specifically for the drop-down case and it is placed
  // a special list referenced through NS_COMBO_FRAME_POPUP_LIST_INDEX to keep separate from the
  // layout of the display and button. 
  //
  // Note: The value attribute of the display content is set when an item is selected in the dropdown list.
  // If the content specified below does not honor the value attribute than nothing will be displayed.
  // In addition, if the frame created by content below for does not implement the nsIFormControlFrame 
  // interface and honor the SetSuggestedSize method the placement and size of the display area will not
  // match what is normally desired for a combobox.


  // For now the content that is created corresponds to two input buttons. It would be better to create the
  // tag as something other than input, but then there isn't any way to create a button frame since it
  // isn't possible to set the display type in CSS2 to create a button frame.

    // create content used for display
  //nsIAtom* tag = NS_NewAtom("mozcombodisplay");

  // Add a child text content node for the label

  nsNodeInfoManager *nimgr = mContent->GetNodeInfo()->NodeInfoManager();

  nsCOMPtr<nsITextContent> labelContent;
  NS_NewTextNode(getter_AddRefs(labelContent), nimgr);

  if (labelContent) {
    // set the value of the text node
    mDisplayContent.swap(labelContent);
    mListControlFrame->GetSelectedIndex(&mDisplayedIndex);
    if (mDisplayedIndex != -1) {
      mListControlFrame->GetOptionText(mDisplayedIndex, mDisplayedOptionText);
    }
    ActuallyDisplayText(PR_FALSE);

    nsCOMPtr<nsINodeInfo> nodeInfo;
    nimgr->GetNodeInfo(nsHTMLAtoms::input, nsnull, kNameSpaceID_None,
                       getter_AddRefs(nodeInfo));

    aChildList.AppendElement(mDisplayContent);

    // create button which drops the list down
    nsCOMPtr<nsIContent> btnContent;
    nsresult rv = NS_NewHTMLElement(getter_AddRefs(btnContent), nodeInfo);
    NS_ENSURE_SUCCESS(rv, rv);

    // make someone to listen to the button. If its pressed by someone like Accessibility
    // then open or close the combo box.
    nsCOMPtr<nsIDOMEventReceiver> eventReceiver(do_QueryInterface(btnContent));
    if (eventReceiver) {
       mButtonListener = new nsComboButtonListener(this);
       eventReceiver->AddEventListenerByIID(mButtonListener, NS_GET_IID(nsIDOMMouseListener));
    }

    btnContent->SetAttr(kNameSpaceID_None, nsHTMLAtoms::type, NS_LITERAL_STRING("button"), PR_FALSE);
    // Set tabindex="-1" so that the button is not tabbable
    btnContent->SetAttr(kNameSpaceID_None, nsHTMLAtoms::tabindex,
                        NS_LITERAL_STRING("-1"), PR_FALSE);

    aChildList.AppendElement(btnContent);
  }

  return NS_OK;
}

Here is the call graph for this function:

nsresult nsBlockFrame::CreateContinuationFor ( nsBlockReflowState aState,
nsLineBox aLine,
nsIFrame aFrame,
PRBool aMadeNewFrame 
) [protected, virtual, inherited]

Create a continuation, if necessary, for aFrame.

Place it in aLine if aLine is not null. Set aMadeNewFrame to PR_TRUE if a new frame is created.

Definition at line 4255 of file nsBlockFrame.cpp.

{
  aMadeNewFrame = PR_FALSE;
  nsresult rv;
  nsIFrame* nextInFlow;
  rv = CreateNextInFlow(aState.mPresContext, this, aFrame, nextInFlow);
  if (NS_FAILED(rv)) {
    return rv;
  }
  if (nsnull != nextInFlow) {
    aMadeNewFrame = PR_TRUE;
    if (aLine) { 
      aLine->SetChildCount(aLine->GetChildCount() + 1);
    }
  }
#ifdef DEBUG
  VerifyLines(PR_FALSE);
#endif
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2039 of file nsComboboxControlFrame.cpp.

{
  if (mGoodToGo) {
    return NS_OK;
  }

  nsIPresShell *shell = aPresContext->PresShell();
  nsStyleSet *styleSet = shell->StyleSet();

  nsresult rv = NS_NewBlockFrame(shell, (nsIFrame**)&mDisplayFrame, NS_BLOCK_SPACE_MGR);
  if (NS_FAILED(rv)) { return rv; }
  if (!mDisplayFrame) { return NS_ERROR_NULL_POINTER; }

  // create the style context for the anonymous frame
  nsRefPtr<nsStyleContext> styleContext;
  styleContext = styleSet->ResolvePseudoStyleFor(mContent, 
                                                 nsCSSAnonBoxes::mozDisplayComboboxControlFrame,
                                                 mStyleContext);
  if (!styleContext) { return NS_ERROR_NULL_POINTER; }

  // create a text frame and put it inside the block frame
  rv = NS_NewTextFrame(shell, &mTextFrame);
  if (NS_FAILED(rv)) { return rv; }
  if (!mTextFrame) { return NS_ERROR_NULL_POINTER; }
  nsRefPtr<nsStyleContext> textStyleContext;
  textStyleContext = styleSet->ResolveStyleForNonElement(styleContext);
  if (!textStyleContext) { return NS_ERROR_NULL_POINTER; }
  nsCOMPtr<nsIContent> content(do_QueryInterface(mDisplayContent));
  mTextFrame->Init(aPresContext, content, mDisplayFrame, textStyleContext, nsnull);
  mTextFrame->SetInitialChildList(aPresContext, nsnull, nsnull);

  aPresContext->FrameManager()->SetPrimaryFrameFor(content, mTextFrame);

  rv = mDisplayFrame->Init(aPresContext, mContent, this, styleContext, nsnull);
  if (NS_FAILED(rv)) { return rv; }

  mDisplayFrame->SetInitialChildList(aPresContext, nsnull, mTextFrame);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsComboboxControlFrame::CreateFrameFor ( nsPresContext aPresContext,
nsIContent aContent,
nsIFrame **  aFrame 
) [virtual]

Implements nsIAnonymousContentCreator.

Definition at line 2152 of file nsComboboxControlFrame.cpp.

{ 
  NS_PRECONDITION(nsnull != aFrame, "null ptr");
  NS_PRECONDITION(nsnull != aContent, "null ptr");
  NS_PRECONDITION(nsnull != aPresContext, "null ptr");

  *aFrame = nsnull;
  NS_ASSERTION(mDisplayContent != nsnull, "mDisplayContent can't be null!");

  if (!mGoodToGo) {
    return NS_ERROR_FAILURE;
  }

  nsCOMPtr<nsIContent> content(do_QueryInterface(mDisplayContent));
  if (aContent == content.get()) {
    // Get PresShell
    nsIPresShell *shell = aPresContext->PresShell();
    nsStyleSet *styleSet = shell->StyleSet();

    // Start by by creating a containing frame
    nsresult rv = NS_NewBlockFrame(shell, (nsIFrame**)&mDisplayFrame, NS_BLOCK_SPACE_MGR);
    if (NS_FAILED(rv))  { return rv; }
    if (!mDisplayFrame) { return NS_ERROR_NULL_POINTER; }

    // create the style context for the anonymous block frame
    nsRefPtr<nsStyleContext> styleContext;
    styleContext = styleSet->ResolvePseudoStyleFor(mContent, 
                                                   nsCSSAnonBoxes::mozDisplayComboboxControlFrame,
                                                   mStyleContext);
    if (!styleContext) { return NS_ERROR_NULL_POINTER; }

    // Create a text frame and put it inside the block frame
    rv = NS_NewTextFrame(shell, &mTextFrame);
    if (NS_FAILED(rv)) { return rv; }
    if (!mTextFrame)   { return NS_ERROR_NULL_POINTER; }
    nsRefPtr<nsStyleContext> textStyleContext;
    textStyleContext = styleSet->ResolveStyleForNonElement(styleContext);
    if (!textStyleContext) { return NS_ERROR_NULL_POINTER; }

    // initialize the text frame
    mTextFrame->Init(aPresContext, content, mDisplayFrame, textStyleContext, nsnull);
    mTextFrame->SetInitialChildList(aPresContext, nsnull, nsnull);

    /*nsCOMPtr<nsIFrameManager> frameManager;
    rv = shell->GetFrameManager(getter_AddRefs(frameManager));
    if (NS_FAILED(rv)) { return rv; }
    if (!frameManager) { return NS_ERROR_NULL_POINTER; }
    frameManager->SetPrimaryFrameFor(content, mTextFrame);
    */

    rv = mDisplayFrame->Init(aPresContext, mContent, this, styleContext, nsnull);
    if (NS_FAILED(rv)) { return rv; }

    mDisplayFrame->SetInitialChildList(aPresContext, nsnull, mTextFrame);
    *aFrame = mDisplayFrame;
    return NS_OK;
  }

  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

void nsBlockFrame::DeleteLine ( nsBlockReflowState aState,
nsLineList::iterator  aLine,
nsLineList::iterator  aLineEnd 
) [protected, inherited]

Definition at line 2587 of file nsBlockFrame.cpp.

{
  NS_PRECONDITION(0 == aLine->GetChildCount(), "can't delete !empty line");
  if (0 == aLine->GetChildCount()) {
    NS_ASSERTION(aState.mCurrentLine == aLine,
                 "using function more generally than designed, "
                 "but perhaps OK now");
    nsLineBox *line = aLine;
    aLine = mLines.erase(aLine);
    aState.FreeLineBox(line);
    // Mark the previous margin of the next line dirty since we need to
    // recompute its top position.
    if (aLine != aLineEnd)
      aLine->MarkPreviousMarginDirty();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsBlockFrame::DeleteNextInFlowChild ( nsPresContext aPresContext,
nsIFrame aNextInFlow 
) [virtual, inherited]

Definition at line 5914 of file nsBlockFrame.cpp.

{
  nsIFrame* prevInFlow = aNextInFlow->GetPrevInFlow();
  NS_PRECONDITION(prevInFlow, "bad next-in-flow");
  NS_PRECONDITION(IsChild(aNextInFlow), "bad geometric parent");

#ifdef IBMBIDI
  if (!(prevInFlow->GetStateBits() & NS_FRAME_IS_BIDI) ||
      (NS_STATIC_CAST(nsIFrame*,
                      aPresContext->PropertyTable()->GetProperty(prevInFlow, nsLayoutAtoms::nextBidi)) !=
       aNextInFlow))
#endif // IBMBIDI
    DoRemoveFrame(aNextInFlow);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from nsBlockFrame.

Definition at line 2227 of file nsComboboxControlFrame.cpp.

{
  // Revoke queued RedisplayTextEvents
  if (mEventQueueService) {
    nsCOMPtr<nsIEventQueue> eventQueue;
    mEventQueueService->GetSpecialEventQueue(nsIEventQueueService::UI_THREAD_EVENT_QUEUE,
                                             getter_AddRefs(eventQueue));
    if (eventQueue) {
      eventQueue->RevokeEvents(this);
    }
  }

  nsFormControlFrame::RegUnRegAccessKey(mPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_FALSE);

  if (mDroppedDown) {
    // Get parent view
    nsIFrame * listFrame;
    if (NS_OK == mListControlFrame->QueryInterface(NS_GET_IID(nsIFrame), (void **)&listFrame)) {
      nsIView* view = listFrame->GetView();
      NS_ASSERTION(view, "nsComboboxControlFrame view is null");
      if (view) {
         nsIWidget* widget = view->GetWidget();
        if (widget)
          widget->CaptureRollupEvents(this, PR_FALSE, PR_TRUE);
      }
    }
  }

   // Cleanup frames in popup child list
  mPopupFrames.DestroyFrames(aPresContext);

  if (!mGoodToGo) {
    if (mDisplayFrame) {
      aPresContext->PresShell()->FrameConstructor()->
        RemoveMappingsForFrameSubtree(mDisplayFrame, nsnull);
      mDisplayFrame->Destroy(aPresContext);
      mDisplayFrame=nsnull;
    }
  }

  return nsAreaFrame::Destroy(aPresContext);
}

Here is the call graph for this function:

Sets whether the parser is done adding children.

Parameters:
aIsDonewhether the parser is done adding children

Implements nsISelectControlFrame.

Definition at line 1883 of file nsComboboxControlFrame.cpp.

{
  nsISelectControlFrame* listFrame = nsnull;
  nsresult rv = NS_ERROR_FAILURE;
  if (mDropdownFrame != nsnull) {
    rv = CallQueryInterface(mDropdownFrame, &listFrame);
    if (listFrame) {
      rv = listFrame->DoneAddingChildren(aIsDone);
    }
  }
  return rv;
}

Here is the call graph for this function:

nsresult nsBlockFrame::DoReflowInlineFrames ( nsBlockReflowState aState,
nsLineLayout aLineLayout,
line_iterator  aLine,
PRBool aKeepReflowGoing,
PRUint8 aLineReflowStatus,
PRBool  aUpdateMaximumWidth,
PRBool  aDamageDirtyArea,
PRBool  aAllowPullUp 
) [protected, inherited]

Definition at line 3827 of file nsBlockFrame.cpp.

{
  // Forget all of the floats on the line
  aLine->FreeFloats(aState.mFloatCacheFreeList);
  aState.mFloatCombinedArea.SetRect(0, 0, 0, 0);

  // Setup initial coordinate system for reflowing the inline frames
  // into. Apply a previous block frame's bottom margin first.
  if (ShouldApplyTopMargin(aState, aLine)) {
    aState.mY += aState.mPrevBottomMargin.get();
  }
  aState.GetAvailableSpace();
  PRBool impactedByFloats = aState.IsImpactedByFloat() ? PR_TRUE : PR_FALSE;
  aLine->SetLineIsImpactedByFloat(impactedByFloats);
#ifdef REALLY_NOISY_REFLOW
  printf("nsBlockFrame::DoReflowInlineFrames %p impacted = %d\n",
         this, impactedByFloats);
#endif

  const nsMargin& borderPadding = aState.BorderPadding();
  nscoord x = aState.mAvailSpaceRect.x + borderPadding.left;
  nscoord availWidth = aState.mAvailSpaceRect.width;
  nscoord availHeight;
  if (aState.GetFlag(BRS_UNCONSTRAINEDHEIGHT)) {
    availHeight = NS_UNCONSTRAINEDSIZE;
  }
  else {
    /* XXX get the height right! */
    availHeight = aState.mAvailSpaceRect.height;
  }
  if (aUpdateMaximumWidth) {
    availWidth = NS_UNCONSTRAINEDSIZE;
  }
  aLineLayout.BeginLineReflow(x, aState.mY,
                              availWidth, availHeight,
                              impactedByFloats,
                              PR_FALSE /*XXX isTopOfPage*/);

  // XXX Unfortunately we need to know this before reflowing the first
  // inline frame in the line. FIX ME.
  if ((0 == aLineLayout.GetLineNumber()) &&
      (NS_BLOCK_HAS_FIRST_LETTER_STYLE & mState)) {
    aLineLayout.SetFirstLetterStyleOK(PR_TRUE);
  }

  // keep track of the last overflow float in case we need to undo any new additions
  nsIFrame* lastPlaceholder = aState.mOverflowPlaceholders.LastChild();

  // Reflow the frames that are already on the line first
  nsresult rv = NS_OK;
  PRUint8 lineReflowStatus = LINE_REFLOW_OK;
  PRInt32 i;
  nsIFrame* frame = aLine->mFirstChild;
  aLine->SetHasPercentageChild(PR_FALSE); // To be set by ReflowInlineFrame below
  // Determine whether this is a line of placeholders for out-of-flow
  // continuations
  PRBool isContinuingPlaceholders = PR_FALSE;

  // need to repeatedly call GetChildCount here, because the child
  // count can change during the loop!
  for (i = 0; i < aLine->GetChildCount(); i++) {
    if (IsContinuationPlaceholder(frame)) {
      isContinuingPlaceholders = PR_TRUE;
    }
    rv = ReflowInlineFrame(aState, aLineLayout, aLine, frame,
                           &lineReflowStatus);
    if (NS_FAILED(rv)) {
      return rv;
    }
    if (LINE_REFLOW_OK != lineReflowStatus) {
      // It is possible that one or more of next lines are empty
      // (because of DeleteNextInFlowChild). If so, delete them now
      // in case we are finished.
      ++aLine;
      while ((aLine != end_lines()) && (0 == aLine->GetChildCount())) {
        // XXX Is this still necessary now that DeleteNextInFlowChild
        // uses DoRemoveFrame?
        nsLineBox *toremove = aLine;
        aLine = mLines.erase(aLine);
        NS_ASSERTION(nsnull == toremove->mFirstChild, "bad empty line");
        aState.FreeLineBox(toremove);
      }
      --aLine;

      if (LINE_REFLOW_TRUNCATED == lineReflowStatus) {
        // Don't push any lines if we just want to calculate the maximum width
        if (!aUpdateMaximumWidth) {
          // Push the line with the truncated float 
          PushTruncatedPlaceholderLine(aState, aLine, lastPlaceholder, *aKeepReflowGoing);
        }
      }
      break;
    }
    frame = frame->GetNextSibling();
  }

  // Don't pull up new frames into lines with continuation placeholders
  if (!isContinuingPlaceholders && aAllowPullUp) {
    // Pull frames and reflow them until we can't
    while (LINE_REFLOW_OK == lineReflowStatus) {
      rv = PullFrame(aState, aLine, aDamageDirtyArea, frame);
      if (NS_FAILED(rv)) {
        return rv;
      }
      if (nsnull == frame) {
        break;
      }

      while (LINE_REFLOW_OK == lineReflowStatus) {
        PRInt32 oldCount = aLine->GetChildCount();
        rv = ReflowInlineFrame(aState, aLineLayout, aLine, frame,
                               &lineReflowStatus);
        if (NS_FAILED(rv)) {
          return rv;
        }
        if (aLine->GetChildCount() != oldCount) {
          // We just created a continuation for aFrame AND its going
          // to end up on this line (e.g. :first-letter
          // situation). Therefore we have to loop here before trying
          // to pull another frame.
          frame = frame->GetNextSibling();
        }
        else {
          break;
        }
      }
    }
  } 

  if (LINE_REFLOW_REDO == lineReflowStatus) {
    // This happens only when we have a line that is impacted by
    // floats and the first element in the line doesn't fit with
    // the floats.
    //
    // What we do is to advance past the first float we find and
    // then reflow the line all over again.
    NS_ASSERTION(aState.IsImpactedByFloat(),
                 "redo line on totally empty line");
    NS_ASSERTION(NS_UNCONSTRAINEDSIZE != aState.mAvailSpaceRect.height,
                 "unconstrained height on totally empty line");


    if (aState.mAvailSpaceRect.height > 0) {
      aState.mY += aState.mAvailSpaceRect.height;
    } else {
      NS_ASSERTION(NS_UNCONSTRAINEDSIZE != aState.mReflowState.availableHeight,
                   "We shouldn't be running out of height here");
      if (NS_UNCONSTRAINEDSIZE == aState.mReflowState.availableHeight) {
        // just move it down a bit to try to get out of this mess
        aState.mY += 1;
      } else {
        // There's nowhere to retry placing the line. Just treat it as if
        // we placed the float but it was truncated so we need this line
        // to go to the next page/column.
        lineReflowStatus = LINE_REFLOW_TRUNCATED;
        // Don't push any lines if we just want to calculate the maximum width
        if (!aUpdateMaximumWidth) {
          // Push the line that didn't fit
          PushTruncatedPlaceholderLine(aState, aLine, lastPlaceholder, *aKeepReflowGoing);
        }
      }
    }
      
    // We don't want to advance by the bottom margin anymore (we did it
    // once at the beginning of this function, which will just be called
    // again), and we certainly don't want to go back if it's negative
    // (infinite loop, bug 153429).
    aState.mPrevBottomMargin.Zero();

    // XXX: a small optimization can be done here when paginating:
    // if the new Y coordinate is past the end of the block then
    // push the line and return now instead of later on after we are
    // past the float.
  }
  else if (LINE_REFLOW_TRUNCATED != lineReflowStatus) {
    // If we are propagating out a break-before status then there is
    // no point in placing the line.
    if (!NS_INLINE_IS_BREAK_BEFORE(aState.mReflowStatus)) {
      if (PlaceLine(aState, aLineLayout, aLine, aKeepReflowGoing, aUpdateMaximumWidth)) {
        UndoSplitPlaceholders(aState, lastPlaceholder); // undo since we pushed the current line
      }
    }
  }
  *aLineReflowStatus = lineReflowStatus;

  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsBlockFrame::DoRemoveFrame ( nsIFrame aDeletedFrame,
PRBool  aDestroyFrames = PR_TRUE 
) [inherited]

does all the real work for removing aDeletedFrame from this finds the line containing aFrame.

handled continued frames marks lines dirty as needed

Parameters:
aDestroyFramesif false then we don't actually destroy the frame or its next in flows, we just remove them. This does NOT work on out of flow frames so always use PR_TRUE for out of flows.

Definition at line 5692 of file nsBlockFrame.cpp.

{
  // Clear our line cursor, since our lines may change.
  ClearLineCursor();
        
  if (aDeletedFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) {
    NS_ASSERTION(aDestroyFrames, "We can't not destroy out of flows");
    DoRemoveOutOfFlowFrame(aDeletedFrame);
    return NS_OK;
  }
  
  nsPresContext* presContext = GetPresContext();
  nsIPresShell* presShell = presContext->PresShell();

  PRBool isPlaceholder = nsLayoutAtoms::placeholderFrame == aDeletedFrame->GetType();
  if (isPlaceholder) {
    nsFrameList* overflowPlaceholders = GetOverflowPlaceholders();
    if (overflowPlaceholders && overflowPlaceholders->RemoveFrame(aDeletedFrame)) {
      nsIFrame* nif = aDeletedFrame->GetNextInFlow();
      if (aDestroyFrames) {
        aDeletedFrame->Destroy(presContext);
      } else {
        aDeletedFrame->SetNextSibling(nsnull);
      }
      return RemoveBlockChild(nif, aDestroyFrames);
    }
  }
  
  // Find the line and the previous sibling that contains
  // deletedFrame; we also find the pointer to the line.
  nsLineList::iterator line = mLines.begin(),
                       line_end = mLines.end();
  PRBool searchingOverflowList = PR_FALSE;
  nsIFrame* prevSibling = nsnull;
  // Make sure we look in the overflow lines even if the normal line
  // list is empty
  TryAllLines(&line, &line_end, &searchingOverflowList);
  while (line != line_end) {
    nsIFrame* frame = line->mFirstChild;
    PRInt32 n = line->GetChildCount();
    while (--n >= 0) {
      if (frame == aDeletedFrame) {
        goto found_frame;
      }
      prevSibling = frame;
      frame = frame->GetNextSibling();
    }
    ++line;
    TryAllLines(&line, &line_end, &searchingOverflowList);
  }
found_frame:;
  if (line == line_end) {
    NS_ERROR("can't find deleted frame in lines");
    return NS_ERROR_FAILURE;
  }

  if (prevSibling && !prevSibling->GetNextSibling()) {
    // We must have found the first frame in the overflow line list. So
    // there is no prevSibling
    prevSibling = nsnull;
  }
  NS_ASSERTION(!prevSibling || prevSibling->GetNextSibling() == aDeletedFrame, "bad prevSibling");

  while ((line != line_end) && (nsnull != aDeletedFrame)) {
    NS_ASSERTION(this == aDeletedFrame->GetParent(), "messed up delete code");
    NS_ASSERTION(line->Contains(aDeletedFrame), "frame not in line");

    // If the frame being deleted is the last one on the line then
    // optimize away the line->Contains(next-in-flow) call below.
    PRBool isLastFrameOnLine = (1 == line->GetChildCount() ||
                                line->LastChild() == aDeletedFrame);

    // Remove aDeletedFrame from the line
    nsIFrame* nextFrame = aDeletedFrame->GetNextSibling();
    if (line->mFirstChild == aDeletedFrame) {
      // We should be setting this to null if aDeletedFrame
      // is the only frame on the line. HOWEVER in that case
      // we will be removing the line anyway, see below.
      line->mFirstChild = nextFrame;
    }

    // Hmm, this won't do anything if we're removing a frame in the first
    // overflow line... Hopefully doesn't matter
    --line;
    if (line != line_end && !line->IsBlock()) {
      // Since we just removed a frame that follows some inline
      // frames, we need to reflow the previous line.
      line->MarkDirty();
    }
    ++line;

    // Take aDeletedFrame out of the sibling list. Note that
    // prevSibling will only be nsnull when we are deleting the very
    // first frame in the main or overflow list.
    if (prevSibling) {
      prevSibling->SetNextSibling(nextFrame);
    }

    // Update the child count of the line to be accurate
    PRInt32 lineChildCount = line->GetChildCount();
    lineChildCount--;
    line->SetChildCount(lineChildCount);

    // Destroy frame; capture its next-in-flow first in case we need
    // to destroy that too.
    nsIFrame* deletedNextInFlow = aDeletedFrame->GetNextInFlow();
#ifdef NOISY_REMOVE_FRAME
    printf("DoRemoveFrame: %s line=%p frame=",
           searchingOverflowList?"overflow":"normal", line.get());
    nsFrame::ListTag(stdout, aDeletedFrame);
    printf(" prevSibling=%p deletedNextInFlow=%p\n", prevSibling, deletedNextInFlow);
#endif

    if (aDestroyFrames) {
      aDeletedFrame->Destroy(presContext);
    } else {
      aDeletedFrame->SetNextSibling(nsnull);
    }
    aDeletedFrame = deletedNextInFlow;

    PRBool haveAdvancedToNextLine = PR_FALSE;
    // If line is empty, remove it now.
    if (0 == lineChildCount) {
#ifdef NOISY_REMOVE_FRAME
        printf("DoRemoveFrame: %s line=%p became empty so it will be removed\n",
               searchingOverflowList?"overflow":"normal", line.get());
#endif
      nsLineBox *cur = line;
      if (!searchingOverflowList) {
        line = mLines.erase(line);
        // Invalidate the space taken up by the line.
        // XXX We need to do this if we're removing a frame as a result of
        // a call to RemoveFrame(), but we may not need to do this in all
        // cases...
        nsRect lineCombinedArea(cur->GetCombinedArea());
#ifdef NOISY_BLOCK_INVALIDATE
        printf("%p invalidate 10 (%d, %d, %d, %d)\n",
               this, lineCombinedArea.x, lineCombinedArea.y,
               lineCombinedArea.width, lineCombinedArea.height);
#endif
        Invalidate(lineCombinedArea);
      } else {
        nsLineList* lineList = RemoveOverflowLines();
        line = lineList->erase(line);
        if (!lineList->empty()) {
          SetOverflowLines(lineList);
        }
      }
      cur->Destroy(presShell);

      // If we're removing a line, ReflowDirtyLines isn't going to
      // know that it needs to slide lines unless something is marked
      // dirty.  So mark the previous margin of the next line dirty if
      // there is one.
      if (line != line_end) {
        line->MarkPreviousMarginDirty();
      }
      haveAdvancedToNextLine = PR_TRUE;
    } else {
      // Make the line that just lost a frame dirty, and advance to
      // the next line.
      if (!deletedNextInFlow || isLastFrameOnLine ||
          !line->Contains(deletedNextInFlow)) {
        line->MarkDirty();
        ++line;
        haveAdvancedToNextLine = PR_TRUE;
      }
    }

    if (deletedNextInFlow) {
      // Continuations for placeholder frames don't always appear in
      // consecutive lines. So for placeholders, just continue the slow easy way.
      if (isPlaceholder) {
        return RemoveBlockChild(deletedNextInFlow, aDestroyFrames);
      }

      // See if we should keep looking in the current flow's line list.
      if (deletedNextInFlow->GetParent() != this) {
        // The deceased frames continuation is not a child of the
        // current block. So break out of the loop so that we advance
        // to the next parent.
        break;
      }

      // If we advanced to the next line then check if we should switch to the
      // overflow line list.
      if (haveAdvancedToNextLine) {
        if (line != line_end && !searchingOverflowList &&
            !line->Contains(deletedNextInFlow)) {
          // We have advanced to the next *normal* line but the next-in-flow
          // is not there - force a switch to the overflow line list.
          line = line_end;
        }

        PRBool wasSearchingOverflowList = searchingOverflowList;
        TryAllLines(&line, &line_end, &searchingOverflowList);
        if (NS_UNLIKELY(searchingOverflowList && !wasSearchingOverflowList &&
                        prevSibling)) {
          // We switched to the overflow line list and we have a prev sibling
          // (in the main list), in this case we don't want to pick up any
          // sibling list from the deceased frames (bug 344557).
          prevSibling->SetNextSibling(nsnull);
          prevSibling = nsnull;
        }
#ifdef NOISY_REMOVE_FRAME
        printf("DoRemoveFrame: now on %s line=%p prevSibling=%p\n",
               searchingOverflowList?"overflow":"normal", line.get(),
               prevSibling);
#endif
      }
    }
  }

#ifdef DEBUG
  VerifyLines(PR_TRUE);
#endif

  // Advance to next flow block if the frame has more continuations
  return RemoveBlockChild(aDeletedFrame, aDestroyFrames);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsBlockFrame::DoRemoveOutOfFlowFrame ( nsIFrame aFrame) [static, protected, inherited]

Definition at line 5627 of file nsBlockFrame.cpp.

{
  // First remove aFrame's next in flow
  nsIFrame* nextInFlow = aFrame->GetNextInFlow();
  if (nextInFlow) {
    nsBlockFrame::DoRemoveOutOfFlowFrame(nextInFlow);
  }
  // Now remove aFrame
  const nsStyleDisplay* display = aFrame->GetStyleDisplay();

  // The containing block is always the parent of aFrame.
  nsBlockFrame* block = (nsBlockFrame*)aFrame->GetParent();
  // Remove aFrame from the appropriate list. 
  if (display->IsAbsolutelyPositioned()) {
    block->mAbsoluteContainer.RemoveFrame(block,
                                          block->mAbsoluteContainer.GetChildListName(),
                                          aFrame);
    aFrame->Destroy(aFrame->GetPresContext());
  }
  else {
    // This also destroys the frame.
    block->RemoveFloat(aFrame);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsBlockFrame::DrainOverflowLines ( nsBlockReflowState aState) [protected, inherited]

grab overflow lines from this block's prevInFlow, and make them part of this block's mLines list.

Returns:
PR_TRUE if any lines were drained.

Definition at line 4912 of file nsBlockFrame.cpp.

{
#ifdef DEBUG
  VerifyOverflowSituation();
#endif
  nsLineList* overflowLines = nsnull;
  nsLineList* ourOverflowLines = nsnull;

  // First grab the prev-in-flows overflow lines
  nsBlockFrame* prevBlock = (nsBlockFrame*) mPrevInFlow;
  if (prevBlock) {
    overflowLines = prevBlock->RemoveOverflowLines();
    if (overflowLines) {
      NS_ASSERTION(! overflowLines->empty(),
                   "overflow lines should never be set and empty");
      // Make all the frames on the overflow line list mine
      nsIFrame* frame = overflowLines->front()->mFirstChild;
      while (nsnull != frame) {
        ReparentFrame(frame, prevBlock, this);

        // Get the next frame
        frame = frame->GetNextSibling();
      }

      // make the overflow out-of-flow frames mine too
      nsAutoOOFFrameList oofs(prevBlock);
      if (oofs.mList.NotEmpty()) {
        for (nsIFrame* f = oofs.mList.FirstChild(); f; f = f->GetNextSibling()) {
          ReparentFrame(f, prevBlock, this);
        }
        mFloats.InsertFrames(nsnull, nsnull, oofs.mList.FirstChild());
        oofs.mList.SetFrames(nsnull);
      }
    }
    
    // The lines on the overflow list have already been marked dirty and their
    // previous margins marked dirty also.
  }

  // Don't need to reparent frames in our own overflow lines/oofs, because they're
  // already ours. But we should put overflow floats back in mFloats.
  ourOverflowLines = RemoveOverflowLines();
  if (ourOverflowLines) {
    nsAutoOOFFrameList oofs(this);
    if (oofs.mList.NotEmpty()) {
      // The overflow floats go after our regular floats
      mFloats.AppendFrames(nsnull, oofs.mList.FirstChild());
      oofs.mList.SetFrames(nsnull);
    }
  }

  if (!overflowLines && !ourOverflowLines) {
    // nothing to do; always the case for non-constrained-height reflows
    return PR_FALSE;
  }

  NS_ASSERTION(aState.mOverflowPlaceholders.IsEmpty(),
               "Should have no overflow placeholders yet");

  // HANDLING CONTINUATION PLACEHOLDERS (floats only at the moment, because
  // abs-pos frames don't have continuations)
  //
  // All continuation placeholders need to be moved to the front of
  // our line list. We also need to maintain the invariant that at
  // most one frame for a given piece of content is in our normal
  // child list, by pushing all but the first placeholder to our
  // overflow placeholders list.
  // 
  // One problem we have to deal with is that some of these
  // continuation placeholders may have been donated to us by a
  // descendant block that was complete. We need to push them down to
  // a lower block if possible.
  //
  // We keep the lists ordered so that prev in flows come before their
  // next in flows. We do not worry about properly ordering the
  // placeholders for different content relative to each other until
  // the end. Then we sort them.
  //
  // When we're shuffling placeholders we also need to shuffle their out of
  // flows to match. As we put placeholders into keepPlaceholders, we unhook
  // their floats from mFloats. Later we put the floats back based on the
  // order of the placeholders.
  nsIFrame* lastOP = nsnull;
  nsFrameList keepPlaceholders;
  nsFrameList keepOutOfFlows;
  nsIFrame* lastKP = nsnull;
  nsIFrame* lastKOOF = nsnull;
  nsLineList* lineLists[3] = { overflowLines, &mLines, ourOverflowLines };
  static const PRPackedBool searchFirstLinesOnly[3] = { PR_FALSE, PR_TRUE, PR_FALSE };
  for (PRInt32 i = 0; i < 3; ++i) {
    nsLineList* ll = lineLists[i];
    if (ll && !ll->empty()) {
      line_iterator iter = ll->begin();
      line_iterator iter_end = ll->end();
      nsIFrame* lastFrame = nsnull;
      while (iter != iter_end) {
        PRUint32 n = iter->GetChildCount();
        if (n == 0 || !IsContinuationPlaceholder(iter->mFirstChild)) {
          if (lastFrame) {
            lastFrame->SetNextSibling(iter->mFirstChild);
          }
          if (searchFirstLinesOnly[i]) {
            break;
          }
          lastFrame = iter->LastChild();
          ++iter;
        } else {
          nsLineBox* line = iter;
          iter = ll->erase(iter);
          nsIFrame* next;
          for (nsPlaceholderFrame* f = NS_STATIC_CAST(nsPlaceholderFrame*, line->mFirstChild);
               n > 0; --n, f = NS_STATIC_CAST(nsPlaceholderFrame*, next)) {
            NS_ASSERTION(IsContinuationPlaceholder(f),
                         "Line frames should all be continuation placeholders");
            next = f->GetNextSibling();
            nsIFrame* fpif = f->GetPrevInFlow();
            nsIFrame* oof = f->GetOutOfFlowFrame();
            
            // Take this out of mFloats for now. We may put it back later in
            // this function
#ifdef DEBUG
            PRBool found =
#endif
              mFloats.RemoveFrame(oof);
            NS_ASSERTION(found, "Float should have been put in our mFloats list");

            PRBool isAncestor = nsLayoutUtils::IsProperAncestorFrame(this, fpif);
            if (isAncestor) {
              // oops. we already have a prev-in-flow for this
              // placeholder. We have to move this frame out of here. We
              // can put it in our overflow placeholders.
              aState.mOverflowPlaceholders.InsertFrame(nsnull, lastOP, f);
              // Let oof dangle for now, because placeholders in
              // mOverflowPlaceholders do not keep their floats in any child list
              lastOP = f;
            } else {
              if (fpif->GetParent() == prevBlock) {
                keepPlaceholders.InsertFrame(nsnull, lastKP, f);
                keepOutOfFlows.InsertFrame(nsnull, lastKOOF, oof);
                lastKP = f;
                lastKOOF = oof;
              } else {
                // Ok, now we're in the tough situation where some child
                // of prevBlock was complete and pushed its overflow
                // placeholders up to prevBlock's overflow. We might be
                // able to find a more appropriate parent for f somewhere
                // down in our descendants.
                NS_ASSERTION(nsLayoutUtils::IsProperAncestorFrame(prevBlock, fpif),
                             "bad prev-in-flow ancestor chain");
                // Find the first ancestor of f's prev-in-flow that has a next in flow
                // that can contain the float.
                // That next in flow should become f's parent.
                nsIFrame* fpAncestor;
                for (fpAncestor = fpif->GetParent();
                     !fpAncestor->GetNextInFlow() || !fpAncestor->IsFloatContainingBlock();
                     fpAncestor = fpAncestor->GetParent())
                  ;
                if (fpAncestor == prevBlock) {
                  // We're still the best parent.
                  keepPlaceholders.InsertFrame(nsnull, lastKP, f);
                  keepOutOfFlows.InsertFrame(nsnull, lastKOOF, oof);
                  lastKP = f;
                  lastKOOF = oof;
                } else {
                  // Just put it at the front of
                  // fpAncestor->GetNextInFlow()'s lines.
                  nsLineBox* newLine = aState.NewLineBox(f, 1, PR_FALSE);
                  if (newLine) {
                    nsBlockFrame* target =
                      NS_STATIC_CAST(nsBlockFrame*, fpAncestor->GetNextInFlow());
                    if (!target->mLines.empty()) {
                      f->SetNextSibling(target->mLines.front()->mFirstChild);
                    } else {
                      f->SetNextSibling(nsnull);
                    }
                    target->mLines.push_front(newLine);
                    ReparentFrame(f, this, target);

                    target->mFloats.InsertFrame(nsnull, nsnull, oof);
                    ReparentFrame(oof, this, target);
                  }
                }
              }
            }
          }
          aState.FreeLineBox(line);
        }
      }
      if (lastFrame) {
        lastFrame->SetNextSibling(nsnull);
      }
    }
  }

  // Now join the line lists into mLines
  if (overflowLines) {
    if (!overflowLines->empty()) {
      // Join the line lists
      if (! mLines.empty()) 
        {
          // Remember to recompute the margins on the first line. This will
          // also recompute the correct deltaY if necessary.
          mLines.front()->MarkPreviousMarginDirty();
          // Join the sibling lists together
          nsIFrame* lastFrame = overflowLines->back()->LastChild();
          lastFrame->SetNextSibling(mLines.front()->mFirstChild);
        }
      // Place overflow lines at the front of our line list
      mLines.splice(mLines.begin(), *overflowLines);
      NS_ASSERTION(overflowLines->empty(), "splice should empty list");
    }
    delete overflowLines;
  }
  if (ourOverflowLines) {
    if (!ourOverflowLines->empty()) {
      if (!mLines.empty()) {
        mLines.back()->LastChild()->
          SetNextSibling(ourOverflowLines->front()->mFirstChild);
      }
      // append the overflow to mLines
      mLines.splice(mLines.end(), *ourOverflowLines);
    }
    delete ourOverflowLines;
  }

  // store the placeholders that we're keeping in our frame list
  if (keepPlaceholders.NotEmpty()) {
    keepPlaceholders.SortByContentOrder();
    nsLineBox* newLine = aState.NewLineBox(keepPlaceholders.FirstChild(),
                                           keepPlaceholders.GetLength(), PR_FALSE);
    if (newLine) {
      if (!mLines.empty()) {
        keepPlaceholders.LastChild()->SetNextSibling(mLines.front()->mFirstChild);
      }
      mLines.push_front(newLine);
    }

    // Put the placeholders' out of flows into the float list
    keepOutOfFlows.SortByContentOrder();
    mFloats.InsertFrames(nsnull, nsnull, keepOutOfFlows.FirstChild());
  }

  return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

line_iterator nsBlockFrame::end_lines ( ) [inline, inherited]

Definition at line 126 of file nsBlockFrame.h.

{ return mLines.end(); }

Here is the call graph for this function:

Here is the caller graph for this function:

const_line_iterator nsBlockFrame::end_lines ( ) const [inline, inherited]

Definition at line 128 of file nsBlockFrame.h.

{ return mLines.end(); }

Here is the call graph for this function:

Definition at line 1967 of file nsBlockFrame.cpp.

{
  // This assertion actually fires on lots of pages (e.g., bugzilla,
  // bugzilla query page), so limit it to a few people until we fix the
  // problem causing it.  It's related to the similarly |#ifdef|ed
  // assertion in |PrepareChildIncrementalReflow|.
#if defined(DEBUG_dbaron) || defined(DEBUG_waterson)
  NS_PRECONDITION(aFrame, "why pass a null frame?");
#endif

  line_iterator line = begin_lines(),
                line_end = end_lines();
  for ( ; line != line_end; ++line) {
    // If the target frame is in-flow, and this line contains the it,
    // then we've found our line.
    if (line->Contains(aFrame))
      return line;

    // If the target frame is floated, and this line contains the
    // float's placeholder, then we've found our line.
    if (line->HasFloats()) {
      for (nsFloatCache *fc = line->GetFirstFloat();
           fc != nsnull;
           fc = fc->Next()) {
        if (aFrame == fc->mPlaceholder->GetOutOfFlowFrame())
          return line;
      }
    }
  }

  return line_end;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2486 of file nsComboboxControlFrame.cpp.

{
  // Fire ValueChange event to indicate data value of combo box has changed
  nsCOMPtr<nsIDOMEvent> event;
  nsCOMPtr<nsIEventListenerManager> manager;
  mContent->GetListenerManager(getter_AddRefs(manager));
  nsPresContext* presContext = GetPresContext();
  if (manager &&
      NS_SUCCEEDED(manager->CreateEvent(presContext, nsnull, NS_LITERAL_STRING("Events"), getter_AddRefs(event)))) {
    event->InitEvent(NS_LITERAL_STRING("ValueChange"), PR_TRUE, PR_TRUE);

    nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(event));
    privateEvent->SetTrusted(PR_TRUE);

    PRBool defaultActionEnabled;
    presContext->EventStateManager()->DispatchNewEvent(mContent, event,
                                                       &defaultActionEnabled);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsBlockFrame::FrameStartsCounterScope ( nsIFrame aFrame) [static, protected, inherited]

Definition at line 7340 of file nsBlockFrame.cpp.

{
  nsIContent* content = aFrame->GetContent();
  if (!content || !content->IsContentOfType(nsIContent::eHTML))
    return PR_FALSE;
  nsINodeInfo *ni = content->GetNodeInfo();
  return ni->Equals(nsHTMLAtoms::ol) ||
         ni->Equals(nsHTMLAtoms::ul) ||
         ni->Equals(nsHTMLAtoms::dir) ||
         ni->Equals(nsHTMLAtoms::menu);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Implements nsIComboboxControlFrame.

Definition at line 1767 of file nsComboboxControlFrame.cpp.

{
  nsRect absoluteTwips;
  return nsFormControlFrame::GetAbsoluteFramePosition(mPresContext, this,  absoluteTwips, *aRect);
}

Here is the call graph for this function:

Reimplemented from nsBlockFrame.

Definition at line 2308 of file nsComboboxControlFrame.cpp.

{
   // Maintain a separate child list for the dropdown list (i.e. popup listbox)
   // This is necessary because we don't want the listbox to be included in the layout
   // of the combox's children because it would take up space, when it is suppose to
   // be floating above the display.
  if (aIndex <= NS_BLOCK_FRAME_ABSOLUTE_LIST_INDEX) {
    return nsAreaFrame::GetAdditionalChildListName(aIndex);
  }
  
  if (NS_COMBO_FRAME_POPUP_LIST_INDEX == aIndex) {
    return nsLayoutAtoms::popupList;
  }
  return nsnull;
}
nscoord nsBlockFrame::GetAscent ( ) [inline, inherited]

Definition at line 270 of file nsBlockFrame.h.

{ return mAscent; }
nsresult nsBlockFrame::GetClosestLine ( nsILineIterator aLI,
const nsPoint aPoint,
PRInt32 aClosestLine 
) [protected, inherited]

GetClosestLine will return the line that VERTICALLY owns the point closest to aPoint.y aPoint is the point to search for, relative to the origin of the frame that aLI iterates over.

aClosestLine is the result.

Definition at line 6594 of file nsBlockFrame.cpp.

{
  if (!aLI)
    return NS_ERROR_NULL_POINTER;

  nsRect rect;
  PRInt32 numLines;
  PRInt32 lineFrameCount;
  nsIFrame *firstFrame;
  PRUint32 flags;

  nsresult result = aLI->GetNumLines(&numLines);

  if (NS_FAILED(result) || numLines < 0)
    return NS_OK;//do not handle

  PRInt32 shifted = numLines;
  PRInt32 start = 0, midpoint = 0;
  PRInt32 y = 0;

  while(shifted > 0)
  {
    // Cut the number of lines to look at in half and
    // calculate the midpoint of the region we are looking at.

    shifted >>= 1; //divide by 2
    midpoint  = start + shifted;

    // Get the dimensions of the line that is at the half
    // point of the region we are looking at.

    result = aLI->GetLine(midpoint, &firstFrame, &lineFrameCount,rect,&flags);
    if (NS_FAILED(result))
      break;//do not handle

    // Check to see if our point lies with the line's Y bounds.

    y = aPoint.y - rect.y;
    if (y >=0 && (aPoint.y < (rect.y+rect.height)))
    {
      aClosestLine = midpoint; //spot on!
      return NS_OK;
    }

    if (y > 0)
    {
      // If we get here, no match was found above, so aPoint.y must
      // be greater than the Y bounds of the current line rect. Move
      // our starting point just beyond the midpoint of the current region.

      start = midpoint;

      if (numLines > 1 && start < (numLines - 1))
        ++start;
      else
        shifted = 0;
    }
  }

  // Make sure we don't go off the edge in either direction!

  NS_ASSERTION(start >=0 && start <= numLines, "Invalid start calculated.");

  if (start < 0)
    start = 0;
  else if (start >= numLines)
    start = numLines - 1; 

  aClosestLine = start; //close as we could come

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2034 of file nsComboboxControlFrame.cpp.

Here is the call graph for this function:

static nsresult nsBlockFrame::GetCurrentLine ( nsBlockReflowState aState,
nsLineBox **  aOutCurrentLine 
) [static, inherited]

Gets the Drop Down List.

Implements nsIComboboxControlFrame.

Definition at line 1743 of file nsComboboxControlFrame.cpp.

{
  if (nsnull == aDropDownFrame) {
    return NS_ERROR_FAILURE;
  }

  *aDropDownFrame = mDropdownFrame;
 
  return NS_OK;
}

For the content model to tell if there's a dummy frame or not.

Implements nsISelectControlFrame.

Definition at line 1945 of file nsComboboxControlFrame.cpp.

{
  nsISelectControlFrame* listFrame = nsnull;
  NS_ASSERTION(mDropdownFrame, "No dropdown frame!");

  CallQueryInterface(mDropdownFrame, &listFrame);
  NS_ASSERTION(listFrame, "No list frame!");

  return listFrame->GetDummyFrame(aFrame);
}

Here is the call graph for this function:

nsIFrame * nsComboboxControlFrame::GetFirstChild ( nsIAtom aListName) const [virtual]

Reimplemented from nsBlockFrame.

Definition at line 2272 of file nsComboboxControlFrame.cpp.

{
  if (nsLayoutAtoms::popupList == aListName) {
    return mPopupFrames.FirstChild();
  }
  return nsAreaFrame::GetFirstChild(aListName);
}

Here is the call graph for this function:

Definition at line 6860 of file nsBlockFrame.cpp.

                                                         {
  if (!(GetStateBits() & NS_BLOCK_HAS_LINE_CURSOR)) {
    return nsnull;
  }

  nsLineBox* property = NS_STATIC_CAST(nsLineBox*,
    GetProperty(nsLayoutAtoms::lineCursorProperty));
  line_iterator cursor = mLines.begin(property);
  nsRect cursorArea = cursor->GetCombinedArea();

  while ((cursorArea.IsEmpty() || cursorArea.YMost() > y)
         && cursor != mLines.front()) {
    cursor = cursor.prev();
    cursorArea = cursor->GetCombinedArea();
  }
  while ((cursorArea.IsEmpty() || cursorArea.YMost() <= y)
         && cursor != mLines.back()) {
    cursor = cursor.next();
    cursorArea = cursor->GetCombinedArea();
  }

  if (cursor.get() != property) {
    SetProperty(nsLayoutAtoms::lineCursorProperty,
                cursor.get(), nsnull);
  }

  return cursor.get();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Get the content object associated with this frame.

Adds a reference to the content object so the caller must do a release.

See also:
nsISupports::Release()

Implements nsIFormControlFrame.

Definition at line 466 of file nsComboboxControlFrame.cpp.

{
  aContent = GetContent();
  NS_IF_ADDREF(aContent);
  return NS_OK;
}

Reimplemented from nsBlockFrame.

Definition at line 1664 of file nsComboboxControlFrame.cpp.

{
  // The button is getting the hover events so...
  // None of the children frames of the combobox get
  // the events. (like the button frame), that way
  // all event based style rules affect the combobox 
  // and not the any of the child frames.  (The inability
  // of the parent to be in the :hover state at the same
  // time as its children is really a bug (#5693 / #33736)
  // in the implementation of :hover.)
  
  // It would be theoretically more elegant to check the
  // children when not disabled, and then use event
  // capturing.  It would correctly handle situations (obscure!!)
  // where the children were visible but the parent was not.
  // Now the functionality of the OPTIONs depends on the SELECT
  // being visible.  Oh well...

  if ( mRect.Contains(aPoint) &&
       (aWhichLayer == NS_FRAME_PAINT_LAYER_FOREGROUND) ) {
    if (GetStyleVisibility()->IsVisible()) {
      *aFrame = this;
      return NS_OK;
    }
  }
  return NS_ERROR_FAILURE;
}
nsresult nsBlockFrame::GetFrameForPointUsing ( const nsPoint aPoint,
nsIAtom aList,
nsFramePaintLayer  aWhichLayer,
PRBool  aConsiderSelf,
nsIFrame **  aFrame 
) [inherited]

Definition at line 6911 of file nsBlockFrame.cpp.

{
  if (aList) {
    return nsContainerFrame::GetFrameForPointUsing(aPoint,
      aList, aWhichLayer, aConsiderSelf, aFrame);
  }

  PRBool inThisFrame = mRect.Contains(aPoint);

  if (! ((mState & NS_FRAME_OUTSIDE_CHILDREN) || inThisFrame ) ) {
    return NS_ERROR_FAILURE;
  }

  *aFrame = nsnull;
  nsPoint tmp(aPoint.x - mRect.x, aPoint.y - mRect.y);

  nsPoint originOffset;
  nsIView *view = nsnull;
  nsresult rv = GetOriginToViewOffset(originOffset, &view);

  if (NS_SUCCEEDED(rv) && view)
    tmp += originOffset;

  nsLineBox* cursor = GetFirstLineContaining(tmp.y);
  line_iterator line_end = end_lines();

  if (cursor) {
    // This is the fast path for large blocks
    for (line_iterator line = mLines.begin(cursor);
         line != line_end;
         ++line) {
      nsRect lineArea = line->GetCombinedArea();
      // Because we have a cursor, the combinedArea.ys are non-decreasing.
      // Once we've passed tmp.y, we can never see it again.
      if (!lineArea.IsEmpty()) {
        if (lineArea.y > tmp.y) {
          break;
        }
        GetFrameFromLine(lineArea, tmp, line, aWhichLayer, aFrame);
      }
    }
  } else {
    PRBool nonDecreasingYs = PR_TRUE;
    PRInt32 lineCount = 0;
    nscoord lastY = PR_INT32_MIN;
    nscoord lastYMost = PR_INT32_MIN;
    for (line_iterator line = mLines.begin();
         line != line_end;
         ++line) {
      nsRect lineArea = line->GetCombinedArea();
      if (!lineArea.IsEmpty()) {
        if (lineArea.y < lastY
            || lineArea.YMost() < lastYMost) {
          nonDecreasingYs = PR_FALSE;
        }
        lastY = lineArea.y;
        lastYMost = lineArea.YMost();

        GetFrameFromLine(lineArea, tmp, line, aWhichLayer, aFrame);
      }
      lineCount++;
    }

    if (nonDecreasingYs && lineCount >= MIN_LINES_NEEDING_CURSOR) {
      SetupLineCursor();
    }
  }
  
  if (*aFrame) {
    return NS_OK;
  }

  if ( inThisFrame && aConsiderSelf ) {
    if (GetStyleVisibility()->IsVisible()) {
      *aFrame = this;
      return NS_OK;
    }
  }

  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nscoord nsComboboxControlFrame::GetHorizontalBorderWidth ( float  aPixToTwip) const [virtual]

Definition at line 483 of file nsComboboxControlFrame.cpp.

{
  return 0;
}
nscoord nsComboboxControlFrame::GetHorizontalInsidePadding ( nsPresContext aPresContext,
float  aPixToTwip,
nscoord  aInnerWidth,
nscoord  aCharWidth 
) const [virtual]

Definition at line 500 of file nsComboboxControlFrame.cpp.

{
  return 0;
}

This returns the index of the item that is currently being displayed in the display area.

It may differ from what the currently Selected index is in in the dropdown.

Detailed explanation: When the dropdown is dropped down via a mouse click and the user moves the mouse up and down without clicking, the currently selected item is being tracking inside the dropdown, but the combobox is not being updated. When the user selects items with the arrow keys, the combobox is being updated. So when the user clicks outside the dropdown and it needs to roll up it has to decide whether to keep the current selection or not. This method is used to get the current index in the combobox to compare it to the current index in the dropdown to see if the combox has been updated and that way it knows whether to "cancel" the the current selection residing in the dropdown. Or whether to leave the selection alone.

Implements nsIComboboxControlFrame.

Definition at line 1872 of file nsComboboxControlFrame.cpp.

{
  NS_ENSURE_ARG_POINTER(aDisplayedIndex);
  *aDisplayedIndex = mDisplayedIndex;
  return NS_OK;
}
NS_IMETHODIMP nsComboboxControlFrame::GetName ( nsAString *  aName) [virtual]

Implements nsIFormControlFrame.

Definition at line 1658 of file nsComboboxControlFrame.cpp.

{
  return nsFormControlHelper::GetName(mContent, aResult);
}

Here is the caller graph for this function:

Sets the select state of the option at index.

Implements nsISelectControlFrame.

Definition at line 1931 of file nsComboboxControlFrame.cpp.

{
  nsISelectControlFrame* listFrame = nsnull;
  NS_ASSERTION(mDropdownFrame, "No dropdown frame!");

  CallQueryInterface(mDropdownFrame, &listFrame);
  NS_ASSERTION(listFrame, "No list frame!");

  return listFrame->GetOptionSelected(aIndex, aValue);
}

Here is the call graph for this function:

nsLineList * nsBlockFrame::GetOverflowLines ( ) const [inherited]

Definition at line 5158 of file nsBlockFrame.cpp.

{
  if (!(GetStateBits() & NS_BLOCK_HAS_OVERFLOW_LINES)) {
    return nsnull;
  }
  nsLineList* lines = NS_STATIC_CAST(nsLineList*,
    GetProperty(nsLayoutAtoms::overflowLinesProperty));
  NS_ASSERTION(lines && !lines->empty(),
               "value should always be stored and non-empty when state set");
  return lines;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsFrameList nsBlockFrame::GetOverflowOutOfFlows ( ) const [protected, inherited]

Definition at line 5220 of file nsBlockFrame.cpp.

{
  if (!(GetStateBits() & NS_BLOCK_HAS_OVERFLOW_OUT_OF_FLOWS)) {
    return nsFrameList();
  }
  nsIFrame* result = NS_STATIC_CAST(nsIFrame*,
    GetProperty(nsLayoutAtoms::overflowOutOfFlowsProperty));
  NS_ASSERTION(result, "value should always be non-empty when state set");
  return nsFrameList(result);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsFrameList * nsBlockFrame::GetOverflowPlaceholders ( ) const [protected, inherited]

Definition at line 5251 of file nsBlockFrame.cpp.

{
  if (!(GetStateBits() & NS_BLOCK_HAS_OVERFLOW_PLACEHOLDERS)) {
    return nsnull;
  }
  nsFrameList* result = NS_STATIC_CAST(nsFrameList*,
    GetProperty(nsLayoutAtoms::overflowPlaceholdersProperty));
  NS_ASSERTION(result, "value should always be non-empty when state set");
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsComboboxControlFrame::GetPrimaryComboFrame ( nsPresContext aPresContext,
nsIContent aContent,
nsIFrame **  aFrame 
) [protected]

Definition at line 685 of file nsComboboxControlFrame.cpp.

{
   // Get the primary frame from the presentation shell.
  nsIPresShell *presShell = aPresContext->GetPresShell();
  if (presShell) {
    presShell->GetPrimaryFrameFor(aContent, aFrame);
  }
  return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP nsComboboxControlFrame::GetProperty ( nsIAtom aName,
nsAString &  aValue 
) [virtual]

Get a property from the form control frame.

Parameters:
aNamename of the property to get
aValuevalue of the property
Returns:
NS_OK if the property name is valid, otherwise an error code

Implements nsIFormControlFrame.

Definition at line 2023 of file nsComboboxControlFrame.cpp.

{
  nsIFormControlFrame* fcFrame = nsnull;
  nsresult result = CallQueryInterface(mDropdownFrame, &fcFrame);
  if ((NS_SUCCEEDED(result)) && (nsnull != fcFrame)) {
    return fcFrame->GetProperty(aName, aValue);
  }
  return result;
}

Here is the call graph for this function:

Implements nsIScrollableViewProvider.

Definition at line 2446 of file nsComboboxControlFrame.cpp.

{
  if (!mDropdownFrame)
    return nsnull;

  nsIScrollableFrame* scrollable = nsnull;
  nsresult rv = CallQueryInterface(mDropdownFrame, &scrollable);
  if (NS_FAILED(rv))
    return nsnull;

  return scrollable->GetScrollableView();
}

Here is the call graph for this function:

PRIntn nsComboboxControlFrame::GetSkipSides ( ) const [protected, virtual]

Reimplemented from nsBlockFrame.

Definition at line 2325 of file nsComboboxControlFrame.cpp.

{    
    // Don't skip any sides during border rendering
  return 0;
}
nsIFrame * nsBlockFrame::GetTopBlockChild ( nsPresContext aPresContext) [inherited]

return the topmost block child based on y-index.

almost always the first or second line, if there is one. accounts for lines that hold only compressed white space, etc.

Definition at line 3219 of file nsBlockFrame.cpp.

{
  if (mLines.empty())
    return nsnull;

  nsLineBox *firstLine = mLines.front();
  if (firstLine->IsBlock())
    return firstLine->mFirstChild;

  if (!firstLine->CachedIsEmpty())
    return nsnull;

  line_iterator secondLine = begin_lines();
  ++secondLine;
  if (secondLine == end_lines() || !secondLine->IsBlock())
    return nsnull;

  return secondLine->mFirstChild;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsIAtom * nsAreaFrame::GetType ( void  ) const [virtual, inherited]

Get the "type" of the frame.

See also:
nsLayoutAtoms::areaFrame

Reimplemented from nsBlockFrame.

Reimplemented in nsLegendFrame.

Definition at line 176 of file nsAreaFrame.cpp.

{
  return nsLayoutAtoms::areaFrame;
}
nscoord nsComboboxControlFrame::GetVerticalBorderWidth ( float  aPixToTwip) const [virtual]

Definition at line 475 of file nsComboboxControlFrame.cpp.

{
   return 0;
}
nscoord nsComboboxControlFrame::GetVerticalInsidePadding ( nsPresContext aPresContext,
float  aPixToTwip,
nscoord  aInnerHeight 
) const [virtual]

Definition at line 491 of file nsComboboxControlFrame.cpp.

{
   return 0;
}
NS_IMETHODIMP nsComboboxControlFrame::HandleEvent ( nsPresContext aPresContext,
nsGUIEvent aEvent,
nsEventStatus aEventStatus 
)

Reimplemented from nsBlockFrame.

Definition at line 1984 of file nsComboboxControlFrame.cpp.

{
  NS_ENSURE_ARG_POINTER(aEventStatus);
  // temp fix until Bug 124990 gets fixed
  if (aPresContext->IsPaginated() && NS_IS_MOUSE_EVENT(aEvent)) {
    return NS_OK;
  }

  if (nsEventStatus_eConsumeNoDefault == *aEventStatus) {
    return NS_OK;
  }
  if (nsFormControlHelper::GetDisabled(mContent)) {
    return NS_OK;
  }

  // If we have style that affects how we are selected, feed event down to
  // nsFrame::HandleEvent so that selection takes place when appropriate.
  const nsStyleUserInterface* uiStyle = GetStyleUserInterface();
  if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE || uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED)
    return nsAreaFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
    
  return NS_OK;
}

Here is the call graph for this function:

Call this when a frame will be pulled from the block's next-in-flow into this frame.

If it's a continuation placeholder, it should not be here so we push it into our overflow placeholders list. To avoid creating holes (e.g., the following block doesn't have a placeholder but the block after it does) we also need to pull all the following placeholders and put them in our overflow placeholders list too.

If it's a first-in-flow placeholder, or it contains one, then we need to do this to the continuation placeholders.

We return PR_TRUE if we removed the frame and it cannot be used. If we return PR_FALSE then the frame must be pulled immediately.

Definition at line 4801 of file nsBlockFrame.cpp.

{
  if (nsLayoutAtoms::placeholderFrame != aFrame->GetType()) {
    // Descend into children that are not float containing blocks.
    // We should encounter only first-in-flow placeholders, so the
    // frame subtree rooted at aFrame should not change.
    if (!aFrame->IsFloatContainingBlock()) {
      for (nsIFrame* f = aFrame->GetFirstChild(nsnull); f; f = f->GetNextSibling()) {
#ifdef DEBUG
        PRBool changed =
#endif
          HandleOverflowPlaceholdersForPulledFrame(aState, f);
        NS_ASSERTION(!changed, "Shouldn't find any continuation placeholders inside inlines");
      }
    }
    return PR_FALSE;
  }

  PRBool taken = PR_TRUE;
  nsIFrame* frame = aFrame;
  if (!aFrame->GetPrevInFlow()) {
    // First in flow frame. We only want to deal with its
    // next in flows, if there are any.
    taken = PR_FALSE;
    frame = frame->GetNextInFlow();
    if (!frame)
      return PR_FALSE;
  }

  nsBlockFrame* parent = NS_STATIC_CAST(nsBlockFrame*, frame->GetParent());
  // Remove aFrame and all its next in flows from their parents, but
  // don't destroy the frames.
#ifdef DEBUG
  nsresult rv =
#endif
    parent->DoRemoveFrame(frame, PR_FALSE);
  NS_ASSERTION(NS_SUCCEEDED(rv), "frame should be in parent's lists");
  
  nsIFrame* lastOverflowPlace = aState.mOverflowPlaceholders.LastChild();
  while (frame) {
    NS_ASSERTION(IsContinuationPlaceholder(frame),
                 "Should only be dealing with continuation placeholders here");

    parent = NS_STATIC_CAST(nsBlockFrame*, frame->GetParent());
    ReparentFrame(frame, parent, this);

    // continuation placeholders are always direct children of a block
    nsIFrame* outOfFlow = nsPlaceholderFrame::GetRealFrameForPlaceholder(frame);

    if (!parent->mFloats.RemoveFrame(outOfFlow)) {
      nsAutoOOFFrameList oofs(parent);
#ifdef DEBUG
      PRBool found =
#endif
        oofs.mList.RemoveFrame(outOfFlow);
      NS_ASSERTION(found, "Must have the out of flow in some child list");
    }
    ReparentFrame(outOfFlow, parent, this);

    aState.mOverflowPlaceholders.InsertFrames(nsnull, lastOverflowPlace, frame);
    // outOfFlow isn't inserted anywhere yet. Eventually the overflow
    // placeholders get put into the overflow lines, and at the same time we
    // insert the placeholders' out of flows into the overflow out-of-flows
    // list.
    lastOverflowPlace = frame;

    frame = frame->GetNextInFlow();
  }

  return taken;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Call this when a line will be pulled from the block's next-in-flow's line.

Returns:
PR_TRUE we consumed the entire line, delete it and try again

Definition at line 4881 of file nsBlockFrame.cpp.

{
  // First, see if it's a line of continuation placeholders. If it
  // is, remove one and retry.
  if (aLine->mFirstChild && IsContinuationPlaceholder(aLine->mFirstChild)) {
    PRBool taken =
      HandleOverflowPlaceholdersForPulledFrame(aState, aLine->mFirstChild);
    NS_ASSERTION(taken, "We must have removed that frame");
    return PR_TRUE;
  }
 
  // OK, it's a normal line. Scan it for floats with continuations that
  // need to be taken care of. We won't need to change the line.
  PRInt32 n = aLine->GetChildCount();
  for (nsIFrame* f = aLine->mFirstChild; n > 0; f = f->GetNextSibling(), --n) {
#ifdef DEBUG
    PRBool taken =
#endif
      HandleOverflowPlaceholdersForPulledFrame(aState, f);
    NS_ASSERTION(!taken, "Shouldn't be any continuation placeholders on this line");
  }

  return PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1833 of file nsComboboxControlFrame.cpp.

{
  // First, make sure that the content model is up to date and we've
  // constructed the frames for all our content in the right places.
  // Otherwise they'll end up under the wrong insertion frame when we
  // ActuallyDisplayText, since that flushes out the content sink by
  // calling SetText on a DOM node with aNotify set to true.  See bug
  // 289730.
  GetPresContext()->GetDocument()->
    FlushPendingNotifications(Flush_ContentAndNotify);
  
  // Redirect frame insertions during this method (see GetContentInsertionFrame())
  // so that any reframing that the frame constructor forces upon us is inserted
  // into the correct parent (mDisplayFrame). See bug 282607.
  NS_PRECONDITION(!mInRedisplayText, "Nested RedisplayText");
  mInRedisplayText = PR_TRUE;
  mRedisplayTextEventPosted = PR_FALSE;

  ActuallyDisplayText(PR_TRUE);
  mDisplayFrame->AddStateBits(NS_FRAME_IS_DIRTY);
  ReflowDirtyChild(GetPresContext()->PresShell(), mDisplayFrame);

  mInRedisplayText = PR_FALSE;
}

Here is the call graph for this function:

PRBool nsBlockFrame::HaveOutsideBullet ( ) const [inline, protected, inherited]

Definition at line 337 of file nsBlockFrame.h.

                                   {
#if defined(DEBUG) && !defined(DEBUG_rods)
    if(mState & NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET) {
      NS_ASSERTION(mBullet,"NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET flag set and no mBullet");
    }
#endif
    return 0 != (mState & NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET);
  }

Here is the caller graph for this function:

NS_IMETHODIMP nsComboboxControlFrame::Init ( nsPresContext aPresContext,
nsIContent aContent,
nsIFrame aParent,
nsStyleContext aContext,
nsIFrame aPrevInFlow 
)

Reimplemented from nsBlockFrame.

Definition at line 417 of file nsComboboxControlFrame.cpp.

{
   // Need to hold on the pres context because it is used later in methods
   // which don't have it passed in.
  mPresContext = aPresContext;
  NS_ADDREF(mPresContext);

  mEventQueueService = do_GetService(kEventQueueServiceCID);

  //-------------------------------
  // Start - Temporary fix for Bug 36558
  //-------------------------------
  mGoodToGo = PR_FALSE;
  nsIDocument* document = aContent->GetDocument();
  if (document) {
#ifdef MOZ_XUL
    nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(document));
    mGoodToGo = xulDoc?PR_FALSE:PR_TRUE;
#else
    mGoodToGo = PR_TRUE;
#endif
  }
  //-------------------------------
  // Done - Temporary fix for Bug 36558
  //-------------------------------
  
  return nsAreaFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
}

Here is the call graph for this function:

Definition at line 452 of file nsComboboxControlFrame.cpp.

{
  nsFormControlHelper::Reset(this, aPresContext);
}

Here is the call graph for this function:

NS_IMETHODIMP nsBlockFrame::InsertFrames ( nsIAtom aListName,
nsIFrame aPrevFrame,
nsIFrame aFrameList 
) [inherited]

Reimplemented in nsMathMLmathBlockFrame, nsMathMLForeignFrameWrapper, and nsSVGForeignObjectFrame.

Definition at line 5319 of file nsBlockFrame.cpp.

{
  if (mAbsoluteContainer.GetChildListName() == aListName) {
    return mAbsoluteContainer.InsertFrames(this, aListName, aPrevFrame,
                                           aFrameList);
  }
  else if (nsLayoutAtoms::floatList == aListName) {
    mFloats.InsertFrames(this, aPrevFrame, aFrameList);
    return NS_OK;
  }
#ifdef IBMBIDI
  else if (nsLayoutAtoms::nextBidi == aListName) {}
#endif // IBMBIDI
  else if (nsnull != aListName) {
    return NS_ERROR_INVALID_ARG;
  }

#ifdef NOISY_REFLOW_REASON
  ListTag(stdout);
  printf(": insert ");
  nsFrame::ListTag(stdout, aFrameList);
  if (aPrevFrame) {
    printf(" after ");
    nsFrame::ListTag(stdout, aPrevFrame);
  }
  printf("\n");
#endif
  nsresult rv = AddFrames(aFrameList, aPrevFrame);
#ifdef IBMBIDI
  if (aListName != nsLayoutAtoms::nextBidi)
#endif // IBMBIDI
  if (NS_SUCCEEDED(rv)) {
    // Ask the parent frame to reflow me.
    ReflowDirtyChild(GetPresContext()->PresShell(), nsnull);
  }
  return rv;
}

Here is the call graph for this function:

PRBool nsBlockFrame::IsContainingBlock ( ) const [virtual, inherited]

Definition at line 539 of file nsBlockFrame.cpp.

{
  return PR_TRUE;
}
NS_IMETHOD nsComboboxControlFrame::IsDroppedDown ( PRBool aDoDropDown) [inline, virtual]

Indicates whether the list is dropped down.

Implements nsIComboboxControlFrame.

Definition at line 178 of file nsComboboxControlFrame.h.

{ *aDoDropDown = mDroppedDown; return NS_OK; }

Here is the caller graph for this function:

PRBool nsBlockFrame::IsEmpty ( void  ) [virtual, inherited]

Definition at line 3166 of file nsBlockFrame.cpp.

{
  if (!IsSelfEmpty()) {
    return PR_FALSE;
  }

  for (line_iterator line = begin_lines(), line_end = end_lines();
       line != line_end;
       ++line)
  {
    if (!line->IsEmpty())
      return PR_FALSE;
  }

  return PR_TRUE;
}

Here is the call graph for this function:

PRBool nsBlockFrame::IsFloatContainingBlock ( ) const [virtual, inherited]

Definition at line 545 of file nsBlockFrame.cpp.

{
  return PR_TRUE;
}
PRBool nsBlockFrame::IsSelfEmpty ( ) [virtual, inherited]

Definition at line 3118 of file nsBlockFrame.cpp.

{
  const nsStylePosition* position = GetStylePosition();

  switch (position->mMinHeight.GetUnit()) {
    case eStyleUnit_Coord:
      if (position->mMinHeight.GetCoordValue() != 0)
        return PR_FALSE;
      break;
    case eStyleUnit_Percent:
      if (position->mMinHeight.GetPercentValue() != 0.0f)
        return PR_FALSE;
      break;
    default:
      return PR_FALSE;
  }

  switch (position->mHeight.GetUnit()) {
    case eStyleUnit_Auto:
      break;
    case eStyleUnit_Coord:
      if (position->mHeight.GetCoordValue() != 0)
        return PR_FALSE;
      break;
    case eStyleUnit_Percent:
      if (position->mHeight.GetPercentValue() != 0.0f)
        return PR_FALSE;
      break;
    default:
      return PR_FALSE;
  }

  const nsStyleBorder* border = GetStyleBorder();
  const nsStylePadding* padding = GetStylePadding();
  nsStyleCoord coord;
  if (border->GetBorderWidth(NS_SIDE_TOP) != 0 ||
      border->GetBorderWidth(NS_SIDE_BOTTOM) != 0 ||
      !IsPaddingZero(padding->mPadding.GetTopUnit(),
                    padding->mPadding.GetTop(coord)) ||
      !IsPaddingZero(padding->mPadding.GetBottomUnit(),
                    padding->mPadding.GetBottom(coord))) {
    return PR_FALSE;
  }

  return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsBlockFrame::IsSplittable ( nsSplittableType aIsSplittable) const [inherited]

Definition at line 353 of file nsBlockFrame.cpp.

{
  aIsSplittable = NS_FRAME_SPLITTABLE_NON_RECTANGULAR;
  return NS_OK;
}
NS_IMETHODIMP nsBlockFrame::IsVisibleForPainting ( nsPresContext aPresContext,
nsIRenderingContext aRenderingContext,
PRBool  aCheckVis,
PRBool aIsVisible 
) [inherited]

Definition at line 6239 of file nsBlockFrame.cpp.

{
  // first check to see if we are visible
  if (aCheckVis) {
    if (!GetStyleVisibility()->IsVisible()) {
      *aIsVisible = PR_FALSE;
      return NS_OK;
    }
  }

  // Start by assuming we are visible and need to be painted
  *aIsVisible = PR_TRUE;

  // NOTE: GetSelectionforVisCheck checks the pagination to make sure we are printing
  // In otherwords, the selection will ALWAYS be null if we are not printing, meaning
  // the visibility will be TRUE in that case
  nsCOMPtr<nsISelection> selection;
  nsresult rv = GetSelectionForVisCheck(aPresContext, getter_AddRefs(selection));
  if (NS_SUCCEEDED(rv) && selection) {
    nsCOMPtr<nsIDOMNode> node(do_QueryInterface(mContent));

    nsCOMPtr<nsIDOMHTMLHtmlElement> html(do_QueryInterface(mContent));
    nsCOMPtr<nsIDOMHTMLBodyElement> body(do_QueryInterface(mContent));

    if (!html && !body) {
      rv = selection->ContainsNode(node, PR_TRUE, aIsVisible);
    }
  }

  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsIFrame * nsBlockFrame::LastChild ( ) [protected, inherited]

Definition at line 5266 of file nsBlockFrame.cpp.

{
  if (! mLines.empty()) {
    return mLines.back()->LastChild();
  }
  return nsnull;
}

Here is the call graph for this function:

nsresult nsBlockFrame::MarkLineDirty ( line_iterator  aLine) [protected, inherited]

Mark |aLine| dirty, and, if necessary because of possible pull-up, mark the previous line dirty as well.

Definition at line 1723 of file nsBlockFrame.cpp.

{
  // Mark aLine dirty
  aLine->MarkDirty();
#ifdef DEBUG
  if (gNoisyReflow) {
    IndentBy(stdout, gNoiseIndent);
    ListTag(stdout);
    printf(": mark line %p dirty\n", NS_STATIC_CAST(void*, aLine.get()));
  }
#endif

  // Mark previous line dirty if its an inline line so that it can
  // maybe pullup something from the line just affected.
  // XXX We don't need to do this if aPrevLine ends in a break-after...
  if (aLine != mLines.front() &&
      aLine->IsInline() &&
      aLine.prev()->IsInline()) {
    aLine.prev()->MarkDirty();
#ifdef DEBUG
    if (gNoisyReflow) {
      IndentBy(stdout, gNoiseIndent);
      ListTag(stdout);
      printf(": mark prev-line %p dirty\n",
             NS_STATIC_CAST(void*, aLine.prev().get()));
    }
#endif
  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Implements nsIFormControlFrame.

Method for the listbox to set and get the recent index.

Implements nsIComboboxControlFrame.

Definition at line 342 of file nsComboboxControlFrame.h.

{ return NS_OK; }

Definition at line 343 of file nsComboboxControlFrame.h.

{ return NS_OK; }

Notification that the content has been reset.

Implements nsIFormControlFrame.

Definition at line 2507 of file nsComboboxControlFrame.cpp.

{
  if (mListControlFrame) {
    nsCOMPtr<nsIFormControlFrame> formControl =
      do_QueryInterface(mListControlFrame);
    formControl->OnContentReset();
  }
  return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP nsComboboxControlFrame::OnOptionSelected ( nsPresContext aPresContext,
PRInt32  aIndex,
PRBool  aSelected 
) [virtual]

Notify the frame when an option is selected.

Implements nsISelectControlFrame.

Definition at line 2464 of file nsComboboxControlFrame.cpp.

{
  if (mDroppedDown) {
    nsCOMPtr<nsISelectControlFrame> selectFrame
                                     = do_QueryInterface(mListControlFrame);
    if (selectFrame) {
      selectFrame->OnOptionSelected(aPresContext, aIndex, aSelected);
    }
  } else {
    if (aSelected) {
      RedisplayText(aIndex);
    } else {
      RedisplaySelectedText();
      FireValueChangeEvent(); // Fire after old option is unselected
    }
  }

  return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP nsComboboxControlFrame::OnSetSelectedIndex ( PRInt32  aOldIndex,
PRInt32  aNewIndex 
) [virtual]

Notify the frame when selectedIndex was changed.

Implements nsISelectControlFrame.

Definition at line 1969 of file nsComboboxControlFrame.cpp.

{
  nsISelectControlFrame* listFrame = nsnull;
  NS_ASSERTION(mDropdownFrame, "No dropdown frame!");

  CallQueryInterface(mDropdownFrame, &listFrame);
  NS_ASSERTION(listFrame, "No list frame!");

  return listFrame->OnSetSelectedIndex(aOldIndex, aNewIndex);
}

Here is the call graph for this function:

NS_METHOD nsComboboxControlFrame::Paint ( nsPresContext aPresContext,
nsIRenderingContext aRenderingContext,
const nsRect aDirtyRect,
nsFramePaintLayer  aWhichLayer,
PRUint32  aFlags = 0 
)

Reimplemented from nsBlockFrame.

Definition at line 2369 of file nsComboboxControlFrame.cpp.

{
  PRBool isVisible;
  if (NS_SUCCEEDED(IsVisibleForPainting(aPresContext, aRenderingContext, PR_TRUE, &isVisible)) && !isVisible) {
    return NS_OK;
  }
#ifdef NOISY
  printf("%p paint layer %d at (%d, %d, %d, %d)\n", this, aWhichLayer, 
    aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height);
#endif
  // We paint everything in the foreground so that the form control's
  // parents cannot paint over it in other passes (bug 95826).
  if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) {
    nsAreaFrame::Paint(aPresContext, aRenderingContext, aDirtyRect,
                       NS_FRAME_PAINT_LAYER_BACKGROUND);
    nsAreaFrame::Paint(aPresContext, aRenderingContext, aDirtyRect,
                       NS_FRAME_PAINT_LAYER_FLOATS);
    nsAreaFrame::Paint(aPresContext, aRenderingContext, aDirtyRect,
                       NS_FRAME_PAINT_LAYER_FOREGROUND);

    // nsITheme should take care of drawing the focus border, but currently does so only on Mac.
    // If all of the nsITheme implementations are fixed to draw the focus border correctly,
    // this #ifdef should be replaced with a -moz-appearance / ThemeSupportsWidget() check.

    if (!ToolkitHasNativePopup() && mDisplayFrame) {
      aRenderingContext.PushState();
      nsRect clipRect = mDisplayFrame->GetRect();
      aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect);
      PaintChild(aPresContext, aRenderingContext, aDirtyRect, 
                 mDisplayFrame, NS_FRAME_PAINT_LAYER_BACKGROUND);
      PaintChild(aPresContext, aRenderingContext, aDirtyRect, 
                 mDisplayFrame, NS_FRAME_PAINT_LAYER_FOREGROUND);

      // draw focus
      // XXX This is only temporary
      // Only paint the focus if we're visible
      if (GetStyleVisibility()->IsVisible()) {
        if (!nsFormControlHelper::GetDisabled(mContent) && mFocused == this) {
          aRenderingContext.SetLineStyle(nsLineStyle_kDotted);
          aRenderingContext.SetColor(0);
        } else {
          aRenderingContext.SetColor(GetStyleBackground()->mBackgroundColor);
          aRenderingContext.SetLineStyle(nsLineStyle_kSolid);
        }
        //aRenderingContext.DrawRect(clipRect);
        float p2t = aPresContext->PixelsToTwips();
        nscoord onePixel = NSIntPixelsToTwips(1, p2t);
        clipRect.width -= onePixel;
        clipRect.height -= onePixel;
        aRenderingContext.DrawLine(clipRect.x, clipRect.y, 
                                   clipRect.x+clipRect.width, clipRect.y);
        aRenderingContext.DrawLine(clipRect.x+clipRect.width, clipRect.y, 
                                   clipRect.x+clipRect.width, clipRect.y+clipRect.height);
        aRenderingContext.DrawLine(clipRect.x+clipRect.width, clipRect.y+clipRect.height, 
                                   clipRect.x, clipRect.y+clipRect.height);
        aRenderingContext.DrawLine(clipRect.x, clipRect.y+clipRect.height, 
                                   clipRect.x, clipRect.y);
        aRenderingContext.DrawLine(clipRect.x, clipRect.y+clipRect.height, 
                                   clipRect.x, clipRect.y);
      }
      aRenderingContext.PopState();
    }
  }
  
  // Call to the base class to draw selection borders when appropriate
  return nsFrame::Paint(aPresContext,aRenderingContext,aDirtyRect,aWhichLayer);
}

Here is the call graph for this function:

virtual void nsBlockFrame::PaintChild ( nsPresContext aPresContext,
nsIRenderingContext aRenderingContext,
const nsRect aDirtyRect,
nsIFrame aFrame,
nsFramePaintLayer  aWhichLayer,
PRUint32  aFlags = 0 
) [inline, virtual, inherited]

Definition at line 279 of file nsBlockFrame.h.

                                                           {
    nsContainerFrame::PaintChild(aPresContext, aRenderingContext,
                                 aDirtyRect, aFrame, aWhichLayer, aFlags);
  }

Here is the caller graph for this function:

void nsBlockFrame::PaintChildren ( nsPresContext aPresContext,
nsIRenderingContext aRenderingContext,
const nsRect aDirtyRect,
nsFramePaintLayer  aWhichLayer,
PRUint32  aFlags = 0 
) [protected, virtual, inherited]

Definition at line 6495 of file nsBlockFrame.cpp.

{
  PRInt32 drawnLines; // Will only be used if set (gLamePaintMetrics).
  PRInt32 depth = 0;
#ifdef DEBUG
  if (gNoisyDamageRepair) {
    if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {
      depth = GetDepth();
    }
  }
  PRTime start = LL_ZERO; // Initialize these variables to silence the compiler.
  if (gLamePaintMetrics) {
    start = PR_Now();
    drawnLines = 0;
  }
#endif

  nsLineBox* cursor = GetFirstLineContaining(aDirtyRect.y);
  line_iterator line_end = end_lines();

  if (cursor) {
    for (line_iterator line = mLines.begin(cursor);
         line != line_end;
         ++line) {
      nsRect lineArea = line->GetCombinedArea();
      if (!lineArea.IsEmpty()) {
        // Because we have a cursor, the combinedArea.ys are non-decreasing.
        // Once we've passed aDirtyRect.YMost(), we can never see it again.
        if (lineArea.y >= aDirtyRect.YMost()) {
          break;
        }
        PaintLine(lineArea, aDirtyRect, line, depth, drawnLines, aPresContext,
                  aRenderingContext, aWhichLayer, this);
      }
    }
  } else {
    PRBool nonDecreasingYs = PR_TRUE;
    PRInt32 lineCount = 0;
    nscoord lastY = PR_INT32_MIN;
    nscoord lastYMost = PR_INT32_MIN;
    for (line_iterator line = begin_lines();
         line != line_end;
         ++line) {
      nsRect lineArea = line->GetCombinedArea();
      if (!lineArea.IsEmpty()) {
        if (lineArea.y < lastY
            || lineArea.YMost() < lastYMost) {
          nonDecreasingYs = PR_FALSE;
        }
        lastY = lineArea.y;
        lastYMost = lineArea.YMost();

        PaintLine(lineArea, aDirtyRect, line, depth, drawnLines, aPresContext,
                  aRenderingContext, aWhichLayer, this);
      }
      lineCount++;
    }

    if (nonDecreasingYs && lineCount >= MIN_LINES_NEEDING_CURSOR) {
      SetupLineCursor();
    }
  }

  if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) {
    if ((nsnull != mBullet) && HaveOutsideBullet()) {
      // Paint outside bullets manually
      PaintChild(aPresContext, aRenderingContext, aDirtyRect, mBullet,
                 aWhichLayer);
    }
  }

#ifdef DEBUG
  if (gLamePaintMetrics) {
    PRTime end = PR_Now();

    PRInt32 numLines = mLines.size();
    if (!numLines) numLines = 1;
    PRTime lines, deltaPerLine, delta;
    LL_I2L(lines, numLines);
    LL_SUB(delta, end, start);
    LL_DIV(deltaPerLine, delta, lines);

    ListTag(stdout);
    char buf[400];
    PR_snprintf(buf, sizeof(buf),
                ": %lld elapsed (%lld per line) lines=%d drawn=%d skip=%d",
                delta, deltaPerLine,
                numLines, drawnLines, numLines - drawnLines);
    printf("%s\n", buf);
  }
#endif
}

Here is the call graph for this function:

void nsBlockFrame::PaintFloats ( nsPresContext aPresContext,
nsIRenderingContext aRenderingContext,
const nsRect aDirtyRect 
) [protected, inherited]

Definition at line 6429 of file nsBlockFrame.cpp.

{
  for (nsIFrame* floatFrame = mFloats.FirstChild();
       floatFrame;
       floatFrame = floatFrame->GetNextSibling()) {
    PaintChild(aPresContext, aRenderingContext, aDirtyRect,
               floatFrame, NS_FRAME_PAINT_LAYER_BACKGROUND);
    PaintChild(aPresContext, aRenderingContext, aDirtyRect,
               floatFrame, NS_FRAME_PAINT_LAYER_FLOATS);
    PaintChild(aPresContext, aRenderingContext, aDirtyRect,
               floatFrame, NS_FRAME_PAINT_LAYER_FOREGROUND);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsBlockFrame::PaintTextDecorationLines ( nsIRenderingContext aRenderingContext,
nscolor  aColor,
nscoord  aOffset,
nscoord  aAscent,
nscoord  aSize 
) [protected, virtual, inherited]

Definition at line 6275 of file nsBlockFrame.cpp.

{
  aRenderingContext.SetColor(aColor);
  for (nsLineList::iterator line = begin_lines(), line_start = line,
         line_end = end_lines(); 
       line != line_end; ++line) {
    if (!line->IsBlock()) {
      nscoord start = line->mBounds.x;
      nscoord width = line->mBounds.width;

      if (line == line_start) {
        // Adjust for the text-indent.  See similar code in
        // nsLineLayout::BeginLineReflow.
        nscoord indent = 0;
        const nsStyleText* styleText = GetStyleText();
        nsStyleUnit unit = styleText->mTextIndent.GetUnit();
        if (eStyleUnit_Coord == unit) {
          indent = styleText->mTextIndent.GetCoordValue();
        } else if (eStyleUnit_Percent == unit) {
          // It's a percentage of the containing block width.
          nsIFrame* containingBlock =
            nsHTMLReflowState::GetContainingBlockFor(this);
          NS_ASSERTION(containingBlock, "Must have containing block!");
          indent = nscoord(styleText->mTextIndent.GetPercentValue() *
                           containingBlock->GetRect().width);
        }

        // Adjust the start position and the width of the decoration by the
        // value of the indent.  Note that indent can be negative; that's OK.
        // It'll just increase the width (which can also happen to be
        // negative!).
        start += indent;
        width -= indent;
      }
      
      // Only paint if we have a positive width
      if (width > 0) {
        aRenderingContext.FillRect(start,
                                   line->mBounds.y + line->GetAscent() - aOffset, 
                                   width, aSize);
      }
    }
  }
}

Here is the call graph for this function:

PRBool nsBlockFrame::PlaceLine ( nsBlockReflowState aState,
nsLineLayout aLineLayout,
line_iterator  aLine,
PRBool aKeepReflowGoing,
PRBool  aUpdateMaximumWidth 
) [protected, inherited]

Definition at line 4401 of file nsBlockFrame.cpp.

{
  // Trim extra white-space from the line before placing the frames
  aLineLayout.TrimTrailingWhiteSpace();

  // Vertically align the frames on this line.
  //
  // According to the CSS2 spec, section 12.6.1, the "marker" box
  // participates in the height calculation of the list-item box's
  // first line box.
  //
  // There are exactly two places a bullet can be placed: near the
  // first or second line. Its only placed on the second line in a
  // rare case: an empty first line followed by a second line that
  // contains a block (example: <LI>\n<P>... ).
  //
  // For this code, only the first case is possible because this
  // method is used for placing a line of inline frames. If the rare
  // case is happening then the worst that will happen is that the
  // bullet frame will be reflowed twice.
  PRBool addedBullet = PR_FALSE;
  if (mBullet && HaveOutsideBullet() && (aLine == mLines.front()) &&
      (!aLineLayout.IsZeroHeight() || (aLine == mLines.back()))) {
    nsHTMLReflowMetrics metrics(nsnull);
    ReflowBullet(aState, metrics);
    aLineLayout.AddBulletFrame(mBullet, metrics);
    addedBullet = PR_TRUE;
  }
  nscoord maxElementWidth;
  aLineLayout.VerticalAlignLine(aLine, &maxElementWidth);
  // Our ascent is the ascent of our first line (but if this line is all
  // whitespace we'll correct things in |ReflowBlockFrame|).
  if (aLine == mLines.front()) {
    mAscent = aLine->mBounds.y + aLine->GetAscent();
  }

  // See if we're shrink wrapping the width
  if (aState.GetFlag(BRS_SHRINKWRAPWIDTH)) {
    // XXXldb Do we really still want to do this?
    // When determining the line's width we also need to include any
    // right floats that impact us. This represents the shrink wrap
    // width of the line
    if (aState.IsImpactedByFloat() && !aLine->IsLineWrapped()) {
      NS_ASSERTION(aState.mContentArea.width >= aState.mAvailSpaceRect.XMost(), "bad state");
      aLine->mBounds.width += aState.mContentArea.width - aState.mAvailSpaceRect.XMost();
    }
  }
#ifdef DEBUG
  {
    static nscoord lastHeight = 0;
    if (CRAZY_HEIGHT(aLine->mBounds.y)) {
      lastHeight = aLine->mBounds.y;
      if (abs(aLine->mBounds.y - lastHeight) > CRAZY_H/10) {
        nsFrame::ListTag(stdout);
        printf(": line=%p y=%d line.bounds.height=%d\n",
               NS_STATIC_CAST(void*, aLine.get()),
               aLine->mBounds.y, aLine->mBounds.height);
      }
    }
    else {
      lastHeight = 0;
    }
  }
#endif

  // Only block frames horizontally align their children because
  // inline frames "shrink-wrap" around their children (therefore
  // there is no extra horizontal space).
  const nsStyleText* styleText = GetStyleText();
  PRBool allowJustify = NS_STYLE_TEXT_ALIGN_JUSTIFY == styleText->mTextAlign &&
                        !aLineLayout.GetLineEndsInBR() &&
                        ShouldJustifyLine(aState, aLine);
  PRBool successful = aLineLayout.HorizontalAlignFrames(aLine->mBounds,
                            allowJustify, aState.GetFlag(BRS_SHRINKWRAPWIDTH));
  // XXX: not only bidi: right alignment can be broken after
  // RelativePositionFrames!!!
  // XXXldb Is something here considering relatively positioned frames at
  // other than their original positions?
  if (!successful) {
    // Mark the line dirty and then later once we've determined the width
    // we can do the horizontal alignment
    aLine->MarkDirty();
    aState.SetFlag(BRS_NEEDRESIZEREFLOW, PR_TRUE);
  }
#ifdef IBMBIDI
  // XXXldb Why don't we do this earlier?
  else {
    if (aState.mPresContext->BidiEnabled()) {
      if (!aState.mPresContext->IsVisualMode()) {
        nsBidiPresUtils* bidiUtils = aState.mPresContext->GetBidiUtils();

        if (bidiUtils && bidiUtils->IsSuccessful() ) {
          nsIFrame* nextInFlow = (aLine.next() != end_lines())
                                 ? aLine.next()->mFirstChild : nsnull;

          bidiUtils->ReorderFrames(aState.mPresContext,
                                   aState.mReflowState.rendContext,
                                   aLine->mFirstChild, nextInFlow,
                                   aLine->GetChildCount() );
        } // bidiUtils
      } // not visual mode
    } // bidi enabled
  } // successful
#endif // IBMBIDI

  nsRect combinedArea;
  aLineLayout.RelativePositionFrames(combinedArea);  // XXXldb This returned width as -15, 2001-06-12, Bugzilla
  aLine->SetCombinedArea(combinedArea);
  if (addedBullet) {
    aLineLayout.RemoveBulletFrame(mBullet);
  }

  // Inline lines do not have margins themselves; however they are
  // impacted by prior block margins. If this line ends up having some
  // height then we zero out the previous bottom margin value that was
  // already applied to the line's starting Y coordinate. Otherwise we
  // leave it be so that the previous blocks bottom margin can be
  // collapsed with a block that follows.
  nscoord newY;

  if (!aLine->CachedIsEmpty()) {
    // This line has some height. Therefore the application of the
    // previous-bottom-margin should stick.
    aState.mPrevBottomMargin.Zero();
    newY = aLine->mBounds.YMost();
  }
  else {
    // Don't let the previous-bottom-margin value affect the newY
    // coordinate (it was applied in ReflowInlineFrames speculatively)
    // since the line is empty.
    // We already called |ShouldApplyTopMargin|, and if we applied it
    // then BRS_APPLYTOPMARGIN is set.
    nscoord dy = aState.GetFlag(BRS_APPLYTOPMARGIN)
                   ? -aState.mPrevBottomMargin.get() : 0;
    newY = aState.mY + dy;
    aLine->SlideBy(dy); // XXXldb Do we really want to do this?
    // keep our ascent in sync
    // XXXldb If it's empty, shouldn't the next line control the ascent?
    if (mLines.front() == aLine) {
      mAscent += dy;
    }
  }

  // See if the line fit. If it doesn't we need to push it. Our first
  // line will always fit.

  // If we're just updating the maximum width then we don't care if it
  // fits; we'll assume it does, so that the maximum width will get
  // updated below. The line will be reflowed again and pushed then
  // if necessary.
  if (mLines.front() != aLine &&
      newY > aState.mBottomEdge &&
      aState.mBottomEdge != NS_UNCONSTRAINEDSIZE &&
      !aUpdateMaximumWidth) {
    // Push this line and all of it's children and anything else that
    // follows to our next-in-flow
    NS_ASSERTION((aState.mCurrentLine == aLine), "oops");
    PushLines(aState, aLine.prev());

    // Stop reflow and whack the reflow status if reflow hasn't
    // already been stopped.
    if (*aKeepReflowGoing) {
      aState.mReflowStatus |= NS_FRAME_NOT_COMPLETE;
      *aKeepReflowGoing = PR_FALSE;
    }
    return PR_TRUE;
  }

  // May be needed below
  PRBool wasAdjacentWIthTop = aState.IsAdjacentWithTop();

  aState.mY = newY;
  
  // If we're reflowing the line just to incrementally update the
  // maximum width, then don't post-place the line. It's doing work we
  // don't need, and it will update things like aState.mKidXMost that
  // we don't want updated...
  if (aUpdateMaximumWidth) {
    // However, we do need to update the max-element-width if requested
    if (aState.GetFlag(BRS_COMPUTEMAXELEMENTWIDTH)) {
      aState.UpdateMaxElementWidth(maxElementWidth);
      // We also cache the max element width in the line. This is needed for
      // incremental reflow
      aLine->mMaxElementWidth = maxElementWidth;
#ifdef DEBUG
      if (gNoisyMaxElementWidth) {
        IndentBy(stdout, gNoiseIndent);
        printf ("nsBlockFrame::PlaceLine: %p setting MEW for line %p to %d\n", 
                NS_STATIC_CAST(void*, this), NS_STATIC_CAST(void*, aLine.get()),
                maxElementWidth);
      }
#endif
    }

  } else {
    PostPlaceLine(aState, aLine, maxElementWidth);
  }

  // Add the already placed current-line floats to the line
  aLine->AppendFloats(aState.mCurrentLineFloats);

  // Any below current line floats to place?
  if (aState.mBelowCurrentLineFloats.NotEmpty()) {
    // Reflow the below-current-line floats, then add them to the
    // lines float list if there aren't any truncated floats.
    if (aState.PlaceBelowCurrentLineFloats(aState.mBelowCurrentLineFloats,
                                           wasAdjacentWIthTop)) {
      aLine->AppendFloats(aState.mBelowCurrentLineFloats);
    }
    else { 
      // At least one float is truncated, so fix up any placeholders that got split and 
      // push the line. XXX It may be better to put the float on the next line, but this 
      // is not common enough to justify the complexity. Or maybe it is now...

      // If we just want to calculate the maximum width, then don't push the line.
      // We'll reflow it again and then it will get pushed if necessary.
      if (!aUpdateMaximumWidth) {
        nsIFrame* lastPlaceholder = aState.mOverflowPlaceholders.LastChild();
        PushTruncatedPlaceholderLine(aState, aLine, lastPlaceholder, *aKeepReflowGoing);
      }
    }
  }

  // When a line has floats, factor them into the combined-area
  // computations.
  if (aLine->HasFloats()) {
    // Combine the float combined area (stored in aState) and the
    // value computed by the line layout code.
    nsRect lineCombinedArea(aLine->GetCombinedArea());
#ifdef NOISY_COMBINED_AREA
    ListTag(stdout);
    printf(": lineCA=%d,%d,%d,%d floatCA=%d,%d,%d,%d\n",
           lineCombinedArea.x, lineCombinedArea.y,
           lineCombinedArea.width, lineCombinedArea.height,
           aState.mFloatCombinedArea.x, aState.mFloatCombinedArea.y,
           aState.mFloatCombinedArea.width,
           aState.mFloatCombinedArea.height);
#endif
    lineCombinedArea.UnionRect(aState.mFloatCombinedArea, lineCombinedArea);

    aLine->SetCombinedArea(lineCombinedArea);
#ifdef NOISY_COMBINED_AREA
    printf("  ==> final lineCA=%d,%d,%d,%d\n",
           lineCombinedArea.x, lineCombinedArea.y,
           lineCombinedArea.width, lineCombinedArea.height);
#endif
  }

  // Apply break-after clearing if necessary
  // This must stay in sync with |ReflowDirtyLines|.
  if (aLine->HasFloatBreakAfter()) {
    aState.mY = aState.ClearFloats(aState.mY, aLine->GetBreakTypeAfter());
  }

  return PR_FALSE;
}

Here is the caller graph for this function:

nsresult nsComboboxControlFrame::PositionDropdown ( nsPresContext aPresContext,
nscoord  aHeight,
nsRect  aAbsoluteTwipsRect,
nsRect  aAbsolutePixelRect 
)

Definition at line 696 of file nsComboboxControlFrame.cpp.

{
   // Position the dropdown list. It is positioned below the display frame if there is enough
   // room on the screen to display the entire list. Otherwise it is placed above the display
   // frame.

   // Note: As first glance, it appears that you could simply get the absolute bounding box for the
   // dropdown list by first getting it's view, then getting the view's nsIWidget, then asking the nsIWidget
   // for it's AbsoluteBounds. The problem with this approach, is that the dropdown lists y location can
   // change based on whether the dropdown is placed below or above the display frame.
   // The approach, taken here is to get use the absolute position of the display frame and use it's location
   // to determine if the dropdown will go offscreen.

   // Use the height calculated for the area frame so it includes both
   // the display and button heights.
  nsresult rv = NS_OK;
  nscoord dropdownYOffset = aHeight;
// XXX: Enable this code to debug popping up above the display frame, rather than below it
  nsRect dropdownRect = mDropdownFrame->GetRect();

  nscoord screenHeightInPixels = 0;
  if (NS_SUCCEEDED(nsFormControlFrame::GetScreenHeight(aPresContext, screenHeightInPixels))) {
     // Get the height of the dropdown list in pixels.
     float t2p;
     t2p = aPresContext->TwipsToPixels();
     nscoord absoluteDropDownHeight = NSTwipsToIntPixels(dropdownRect.height, t2p);
    
      // Check to see if the drop-down list will go offscreen
    if (NS_SUCCEEDED(rv) && ((aAbsolutePixelRect.y + aAbsolutePixelRect.height + absoluteDropDownHeight) > screenHeightInPixels)) {
      // move the dropdown list up
      dropdownYOffset = - (dropdownRect.height);
    }
  }
 
  dropdownRect.x = 0;
  dropdownRect.y = dropdownYOffset; 

  mDropdownFrame->SetRect(dropdownRect);
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void nsIAnonymousContentCreator::PostCreateFrames ( ) [inline, virtual, inherited]

Reimplemented in nsTextControlFrame.

Definition at line 75 of file nsIAnonymousContentCreator.h.

{}
void nsBlockFrame::PostPlaceLine ( nsBlockReflowState aState,
nsLineBox aLine,
nscoord  aMaxElementWidth 
) [protected, inherited]

Definition at line 4663 of file nsBlockFrame.cpp.

{
  // Update max-element-width
  if (aState.GetFlag(BRS_COMPUTEMAXELEMENTWIDTH)) {
    aState.UpdateMaxElementWidth(aMaxElementWidth);
    // We also cache the max element width in the line. This is needed for
    // incremental reflow
    aLine->mMaxElementWidth = aMaxElementWidth;
#ifdef DEBUG
    if (gNoisyMaxElementWidth) {
      IndentBy(stdout, gNoiseIndent);
      printf ("nsBlockFrame::PostPlaceLine: %p setting line %p MEW %d\n", 
              NS_STATIC_CAST(void*, this), NS_STATIC_CAST(void*, aLine),
              aMaxElementWidth);
    }
#endif
  }

  // If this is an unconstrained reflow, then cache the line width in the
  // line. We'll need this during incremental reflow if we're asked to
  // calculate the maximum width
  if (aState.GetFlag(BRS_UNCONSTRAINEDWIDTH)) {
#ifdef NOISY_MAXIMUM_WIDTH
    printf("nsBlockFrame::PostPlaceLine during UC Reflow of block %p line %p caching max width %d\n", 
           NS_STATIC_CAST(void*, this), NS_STATIC_CAST(void*, aLine),
           aLine->mBounds.XMost());
#endif
    aLine->mMaximumWidth = aLine->mBounds.XMost();
  }

  // Update xmost
  nscoord xmost = aLine->mBounds.XMost();

#ifdef DEBUG
  if (CRAZY_WIDTH(xmost)) {
    ListTag(stdout);
    printf(": line=%p xmost=%d\n", NS_STATIC_CAST(void*, aLine), xmost);
  }
#endif
  if (xmost > aState.mKidXMost) {
    aState.mKidXMost = xmost;
#ifdef NOISY_KIDXMOST
    printf("%p PostPlaceLine aState.mKidXMost=%d\n", this, aState.mKidXMost); 
#endif
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

set up the conditions necessary for an incremental reflow.

the primary task is to mark the minimumly sufficient lines dirty.

Definition at line 1577 of file nsBlockFrame.cpp.

{
  // XXXwaterson this is non-optimal. We'd rather do this in
  // ReflowDirtyLines; however, I'm not quite ready to figure out how
  // to deal with reflow path retargeting yet.
  nsReflowPath *path = aState.mReflowState.path;

  nsReflowPath::iterator iter = path->FirstChild();
  nsReflowPath::iterator end = path->EndChildren();

  for ( ; iter != end; ++iter) {
    // Determine the line being impacted
    line_iterator line = FindLineFor(*iter);
    if (line == end_lines()) {
      // This assertion actually fires on lots of pages
      // (e.g., bugzilla, bugzilla query page), so limit it
      // to a few people until we fix the problem causing it.
      //
      // I think waterson explained once why it was happening -- I think
      // it has something to do with the interaction of the unconstrained
      // reflow in multi-pass reflow with the reflow command's chain, but
      // I don't remember the details.
#if defined(DEBUG_dbaron) || defined(DEBUG_waterson)
      NS_NOTREACHED("We don't have a line for the target of the reflow.  "
                    "Being inefficient");
#endif
      // This can't happen, but just in case it does...
      PrepareResizeReflow(aState);
      continue;
    }

    if (line->IsInline()) {
      if (aState.GetFlag(BRS_COMPUTEMAXWIDTH)) {
        // We've been asked to compute the maximum width of the block
        // frame, which ReflowLine() will handle by performing an
        // unconstrained reflow on the line. If this incremental
        // reflow is targeted at a continuing frame, we may have to
        // retarget it, as the unconstrained reflow can destroy some
        // of the continuations. This will allow the incremental
        // reflow to arrive at the target frame during the first-pass
        // unconstrained reflow.
        nsIFrame *prevInFlow = (*iter)->GetPrevInFlow();
        if (prevInFlow)
          RetargetInlineIncrementalReflow(iter, line, prevInFlow);
      }
    }

    // Mark this line dirty.  We need to mark the previous line dirty
    // if it is an inline line so that it can maybe pull up something
    // from the just affected line.
    MarkLineDirty(line);
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsBlockFrame::PrepareInitialReflow ( nsBlockReflowState aState) [protected, inherited]

set up the conditions necessary for an initial reflow

Definition at line 1570 of file nsBlockFrame.cpp.

{
  PrepareResizeReflow(aState);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsBlockFrame::PrepareResizeReflow ( nsBlockReflowState aState) [protected, inherited]

set up the conditions necessary for an resize reflow the primary task is to mark the minimumly sufficient lines dirty.

Definition at line 1844 of file nsBlockFrame.cpp.

{
  // See if we can try and avoid marking all the lines as dirty
  PRBool  tryAndSkipLines = PR_FALSE;

  // we need to calculate if any part of then block itself 
  // is impacted by a float (bug 19579)
  aState.GetAvailableSpace();

  // See if this is a constrained resize reflow that is not impacted by floats
  if ((! aState.IsImpactedByFloat()) &&
      (aState.mReflowState.reason == eReflowReason_Resize) &&
      (NS_UNCONSTRAINEDSIZE != aState.mReflowState.availableWidth)) {

    // If the text is left-aligned, then we try and avoid reflowing the lines
    const nsStyleText* styleText = GetStyleText();

    if ((NS_STYLE_TEXT_ALIGN_LEFT == styleText->mTextAlign) ||
        ((NS_STYLE_TEXT_ALIGN_DEFAULT == styleText->mTextAlign) &&
         (NS_STYLE_DIRECTION_LTR == aState.mReflowState.mStyleVisibility->mDirection))) {
      tryAndSkipLines = PR_TRUE;
    }
  }

#ifdef DEBUG
  if (gDisableResizeOpt) {
    tryAndSkipLines = PR_FALSE;
  }
  if (gNoisyReflow) {
    if (!tryAndSkipLines) {
      const nsStyleText* styleText = GetStyleText();
      IndentBy(stdout, gNoiseIndent);
      ListTag(stdout);
      printf(": marking all lines dirty: reason=%d availWidth=%d textAlign=%d\n",
             aState.mReflowState.reason,
             aState.mReflowState.availableWidth,
             styleText->mTextAlign);
    }
  }
#endif

  if (tryAndSkipLines) {
    nscoord newAvailWidth = aState.mReflowState.mComputedBorderPadding.left;
     
    if (NS_SHRINKWRAPWIDTH == aState.mReflowState.mComputedWidth) {
      if (NS_UNCONSTRAINEDSIZE != aState.mReflowState.mComputedMaxWidth) {
        newAvailWidth += aState.mReflowState.mComputedMaxWidth;
      }
      else {
        newAvailWidth += aState.mReflowState.availableWidth;
      }
    } else {
      if (NS_UNCONSTRAINEDSIZE != aState.mReflowState.mComputedWidth) {
        newAvailWidth += aState.mReflowState.mComputedWidth;
      }
      else {
        newAvailWidth += aState.mReflowState.availableWidth;
      }
    }
    NS_ASSERTION(NS_UNCONSTRAINEDSIZE != newAvailWidth, "bad math, newAvailWidth is infinite");

#ifdef DEBUG
    if (gNoisyReflow) {
      IndentBy(stdout, gNoiseIndent);
      ListTag(stdout);
      printf(": trying to avoid marking all lines dirty\n");
    }
#endif

    for (line_iterator line = begin_lines(), line_end = end_lines();
         line != line_end;
         ++line)
    {
      // We let child blocks make their own decisions the same
      // way we are here.
      if (line->IsBlock() ||
          // XXXldb We need HasPercentageDescendant, not HasPercentageChild!!!
          line->HasPercentageChild() || 
          line->HasFloats() ||
          (line != mLines.back() && !line->HasBreakAfter()) ||
          line->ResizeReflowOptimizationDisabled() ||
          line->IsImpactedByFloat() ||
          (line->mBounds.XMost() > newAvailWidth)) {
        line->MarkDirty();
      }

#ifdef REALLY_NOISY_REFLOW
      if (!line->IsBlock()) {
        printf("PrepareResizeReflow thinks line %p is %simpacted by floats\n", 
               line.get(), line->IsImpactedByFloat() ? "" : "not ");
      }
#endif
#ifdef DEBUG
      if (gNoisyReflow && !line->IsDirty()) {
        IndentBy(stdout, gNoiseIndent + 1);
        printf("skipped: line=%p next=%p %s %s%s%s breakTypeBefore/After=%d/%d xmost=%d\n",
           NS_STATIC_CAST(void*, line.get()),
           NS_STATIC_CAST(void*, (line.next() != end_lines() ? line.next().get() : nsnull)),
           line->IsBlock() ? "block" : "inline",
           line->HasBreakAfter() ? "has-break-after " : "",
           line->HasFloats() ? "has-floats " : "",
           line->IsImpactedByFloat() ? "impacted " : "",
           line->GetBreakTypeBefore(), line->GetBreakTypeAfter(),
           line->mBounds.XMost());
      }
#endif
    }
  }
  else {
    // Mark everything dirty
    for (line_iterator line = begin_lines(), line_end = end_lines();
         line != line_end;
         ++line)
    {
      line->MarkDirty();
    }
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

set up the conditions necessary for an styleChanged reflow

Definition at line 1829 of file nsBlockFrame.cpp.

{
  nsresult rv = UpdateBulletPosition(aState);

  // Mark everything dirty
  for (line_iterator line = begin_lines(), line_end = end_lines();
       line != line_end;
       ++line)
  {
    line->MarkDirty();
  }
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsBlockFrame::PropagateFloatDamage ( nsBlockReflowState aState,
nsLineBox aLine,
nscoord  aDeltaY 
) [protected, inherited]

Propagate reflow "damage" from from earlier lines to the current line.

The reflow damage comes from the following sources:

  1. The regions of float damage remembered during reflow.
  2. The combination of nonzero |aDeltaY| and any impact by a float, either the previous reflow or now.

When entering this function, |aLine| is still at its old position and |aDeltaY| indicates how much it will later be slid (assuming it doesn't get marked dirty and reflowed entirely).

Definition at line 2012 of file nsBlockFrame.cpp.

{
  NS_PRECONDITION(!aLine->IsDirty(), "should never be called on dirty lines");

  // Check the damage region recorded in the float damage.
  nsSpaceManager *spaceManager = aState.mReflowState.mSpaceManager;
  if (spaceManager->HasFloatDamage()) {
    nscoord lineYA = aLine->mBounds.y + aDeltaY;
    nscoord lineYB = lineYA + aLine->mBounds.height;
    if (spaceManager->IntersectsDamage(lineYA, lineYB)) {
      aLine->MarkDirty();
      return;
    }
  }

  if (aDeltaY) {
    // Cases we need to find:
    //
    // 1. the line was impacted by a float and now isn't
    // 2. the line wasn't impacted by a float and now is
    // 3. the line is impacted by a float both before and after and 
    //    the float has changed position relative to the line (or it's
    //    a different float).  (XXXPerf we don't currently
    //    check whether the float changed size.  We currently just
    //    mark blocks dirty and ignore any possibility of damage to
    //    inlines by it being a different float with a different
    //    size.)
    //
    //    XXXPerf: An optimization: if the line was and is completely
    //    impacted by a float and the float hasn't changed size,
    //    then we don't need to mark the line dirty.
    aState.GetAvailableSpace(aLine->mBounds.y + aDeltaY, PR_FALSE);
    PRBool wasImpactedByFloat = aLine->IsImpactedByFloat();
    PRBool isImpactedByFloat = aState.IsImpactedByFloat();
#ifdef REALLY_NOISY_REFLOW
    printf("nsBlockFrame::PropagateFloatDamage %p was = %d, is=%d\n", 
       this, wasImpactedByFloat, isImpactedByFloat);
#endif
    // Mark the line dirty if:
    //  1. It used to be impacted by a float and now isn't, or vice
    //     versa.
    //  2. It is impacted by a float and it is a block, which means
    //     that more or less of the line could be impacted than was in
    //     the past.  (XXXPerf This could be optimized further, since
    //     we're marking the whole line dirty.)
    if ((wasImpactedByFloat != isImpactedByFloat) ||
        (isImpactedByFloat && aLine->IsBlock())) {
      aLine->MarkDirty();
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsBlockFrame::PullFrame ( nsBlockReflowState aState,
line_iterator  aLine,
PRBool  aDamageDeletedLine,
nsIFrame *&  aFrameResult 
) [protected, inherited]

Pull frame from the next available location (one of our lines or one of our next-in-flows lines).

Definition at line 2823 of file nsBlockFrame.cpp.

{
  aFrameResult = nsnull;

  // First check our remaining lines
  if (end_lines() != aLine.next()) {
#ifdef DEBUG
    PRBool retry =
#endif
      PullFrameFrom(aState, aLine, this, PR_FALSE, aLine.next(),
                    aDamageDeletedLines, aFrameResult);
    NS_ASSERTION(!retry, "Shouldn't have to retry in the current block");
    return NS_OK;
  }

  NS_ASSERTION(!GetOverflowLines(),
    "Our overflow lines should have been removed at the start of reflow");

  // Try each next in flows
  nsBlockFrame* nextInFlow = aState.mNextInFlow;
  while (nextInFlow) {
    // first normal lines, then overflow lines
    if (!nextInFlow->mLines.empty()) {
      if (PullFrameFrom(aState, aLine, nextInFlow, PR_FALSE,
                        nextInFlow->mLines.begin(),
                        aDamageDeletedLines, aFrameResult)) {
        // try again with the same value of nextInFlow
        continue;
      }
      break;
    }

    nsLineList* overflowLines = nextInFlow->GetOverflowLines();
    if (overflowLines) {
      if (PullFrameFrom(aState, aLine, nextInFlow, PR_TRUE,
                        overflowLines->begin(),
                        aDamageDeletedLines, aFrameResult)) {
        // try again with the same value of nextInFlow
        continue;
      }
      break;
    }

    nextInFlow = (nsBlockFrame*) nextInFlow->mNextInFlow;
    aState.mNextInFlow = nextInFlow;
  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsBlockFrame::PullFrameFrom ( nsBlockReflowState aState,
nsLineBox aLine,
nsBlockFrame aFromContainer,
PRBool  aFromOverflowLine,
nsLineList::iterator  aFromLine,
PRBool  aDamageDeletedLines,
nsIFrame *&  aFrameResult 
) [protected, inherited]

Try to pull a frame out of a line pointed at by aFromLine.

If aUpdateGeometricParent is set then the pulled frames geometric parent will be updated (e.g. when pulling from a next-in-flows line list).

Note: pulling a frame from a line that is a place-holder frame doesn't automatically remove the corresponding float from the line's float array. This happens indirectly: either the line gets emptied (and destroyed) or the line gets reflowed (because we mark it dirty) and the code at the top of ReflowLine empties the array. So eventually, it will be removed, just not right away.

Returns:
PR_TRUE to force retrying of the pull.

Definition at line 2891 of file nsBlockFrame.cpp.

{
  nsLineBox* fromLine = aFromLine;
  NS_ABORT_IF_FALSE(fromLine, "bad line to pull from");
  NS_ABORT_IF_FALSE(fromLine->GetChildCount(), "empty line");
  NS_ABORT_IF_FALSE(aLine->GetChildCount(), "empty line");

  NS_ASSERTION(fromLine->IsBlock() == fromLine->mFirstChild->GetStyleDisplay()->IsBlockLevel(),
               "Disagreement about whether it's a block or not");

  if (fromLine->IsBlock()) {
    // If our line is not empty and the child in aFromLine is a block
    // then we cannot pull up the frame into this line. In this case
    // we stop pulling.
    aFrameResult = nsnull;
  }
  else {
    // Take frame from fromLine
    nsIFrame* frame = fromLine->mFirstChild;

    if (aFromContainer != this) {
      if (HandleOverflowPlaceholdersForPulledFrame(aState, frame)) {
        // we lost this one, retry
        return PR_TRUE;
      }

      aLine->LastChild()->SetNextSibling(frame);
    }
    // when aFromContainer is 'this', then aLine->LastChild()'s next sibling
    // is already set correctly.
    aLine->SetChildCount(aLine->GetChildCount() + 1);
      
    PRInt32 fromLineChildCount = fromLine->GetChildCount();
    if (0 != --fromLineChildCount) {
      // Mark line dirty now that we pulled a child
      fromLine->SetChildCount(fromLineChildCount);
      fromLine->MarkDirty();
      fromLine->mFirstChild = frame->GetNextSibling();
    }
    else {
      // Free up the fromLine now that it's empty
      // Its bounds might need to be redrawn, though.
      // XXX WHY do we invalidate the bounds AND the combined area? doesn't
      // the combined area always enclose the bounds?
      if (aDamageDeletedLines) {
        Invalidate(fromLine->mBounds);
      }
      nsLineList* fromLineList = aFromOverflowLine
        ? aFromContainer->RemoveOverflowLines()
        : &aFromContainer->mLines;
      if (aFromLine.next() != fromLineList->end())
        aFromLine.next()->MarkPreviousMarginDirty();

      Invalidate(fromLine->GetCombinedArea());
      fromLineList->erase(aFromLine);
      // Note that aFromLine just got incremented, so don't use it again here!
      aState.FreeLineBox(fromLine);

      // Put any remaining overflow lines back.
      if (aFromOverflowLine && !fromLineList->empty()) {
        aFromContainer->SetOverflowLines(fromLineList);
      }
    }

    // Change geometric parents
    if (aFromContainer != this) {
      // When pushing and pulling frames we need to check for whether any
      // views need to be reparented
      NS_ASSERTION(frame->GetParent() == aFromContainer, "unexpected parent frame");

      ReparentFrame(frame, aFromContainer, this);

      // The frame is being pulled from a next-in-flow; therefore we
      // need to add it to our sibling list.
      frame->SetNextSibling(nsnull);
      if (nsnull != aState.mPrevChild) {
        aState.mPrevChild->SetNextSibling(frame);
      }

      // The frame might have (or contain) floats that need to be
      // brought over too.
      ReparentFloats(frame, aFromContainer, aFromOverflowLine, PR_TRUE);
    }

    // Stop pulling because we found a frame to pull
    aFrameResult = frame;
#ifdef DEBUG
    VerifyLines(PR_TRUE);
#endif
  }
  return PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsBlockFrame::PushLines ( nsBlockReflowState aState,
nsLineList::iterator  aLineBefore 
) [protected, inherited]

Definition at line 4713 of file nsBlockFrame.cpp.

{
  nsLineList::iterator overBegin(aLineBefore.next());

  // PushTruncatedPlaceholderLine sometimes pushes the first line.  Ugh.
  PRBool firstLine = overBegin == begin_lines();

  if (overBegin != end_lines()) {
    // Remove floats in the lines from mFloats
    nsFrameList floats;
    nsIFrame* tail = nsnull;
    CollectFloats(overBegin->mFirstChild, floats, &tail, PR_FALSE, PR_TRUE);

    if (floats.NotEmpty()) {
      // Push the floats onto the front of the overflow out-of-flows list
      nsFrameList oofs = GetOverflowOutOfFlows();
      if (oofs.NotEmpty()) {
        floats.InsertFrames(nsnull, tail, oofs.FirstChild());
      }
      SetOverflowOutOfFlows(floats);
    }

    // overflow lines can already exist in some cases, in particular,
    // when shrinkwrapping and we discover that the shrinkwap causes
    // the height of some child block to grow which creates additional
    // overflowing content. In such cases we must prepend the new
    // overflow to the existing overflow.
    nsLineList* overflowLines = RemoveOverflowLines();
    if (!overflowLines) {
      // XXXldb use presshell arena!
      overflowLines = new nsLineList();
    }
    if (overflowLines) {
      if (!overflowLines->empty()) {
        mLines.back()->LastChild()->SetNextSibling(overflowLines->front()->mFirstChild);
      }
      overflowLines->splice(overflowLines->begin(), mLines, overBegin,
                            end_lines());
      NS_ASSERTION(!overflowLines->empty(), "should not be empty");
      // this takes ownership but it won't delete it immediately so we
      // can keep using it.
      SetOverflowLines(overflowLines);
  
      // Mark all the overflow lines dirty so that they get reflowed when
      // they are pulled up by our next-in-flow.

      // XXXldb Can this get called O(N) times making the whole thing O(N^2)?
      for (line_iterator line = overflowLines->begin(),
             line_end = overflowLines->end();
           line != line_end;
           ++line)
        {
          line->MarkDirty();
          line->MarkPreviousMarginDirty();
          line->mBounds.SetRect(0, 0, 0, 0);
          if (line->HasFloats()) {
            line->FreeFloats(aState.mFloatCacheFreeList);
          }
        }
    }
  }

  // Break frame sibling list
  if (!firstLine)
    aLineBefore->LastChild()->SetNextSibling(nsnull);

#ifdef DEBUG
  VerifyOverflowSituation();
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsBlockFrame::PushTruncatedPlaceholderLine ( nsBlockReflowState aState,
line_iterator  aLine,
nsIFrame aLastPlaceholder,
PRBool aKeepReflowGoing 
) [protected, inherited]

Definition at line 3812 of file nsBlockFrame.cpp.

{
  UndoSplitPlaceholders(aState, aLastPlaceholder);

  line_iterator prevLine = aLine;
  --prevLine;
  PushLines(aState, prevLine);
  aKeepReflowGoing = PR_FALSE;
  aState.mReflowStatus = NS_FRAME_NOT_COMPLETE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from nsBlockFrame.

Definition at line 367 of file nsComboboxControlFrame.cpp.

{
  NS_PRECONDITION(0 != aInstancePtr, "null ptr");
  if (NULL == aInstancePtr) {
    return NS_ERROR_NULL_POINTER;
  }

  if (aIID.Equals(NS_GET_IID(nsIComboboxControlFrame))) {
    *aInstancePtr = (void*)(nsIComboboxControlFrame*)this;
    return NS_OK;
  } else if (aIID.Equals(NS_GET_IID(nsIFormControlFrame))) {
    *aInstancePtr = (void*)(nsIFormControlFrame*)this;
    return NS_OK;
  } else if (aIID.Equals(NS_GET_IID(nsIAnonymousContentCreator))) {                                         
    *aInstancePtr = (void*)(nsIAnonymousContentCreator*)this;
    return NS_OK;   
  } else if (aIID.Equals(NS_GET_IID(nsISelectControlFrame))) {
    *aInstancePtr = (void *)(nsISelectControlFrame*)this;
    return NS_OK;
  } else if (aIID.Equals(NS_GET_IID(nsIStatefulFrame))) {
    *aInstancePtr = (void*)(nsIStatefulFrame*)this;
    return NS_OK;
  } else if (aIID.Equals(NS_GET_IID(nsIRollupListener))) {
    *aInstancePtr = (void*)(nsIRollupListener*)this;
    return NS_OK;
  } else if (aIID.Equals(NS_GET_IID(nsIScrollableViewProvider))) {
    *aInstancePtr = (void*)(nsIScrollableViewProvider*)this;
    return NS_OK;
  } 
  
  return nsAreaFrame::QueryInterface(aIID, aInstancePtr);
}

Here is the call graph for this function:

Definition at line 129 of file nsBlockFrame.h.

{ return mLines.rbegin(); }

Here is the call graph for this function:

Definition at line 131 of file nsBlockFrame.h.

{ return mLines.rbegin(); }

Here is the call graph for this function:

Redisplay the selected text (will do nothing if text has not changed)

Implements nsIComboboxControlFrame.

Definition at line 1776 of file nsComboboxControlFrame.cpp.

{
  PRInt32 selectedIndex;
  mListControlFrame->GetSelectedIndex(&selectedIndex);

  return RedisplayText(selectedIndex);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1785 of file nsComboboxControlFrame.cpp.

{
  // Get the text to display
  if (aIndex != -1) {
    mListControlFrame->GetOptionText(aIndex, mDisplayedOptionText);
  } else {
    mDisplayedOptionText.Truncate();
  }
  mDisplayedIndex = aIndex;

  REFLOW_DEBUG_MSG2("RedisplayText \"%s\"\n",
                    NS_LossyConvertUCS2toASCII(mDisplayedOptionText).get());

  // Send reflow command because the new text maybe larger
  nsresult rv = NS_OK;
  if (mDisplayContent && mEventQueueService) {
    // Don't call ActuallyDisplayText(PR_TRUE) directly here since that
    // could cause recursive frame construction. See bug 283117 and the comment in
    // HandleRedisplayTextEvent() below.
    nsCOMPtr<nsIEventQueue> eventQueue;
    rv = mEventQueueService->GetSpecialEventQueue(nsIEventQueueService::UI_THREAD_EVENT_QUEUE,
                                                  getter_AddRefs(eventQueue));
    if (eventQueue) {
      RedisplayTextEvent* event = new RedisplayTextEvent(this);
      if (event) {
        // Revoke outstanding events to avoid out-of-order events which could mean
        // displaying the wrong text.
        if (mRedisplayTextEventPosted) {
          eventQueue->RevokeEvents(this);
          mRedisplayTextEventPosted = PR_FALSE;
        }

        rv = eventQueue->PostEvent(event);

        if (NS_SUCCEEDED(rv)) {
          mRedisplayTextEventPosted = PR_TRUE;
        } else {
          PL_DestroyEvent(event);
        }
      } else {
        rv = NS_ERROR_OUT_OF_MEMORY;
      }
    }
  }
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from nsBlockFrame.

Definition at line 1123 of file nsComboboxControlFrame.cpp.

{
  DO_GLOBAL_REFLOW_COUNT("nsComboboxControlFrame", aReflowState.reason);
  DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);

  aStatus = NS_FRAME_COMPLETE;

  REFLOW_COUNTER_REQUEST();

#ifdef DO_REFLOW_DEBUG
  printf("-------------Starting Combobox Reflow ----------------------------\n");
  printf("%p ** Id: %d nsCCF::Reflow %d R: ", this, mReflowId, myCounter++);
  switch (aReflowState.reason) {
    case eReflowReason_Initial:
      printf("Ini");break;
    case eReflowReason_Incremental:
      printf("Inc");break;
    case eReflowReason_Resize:
      printf("Rsz");break;
    case eReflowReason_StyleChange:
      printf("Sty");break;
    case eReflowReason_Dirty:
      printf("Drt ");
      break;
    default:printf("<unknown>%d", aReflowState.reason);break;
  }
  
  printSize("AW", aReflowState.availableWidth);
  printSize("AH", aReflowState.availableHeight);
  printSize("CW", aReflowState.mComputedWidth);
  printSize("CH", aReflowState.mComputedHeight);

  nsCOMPtr<nsIDOMHTMLOptionsCollection> optionsTemp = getter_AddRefs(GetOptions(mContent));
  PRUint32 numOptions;
  optionsTemp->GetLength(&numOptions);
  printSize("NO", (nscoord)numOptions);

  printf(" *\n");

#endif


  PRBool bailOnWidth;
  PRBool bailOnHeight;

  // Do initial check to see if we can bail out
  // If it is an Initial or Incremental Reflow we never bail out here
  // XXX right now we only bail if the width meets the criteria
  //
  // We bail:
  //   if mComputedWidth == NS_UNCONSTRAINEDSIZE and
  //      availableWidth == NS_UNCONSTRAINEDSIZE and 
  //      we have cached an available size
  //
  // We bail:
  //   if mComputedWidth == NS_UNCONSTRAINEDSIZE and
  //      availableWidth != NS_UNCONSTRAINEDSIZE and 
  //      availableWidth minus its border equals our cached available size
  //
  // We bail:
  //   if mComputedWidth != NS_UNCONSTRAINEDSIZE and
  //      cached availableSize.width == aReflowState.mComputedWidth and 
  //      cached AvailableSize.width == aCacheSize.width
  //
  // NOTE: this returns whether we are doing an Incremental reflow
  nsFormControlFrame::SkipResizeReflow(mCacheSize,
                                       mCachedAscent,
                                       mCachedMaxElementWidth,
                                       mCachedAvailableSize, 
                                       aDesiredSize, aReflowState, 
                                       aStatus, 
                                       bailOnWidth, bailOnHeight);
  if (bailOnWidth) {
#ifdef DO_REFLOW_DEBUG // check or size
    nsMargin borderPadding(0, 0, 0, 0);
    CalcBorderPadding(borderPadding);
    UNCONSTRAINED_CHECK();
#endif
    REFLOW_DEBUG_MSG3("^** Done nsCCF DW: %d  DH: %d\n\n", PX(aDesiredSize.width), PX(aDesiredSize.height));
    NS_ASSERTION(aDesiredSize.width != kSizeNotSet,  "aDesiredSize.width != kSizeNotSet");
    NS_ASSERTION(aDesiredSize.height != kSizeNotSet, "aDesiredSize.height != kSizeNotSet");
    aDesiredSize.mOverflowArea.x      = 0;
    aDesiredSize.mOverflowArea.y      = 0;
    aDesiredSize.mOverflowArea.width  = aDesiredSize.width;
    aDesiredSize.mOverflowArea.height = aDesiredSize.height;
    FinishAndStoreOverflow(&aDesiredSize);
    return NS_OK;
  }

  if (eReflowReason_Initial == aReflowState.reason) {
    if (NS_FAILED(CreateDisplayFrame(aPresContext))) {
      return NS_ERROR_FAILURE;
    }
  }

  // Go get all of the important frame
  nsresult rv = NS_OK;
  // Don't try to do any special sizing and positioning unless all of the frames
  // have been created.
  if ((nsnull == mDisplayFrame) ||
     (nsnull == mButtonFrame) ||
     (nsnull == mDropdownFrame)) 
  {
     // Since combobox frames are missing just do a normal area frame reflow
    return nsAreaFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
  }

  // Make sure the displayed text is the same as the selected option, bug 297389.
  PRInt32 selectedIndex;
  nsAutoString selectedOptionText;
  if (!mDroppedDown) {
    mListControlFrame->GetSelectedIndex(&selectedIndex);
  }
  else {
    // In dropped down mode the "selected index" is the hovered menu item,
    // we want the last selected item which is |mDisplayedIndex| in this case.
    selectedIndex = mDisplayedIndex;
  }
  if (selectedIndex != -1) {
    mListControlFrame->GetOptionText(selectedIndex, selectedOptionText);
  }
  if (mDisplayedOptionText != selectedOptionText) {
    RedisplayText(selectedIndex);
  }

  // We should cache this instead getting it everytime
  // the default size of the of scrollbar
  // that will be the default width of the dropdown button
  // the height will be the height of the text
  float w, h;
  // Get the width in Device pixels times p2t
  aPresContext->DeviceContext()->GetScrollBarDimensions(w, h);
  nscoord scrollbarWidth = NSToCoordRound(w);
  
  // set up a new reflow state for use throughout
  nsHTMLReflowState firstPassState(aReflowState);
  nsHTMLReflowMetrics dropdownDesiredSize(nsnull);

  // Check to see if this a fully unconstrained reflow
  PRBool fullyUnconstrained = firstPassState.mComputedWidth == NS_UNCONSTRAINEDSIZE;

  PRBool forceReflow = PR_FALSE;

  // Only reflow the display and button 
  // if they are the target of the incremental reflow, unless they change size. 
  if (eReflowReason_Incremental == aReflowState.reason) {
    nsHTMLReflowCommand *command = firstPassState.path->mReflowCommand;

    // Check to see if we are the target of the Incremental Reflow
    if (command) {
      // We need to check here to see if we can get away with just reflowing
      // the combobox and not the dropdown
      REFLOW_DEBUG_MSG("-----------------Target is Combobox------------\n");

      // If the mComputedWidth matches our cached display width 
      // then we get away with bailing out
      PRBool doFullReflow = firstPassState.mComputedWidth != NS_UNCONSTRAINEDSIZE &&
                            firstPassState.mComputedWidth != mItemDisplayWidth;
      if (!doFullReflow) {
        // OK, so we got lucky and the size didn't change
        // so do a simple reflow and bail out
        REFLOW_DEBUG_MSG("------------Reflowing AreaFrame and bailing----\n\n");
        ReflowCombobox(aPresContext, firstPassState, aDesiredSize, aStatus, 
                           mDisplayFrame, mButtonFrame, mItemDisplayWidth, 
                           scrollbarWidth, aReflowState.mComputedBorderPadding);
        REFLOW_COUNTER();
        UNCONSTRAINED_CHECK();
        REFLOW_DEBUG_MSG3("&** Done nsCCF DW: %d  DH: %d\n\n", PX(aDesiredSize.width), PX(aDesiredSize.height));
        NS_ASSERTION(aDesiredSize.width != kSizeNotSet,  "aDesiredSize.width != kSizeNotSet");
        NS_ASSERTION(aDesiredSize.height != kSizeNotSet, "aDesiredSize.height != kSizeNotSet");
        aDesiredSize.mOverflowArea.x      = 0;
        aDesiredSize.mOverflowArea.y      = 0;
        aDesiredSize.mOverflowArea.width  = aDesiredSize.width;
        aDesiredSize.mOverflowArea.height = aDesiredSize.height;
      }
      else {
        // Nope, something changed that affected our size 
        // so we need to do a full reflow and resize ourself
        REFLOW_DEBUG_MSG("------------Do Full Reflow----\n\n");
        firstPassState.reason = eReflowReason_StyleChange;
        firstPassState.path = nsnull;
        forceReflow = PR_TRUE;
      }
    }

    // See if any of the children are targets, as well.
    nsReflowPath::iterator iter = aReflowState.path->FirstChild();
    nsReflowPath::iterator end = aReflowState.path->EndChildren();
    for ( ; iter != end; ++iter) {
      // Now, see if our target is the dropdown
      // If so, maybe an items was added or some style changed etc.
      //               OR
      // We get an Incremental reflow on the dropdown when it is being 
      // shown or hidden.
      if (*iter == mDropdownFrame) {
        REFLOW_DEBUG_MSG("---------Target is Dropdown (Clearing Unc DD Size)---\n");
        // Nope, we were unlucky so now we do a full reflow
        mCachedUncDropdownSize.width  = kSizeNotSet;
        mCachedUncDropdownSize.height = kSizeNotSet;       
        REFLOW_DEBUG_MSG("---- Doing Full Reflow\n");
        // This is an incremental reflow targeted at the dropdown list
        // and it didn't have anything to do with being show or hidden.
        // 
        // The incremental reflow will not get to the dropdown list 
        // because it is in the "popup" list 
        // when this flow of control drops out of this if it will do a reflow
        // on the AreaFrame which SHOULD make it get tothe drop down 
        // except that it is in the popup list, so we have it reflowed as
        // a StyleChange, this is not as effecient as doing an Incremental
        //
        // At this point we want to by pass the reflow optimization in the dropdown
        // because we aren't why it is getting an incremental reflow, but we do
        // know that it needs to be resized or restyled
        //mListControlFrame->SetOverrideReflowOptimization(PR_TRUE);

      } else if (*iter == mDisplayFrame || *iter == mButtonFrame) {
        REFLOW_DEBUG_MSG2("-----------------Target is %s------------\n", (*iter == mDisplayFrame?"DisplayItem Frame":"DropDown Btn Frame"));
        // The incremental reflow is targeted at either the block or the button
        REFLOW_DEBUG_MSG("---- Doing AreaFrame Reflow and then bailing out\n");
        // Do simple reflow and bail out
        ReflowCombobox(aPresContext, firstPassState, aDesiredSize, aStatus, 
                       mDisplayFrame, mButtonFrame, 
                       mItemDisplayWidth, scrollbarWidth,
                       aReflowState.mComputedBorderPadding,
                       kSizeNotSet, PR_TRUE);
        REFLOW_DEBUG_MSG3("+** Done nsCCF DW: %d  DH: %d\n\n", PX(aDesiredSize.width), PX(aDesiredSize.height));
        REFLOW_COUNTER();
        UNCONSTRAINED_CHECK();
        NS_ASSERTION(aDesiredSize.width != kSizeNotSet,  "aDesiredSize.width != kSizeNotSet");
        NS_ASSERTION(aDesiredSize.height != kSizeNotSet, "aDesiredSize.height != kSizeNotSet");
        aDesiredSize.mOverflowArea.x      = 0;
        aDesiredSize.mOverflowArea.y      = 0;
        aDesiredSize.mOverflowArea.width  = aDesiredSize.width;
        aDesiredSize.mOverflowArea.height = aDesiredSize.height;
        continue;
      } else {
        nsIFrame * plainLstFrame;
        if (NS_SUCCEEDED(mListControlFrame->QueryInterface(NS_GET_IID(nsIFrame), (void**)&plainLstFrame))) {
          nsIFrame * frame = plainLstFrame->GetFirstChild(nsnull);
          nsIScrollableFrame * scrollFrame;
          if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsIScrollableFrame), (void**)&scrollFrame))) {
            plainLstFrame->Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);

            aDesiredSize.width  = mCacheSize.width;
            aDesiredSize.height = mCacheSize.height;
            aDesiredSize.ascent = mCachedAscent;
            aDesiredSize.descent = aDesiredSize.height - aDesiredSize.ascent;

            if (aDesiredSize.mComputeMEW) {
              aDesiredSize.mMaxElementWidth = mCachedMaxElementWidth;
            }
            NS_ASSERTION(aDesiredSize.width != kSizeNotSet,  "aDesiredSize.width != kSizeNotSet");
            NS_ASSERTION(aDesiredSize.height != kSizeNotSet, "aDesiredSize.height != kSizeNotSet");
            aDesiredSize.mOverflowArea.x      = 0;
            aDesiredSize.mOverflowArea.y      = 0;
            aDesiredSize.mOverflowArea.width  = aDesiredSize.width;
            aDesiredSize.mOverflowArea.height = aDesiredSize.height;