Commit 081c78e6 authored by troy%netscape.com's avatar troy%netscape.com
Browse files

First of a few changes to allow frames to have multiple child lists.

FirstChild() now takes an additional argument which is the name of the
child list.
parent 8af5fd97
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -1073,8 +1073,15 @@ HTMLStyleSheetImpl::ConstructRootFrame(nsIPresContext* aPresContext,
  
    // See if we're paginated
    if (aPresContext->IsPaginated()) {
      // nsScrollFrame*  scrollFrame;
      nsIFrame* pageSequenceFrame;

#if 0
      // Wrap the simple page sequence frame in a scroll frame
      // XXX Only do this if it's print oreview
      if NS_SUCCEEDED(NS_NewScrollFrame(aContent, aParentFrame, scrollFrame)) {
#endif

      // Create a simple page sequence frame
      rv = NS_NewSimplePageSequenceFrame(aContent, aNewFrame, pageSequenceFrame);
      if (NS_SUCCEEDED(rv)) {
@@ -1340,7 +1347,7 @@ HTMLStyleSheetImpl::GetAdjustedParentFrame(nsIFrame* aCurrentParentFrame,
      if (NS_STYLE_DISPLAY_TABLE_CAPTION!=aChildDisplayType)
      {
        nsIFrame *innerTableFrame=nsnull;
        aCurrentParentFrame->FirstChild(innerTableFrame);
        aCurrentParentFrame->FirstChild(nsnull, innerTableFrame);
        if (nsnull!=innerTableFrame)
        {
          const nsStyleDisplay* innerTableDisplay;
@@ -1508,7 +1515,7 @@ HTMLStyleSheetImpl::GetFrameFor(nsIPresShell* aPresShell, nsIContent* aContent)
    frame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display);

    if (display->IsBlockLevel() && IsScrollable(display)) {
      frame->FirstChild(frame);
      frame->FirstChild(nsnull, frame);
    }
  }

+3 −3
Original line number Diff line number Diff line
@@ -912,7 +912,7 @@ FindFrameWithContent(nsIFrame* aFrame, nsIContent* aContent)
  }
  NS_RELEASE(frameContent);

  aFrame->FirstChild(aFrame);
  aFrame->FirstChild(nsnull, aFrame);
  while (aFrame) {
    nsIFrame* result = FindFrameWithContent(aFrame, aContent);

@@ -1043,8 +1043,8 @@ static void
CompareTrees(nsIFrame* aA, nsIFrame* aB)
{
  nsIFrame* k1, *k2;
  aA->FirstChild(k1);
  aB->FirstChild(k2);
  aA->FirstChild(nsnull, k1);
  aB->FirstChild(nsnull, k2);
  NS_ASSERTION(nsContainerFrame::LengthOf(k1) == nsContainerFrame::LengthOf(k2),
               "child counts don't match");

+18 −7
Original line number Diff line number Diff line
@@ -111,11 +111,15 @@ typedef PRUint32 nsFrameState;
 * A frame in the layout model. This interface is supported by all frame
 * objects.
 *
 * Frames are NOT reference counted. Use the DeleteFrame() member function
 * to delete a frame.
 * Frames can have multiple child lists: the default unnamed child list
 * (referred to as the <i>principal</i> child list, and additional named
 * child lists. There is an ordering of frames within a child list, but
 * there is no order defined between frames in different child lists of
 * the same parent frame.
 *
 * The lifetime of the frame hierarchy is bounded by the lifetime of the
 * presentation shell which owns the frames.
 * Frames are NOT reference counted. Use the DeleteFrame() member function
 * to delete a frame. The lifetime of the frame hierarchy is bounded by the
 * lifetime of the presentation shell which owns the frames.
 */
class nsIFrame : public nsISupports
{
@@ -201,11 +205,18 @@ public:
  NS_IMETHOD  SizeTo(nscoord aWidth, nscoord aHeight) = 0;

  /**
   * Child frame enumeration.
   * Get the first child frame from the specified child list.
   *
   * Child frames are linked together in a singly-linked list.
   * @param   aListName the name of the child list. A NULL pointer for the atom
   *            name means the unnamed principal child list
   * @return  NS_ERROR_INVALID_ARG if there is no child list with the specified name
   * @see     #GetAdditionalListName()
   */
  NS_IMETHOD  FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const = 0;

  /**
   * Child frames are linked together in a singly-linked
   */
  NS_IMETHOD  FirstChild(nsIFrame*& aFirstChild) const = 0;
  NS_IMETHOD  GetNextSibling(nsIFrame*& aNextSibling) const = 0;
  NS_IMETHOD  SetNextSibling(nsIFrame* aNextSibling) = 0;

+12 −7
Original line number Diff line number Diff line
@@ -262,7 +262,7 @@ public:
  NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList);
  NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext,
                                   nsIStyleContext* aParentContext);
  NS_IMETHOD FirstChild(nsIFrame*& aFirstChild) const;
  NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const;
  NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext);
  NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const;
  NS_IMETHOD CreateContinuingFrame(nsIPresContext&  aPresContext,
@@ -1839,10 +1839,15 @@ nsBlockFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const
// Child frame enumeration

NS_IMETHODIMP
nsBlockFrame::FirstChild(nsIFrame*& aFirstChild) const
nsBlockFrame::FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const
{
  if (nsnull == aListName) {
    aFirstChild = (nsnull != mLines) ? mLines->mFirstChild : nsnull;
    return NS_OK;
  } else {
    aFirstChild = nsnull;
    return NS_ERROR_INVALID_ARG;
  }
}

//////////////////////////////////////////////////////////////////////
@@ -4064,7 +4069,7 @@ FindFloatersIn(nsIFrame* aFrame, nsVoidArray*& aArray)

  if (NS_STYLE_DISPLAY_INLINE == display->mDisplay) {
    nsIFrame* kid;
    aFrame->FirstChild(kid);
    aFrame->FirstChild(nsnull, kid);
    while (nsnull != kid) {
      nsresult rv = FindFloatersIn(kid, aArray);
      if (NS_OK != rv) {
@@ -4376,7 +4381,7 @@ nsBlockFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext,
#ifdef NS_DEBUG
  PRInt32   childCount;
  nsIFrame* firstChild;
  nextInFlow->FirstChild(firstChild);
  nextInFlow->FirstChild(nsnull, firstChild);
  childCount = LengthOf(firstChild);
  NS_ASSERTION((0 == childCount) && (nsnull == firstChild),
               "deleting !empty next-in-flow");
@@ -4671,7 +4676,7 @@ nsBlockReflowState::IsLeftMostChild(nsIFrame* aFrame)
      // See if there are any non-zero sized child frames that precede
      // aFrame in the child list
      nsIFrame* child;
      parent->FirstChild(child);
      parent->FirstChild(nsnull, child);
      while ((nsnull != child) && (aFrame != child)) {
        nsSize  size;

+12 −7
Original line number Diff line number Diff line
@@ -262,7 +262,7 @@ public:
  NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList);
  NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext,
                                   nsIStyleContext* aParentContext);
  NS_IMETHOD FirstChild(nsIFrame*& aFirstChild) const;
  NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const;
  NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext);
  NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const;
  NS_IMETHOD CreateContinuingFrame(nsIPresContext&  aPresContext,
@@ -1839,10 +1839,15 @@ nsBlockFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const
// Child frame enumeration

NS_IMETHODIMP
nsBlockFrame::FirstChild(nsIFrame*& aFirstChild) const
nsBlockFrame::FirstChild(nsIAtom* aListName, nsIFrame*& aFirstChild) const
{
  if (nsnull == aListName) {
    aFirstChild = (nsnull != mLines) ? mLines->mFirstChild : nsnull;
    return NS_OK;
  } else {
    aFirstChild = nsnull;
    return NS_ERROR_INVALID_ARG;
  }
}

//////////////////////////////////////////////////////////////////////
@@ -4064,7 +4069,7 @@ FindFloatersIn(nsIFrame* aFrame, nsVoidArray*& aArray)

  if (NS_STYLE_DISPLAY_INLINE == display->mDisplay) {
    nsIFrame* kid;
    aFrame->FirstChild(kid);
    aFrame->FirstChild(nsnull, kid);
    while (nsnull != kid) {
      nsresult rv = FindFloatersIn(kid, aArray);
      if (NS_OK != rv) {
@@ -4376,7 +4381,7 @@ nsBlockFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext,
#ifdef NS_DEBUG
  PRInt32   childCount;
  nsIFrame* firstChild;
  nextInFlow->FirstChild(firstChild);
  nextInFlow->FirstChild(nsnull, firstChild);
  childCount = LengthOf(firstChild);
  NS_ASSERTION((0 == childCount) && (nsnull == firstChild),
               "deleting !empty next-in-flow");
@@ -4671,7 +4676,7 @@ nsBlockReflowState::IsLeftMostChild(nsIFrame* aFrame)
      // See if there are any non-zero sized child frames that precede
      // aFrame in the child list
      nsIFrame* child;
      parent->FirstChild(child);
      parent->FirstChild(nsnull, child);
      while ((nsnull != child) && (aFrame != child)) {
        nsSize  size;

Loading