Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Member Functions | Protected Attributes
nsAbsoluteContainingBlock Class Reference

This class contains the logic for being an absolute containing block. More...

#include <nsAbsoluteContainingBlock.h>

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

List of all members.

Public Member Functions

 nsAbsoluteContainingBlock ()
virtual ~nsAbsoluteContainingBlock ()
virtual nsIAtomGetChildListName () const
nsresult FirstChild (const nsIFrame *aDelegatingFrame, nsIAtom *aListName, nsIFrame **aFirstChild) const
nsresult SetInitialChildList (nsIFrame *aDelegatingFrame, nsPresContext *aPresContext, nsIAtom *aListName, nsIFrame *aChildList)
nsresult AppendFrames (nsIFrame *aDelegatingFrame, nsIAtom *aListName, nsIFrame *aFrameList)
nsresult InsertFrames (nsIFrame *aDelegatingFrame, nsIAtom *aListName, nsIFrame *aPrevFrame, nsIFrame *aFrameList)
nsresult RemoveFrame (nsIFrame *aDelegatingFrame, nsIAtom *aListName, nsIFrame *aOldFrame)
nsresult ReplaceFrame (nsIFrame *aDelegatingFrame, nsIAtom *aListName, nsIFrame *aOldFrame, nsIFrame *aNewFrame)
nsresult Reflow (nsIFrame *aDelegatingFrame, nsPresContext *aPresContext, const nsHTMLReflowState &aReflowState, nscoord aContainingBlockWidth, nscoord aContainingBlockHeight, nsRect *aChildBounds=nsnull, PRBool aForceReflow=PR_TRUE, PRBool aCBWidthChanged=PR_TRUE, PRBool aCBHeightChanged=PR_TRUE)
PRBool ReflowingAbsolutesOnly (nsIFrame *aDelegatingFrame, const nsHTMLReflowState &aReflowState)
void IncrementalReflow (nsIFrame *aDelegatingFrame, nsPresContext *aPresContext, const nsHTMLReflowState &aReflowState, nscoord aContainingBlockWidth, nscoord aContainingBlockHeight)
void DestroyFrames (nsIFrame *aDelegatingFrame, nsPresContext *aPresContext)
PRBool HasAbsoluteFrames ()
void CalculateChildBounds (nsPresContext *aPresContext, nsRect &aChildBounds)

Protected Member Functions

PRBool FrameDependsOnContainer (nsIFrame *f, PRBool aCBWidthChanged, PRBool aCBHeightChanged)
nsresult ReflowAbsoluteFrame (nsIFrame *aDelegatingFrame, nsPresContext *aPresContext, const nsHTMLReflowState &aReflowState, nscoord aContainingBlockWidth, nscoord aContainingBlockHeight, nsIFrame *aKidFrame, nsReflowReason aReason, nsReflowStatus &aStatus)

Protected Attributes

nsFrameList mAbsoluteFrames

Detailed Description

This class contains the logic for being an absolute containing block.

There is no principal child list, just a named child list which contains the absolutely positioned frames

All functions include as the first argument the frame that is delegating the request

See also:
nsLayoutAtoms::absoluteList

Definition at line 59 of file nsAbsoluteContainingBlock.h.


Constructor & Destructor Documentation

Definition at line 62 of file nsAbsoluteContainingBlock.h.

{ }          // useful for debugging

Definition at line 64 of file nsAbsoluteContainingBlock.h.

{ } // useful for debugging

Member Function Documentation

nsresult nsAbsoluteContainingBlock::AppendFrames ( nsIFrame aDelegatingFrame,
nsIAtom aListName,
nsIFrame aFrameList 
)

Definition at line 77 of file nsAbsoluteContainingBlock.cpp.

{
  // Append the frames to our list of absolutely positioned frames
#ifdef NS_DEBUG
  nsFrame::VerifyDirtyBitSet(aFrameList);
#endif
  mAbsoluteFrames.AppendFrames(nsnull, aFrameList);

  // Generate a reflow command to reflow the dirty frames
  return aDelegatingFrame->GetPresContext()->PresShell()->
          AppendReflowCommand(aDelegatingFrame, eReflowType_ReflowDirty,
                              GetChildListName());
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 214 of file nsAbsoluteContainingBlock.cpp.

{
  // Initialize the OUT parameters
  aChildBounds.SetRect(0, 0, 0, 0);

  for (nsIFrame* f = mAbsoluteFrames.FirstChild(); f; f = f->GetNextSibling()) {
    AddFrameToChildBounds(f, &aChildBounds);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsAbsoluteContainingBlock::DestroyFrames ( nsIFrame aDelegatingFrame,
nsPresContext aPresContext 
)

Definition at line 431 of file nsAbsoluteContainingBlock.cpp.

{
  mAbsoluteFrames.DestroyFrames(aPresContext);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsAbsoluteContainingBlock::FirstChild ( const nsIFrame aDelegatingFrame,
nsIAtom aListName,
nsIFrame **  aFirstChild 
) const

Definition at line 53 of file nsAbsoluteContainingBlock.cpp.

{
  NS_PRECONDITION(GetChildListName() == aListName, "unexpected child list name");
  *aFirstChild = mAbsoluteFrames.FirstChild();
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsAbsoluteContainingBlock::FrameDependsOnContainer ( nsIFrame f,
PRBool  aCBWidthChanged,
PRBool  aCBHeightChanged 
) [protected]

Definition at line 271 of file nsAbsoluteContainingBlock.cpp.

{
  const nsStylePosition* pos = f->GetStylePosition();
  // See if f's position might have changed because it depends on a
  // placeholder's position
  // This can happen in the following cases:
  // 1) Vertical positioning.  "top" must be auto and "bottom" must be auto
  //    (otherwise the vertical position is completely determined by
  //    whichever of them is not auto and the height).
  // 2) Horizontal positioning.  "left" must be auto and "right" must be auto
  //    (otherwise the horizontal position is completely determined by
  //    whichever of them is not auto and the width).
  // See nsHTMLReflowState::InitAbsoluteConstraints -- these are the
  // only cases when we call CalculateHypotheticalBox().
  if ((pos->mOffset.GetTopUnit() == eStyleUnit_Auto &&
       pos->mOffset.GetBottomUnit() == eStyleUnit_Auto) ||
      (pos->mOffset.GetLeftUnit() == eStyleUnit_Auto &&
       pos->mOffset.GetRightUnit() == eStyleUnit_Auto)) {
    return PR_TRUE;
  }
  if (!aCBWidthChanged && !aCBHeightChanged) {
    // skip getting style data
    return PR_FALSE;
  }
  const nsStylePadding* padding = f->GetStylePadding();
  const nsStyleMargin* margin = f->GetStyleMargin();
  if (aCBWidthChanged) {
    // See if f's width might have changed.
    // If border-left, border-right, padding-left, padding-right,
    // width, min-width, and max-width are all lengths, 'none', or enumerated,
    // then our frame width does not depend on the parent width.
    // Note that borders never depend on the parent width
    if (pos->mWidth.GetUnit() != eStyleUnit_Coord ||
        pos->mMinWidth.GetUnit() != eStyleUnit_Coord ||
        !IsFixedMaxSize(pos->mMaxWidth.GetUnit()) ||
        !IsFixedPaddingSize(padding->mPadding.GetLeftUnit()) ||
        !IsFixedPaddingSize(padding->mPadding.GetRightUnit())) {
      return PR_TRUE;
    }

    // See if f's position might have changed. If we're RTL then the
    // rules are slightly different. We'll assume percentage or auto
    // margins will always induce a dependency on the size
    if (!IsFixedMarginSize(margin->mMargin.GetLeftUnit()) ||
        !IsFixedMarginSize(margin->mMargin.GetRightUnit())) {
      return PR_TRUE;
    }
    if (f->GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
      // Note that even if 'left' is a length, our position can
      // still depend on the containing block width, because if
      // 'right' is also a length we will discard 'left' and be
      // positioned relative to the containing block right edge.
      // 'left' length and 'right' auto is the only combination
      // we can be sure of.
      if (pos->mOffset.GetLeftUnit() != eStyleUnit_Coord ||
          pos->mOffset.GetRightUnit() != eStyleUnit_Auto) {
        return PR_TRUE;
      }
    } else {
      if (pos->mOffset.GetLeftUnit() != eStyleUnit_Coord) {
        return PR_TRUE;
      }
    }
  }
  if (aCBHeightChanged) {
    // See if f's height might have changed.
    // If border-top, border-bottom, padding-top, padding-bottom,
    // min-height, and max-height are all lengths or 'none',
    // and height is a length or height and bottom are auto and top is not auto,
    // then our frame height does not depend on the parent height.
    // Note that borders never depend on the parent height
    if (!(pos->mHeight.GetUnit() == eStyleUnit_Coord ||
          (pos->mHeight.GetUnit() == eStyleUnit_Auto &&
           pos->mOffset.GetBottomUnit() == eStyleUnit_Auto &&
           pos->mOffset.GetTopUnit() != eStyleUnit_Auto)) ||
        pos->mMinHeight.GetUnit() != eStyleUnit_Coord ||
        !IsFixedMaxSize(pos->mMaxHeight.GetUnit()) ||
        !IsFixedPaddingSize(padding->mPadding.GetTopUnit()) ||
        !IsFixedPaddingSize(padding->mPadding.GetBottomUnit())) { 
      return PR_TRUE;
    }
      
    // See if f's position might have changed.
    if (!IsFixedMarginSize(margin->mMargin.GetTopUnit()) ||
        !IsFixedMarginSize(margin->mMargin.GetBottomUnit())) {
      return PR_TRUE;
    }
    if (pos->mOffset.GetTopUnit() != eStyleUnit_Coord) {
      return PR_TRUE;
    }
  }
  return PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual nsIAtom* nsAbsoluteContainingBlock::GetChildListName ( ) const [inline, virtual]

Reimplemented in nsFixedContainingBlock.

Definition at line 66 of file nsAbsoluteContainingBlock.h.

{ return nsLayoutAtoms::absoluteList; }

Here is the caller graph for this function:

Definition at line 127 of file nsAbsoluteContainingBlock.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsAbsoluteContainingBlock::IncrementalReflow ( nsIFrame aDelegatingFrame,
nsPresContext aPresContext,
const nsHTMLReflowState aReflowState,
nscoord  aContainingBlockWidth,
nscoord  aContainingBlockHeight 
)

Definition at line 368 of file nsAbsoluteContainingBlock.cpp.

{
  // See if the reflow command is targeted at us.
  nsReflowPath *path = aReflowState.path;
  nsHTMLReflowCommand *command = path->mReflowCommand;

  if (command) {
    // It's targeted at us. See if it's for the positioned child frames
    if (GetChildListName() == command->GetChildListName()) {
      // The only type of reflow command we expect is that we have dirty
      // child frames to reflow
      NS_ASSERTION(command->Type() == eReflowType_ReflowDirty,
                   "unexpected reflow type");

      // Walk the positioned frames and reflow the dirty frames
      for (nsIFrame* f = mAbsoluteFrames.FirstChild(); f; f = f->GetNextSibling()) {
        nsFrameState  frameState = f->GetStateBits();

        if (frameState & NS_FRAME_IS_DIRTY) {
          nsReflowStatus  status;
          nsReflowReason  reason;

          reason = (frameState & NS_FRAME_FIRST_REFLOW)
            ? eReflowReason_Initial
            : eReflowReason_Dirty;

          ReflowAbsoluteFrame(aDelegatingFrame, aPresContext, aReflowState,
                              aContainingBlockWidth, aContainingBlockHeight, f,
                              reason, status);
        }
      }
    }
  }

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

  if (iter != end && mAbsoluteFrames.NotEmpty()) {
    for ( ; iter != end; ++iter) {
      // See if it's one of our absolutely positioned child frames
      if (mAbsoluteFrames.ContainsFrame(*iter)) {
        // Remove the next frame from the reflow path
        nsReflowStatus kidStatus;
        ReflowAbsoluteFrame(aDelegatingFrame, aPresContext, aReflowState,
                            aContainingBlockWidth, aContainingBlockHeight, *iter,
                            aReflowState.reason, kidStatus);

        // We don't need to invalidate anything because the frame
        // should invalidate any area within its frame that needs
        // repainting, and because it has a view if it changes size
        // the view manager will damage the dirty area

        aReflowState.path->Remove(iter);
      }
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsAbsoluteContainingBlock::InsertFrames ( nsIFrame aDelegatingFrame,
nsIAtom aListName,
nsIFrame aPrevFrame,
nsIFrame aFrameList 
)

Definition at line 94 of file nsAbsoluteContainingBlock.cpp.

{
  // Insert the new frames
#ifdef NS_DEBUG
  nsFrame::VerifyDirtyBitSet(aFrameList);
#endif
  mAbsoluteFrames.InsertFrames(nsnull, aPrevFrame, aFrameList);

  // Generate a reflow command to reflow the dirty frames
  return aDelegatingFrame->GetPresContext()->PresShell()->
          AppendReflowCommand(aDelegatingFrame, eReflowType_ReflowDirty,
                              GetChildListName());
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsAbsoluteContainingBlock::Reflow ( nsIFrame aDelegatingFrame,
nsPresContext aPresContext,
const nsHTMLReflowState aReflowState,
nscoord  aContainingBlockWidth,
nscoord  aContainingBlockHeight,
nsRect aChildBounds = nsnull,
PRBool  aForceReflow = PR_TRUE,
PRBool  aCBWidthChanged = PR_TRUE,
PRBool  aCBHeightChanged = PR_TRUE 
)

Definition at line 157 of file nsAbsoluteContainingBlock.cpp.

{
  // Initialize OUT parameter
  if (aChildBounds)
    aChildBounds->SetRect(0, 0, 0, 0);

  // Make a copy of the reflow state.  If the reason is
  // eReflowReason_Incremental (which should mean either that the target
  // is the frame for which this is the absolute container or that the
  // container changed size due to incremental reflow of its children),
  // then change it to eReflowReason_Resize.
  // XXXldb If the target is this frame, shouldn't we be setting it
  // appropriately (which might mean to StyleChanged)?
  nsHTMLReflowState reflowState(aReflowState);
  if (eReflowReason_Incremental == reflowState.reason) {
    reflowState.reason = eReflowReason_Resize;
  }

  nsIFrame* kidFrame;
  for (kidFrame = mAbsoluteFrames.FirstChild(); kidFrame; kidFrame = kidFrame->GetNextSibling()) {
    if (!aForceReflow &&
        !FrameDependsOnContainer(kidFrame, aCBWidthChanged, aCBHeightChanged)) {
      // Skip this frame, but add it in to the child bounds as needed
      AddFrameToChildBounds(kidFrame, aChildBounds);
      continue;
    }
    nsReflowReason  reason = reflowState.reason;

    nsFrameState kidState = kidFrame->GetStateBits();
    if (NS_FRAME_FIRST_REFLOW & kidState) {
      // The frame has never had a reflow, so change the reason to eReflowReason_Initial
      reason = eReflowReason_Initial;

    } else if (NS_FRAME_IS_DIRTY & kidState) {
      // The frame is dirty so give it the correct reflow reason
      reason = eReflowReason_Dirty;
    }

    // Reflow the frame
    nsReflowStatus  kidStatus;
    ReflowAbsoluteFrame(aDelegatingFrame, aPresContext, reflowState, aContainingBlockWidth,
                        aContainingBlockHeight, kidFrame, reason, kidStatus);

    AddFrameToChildBounds(kidFrame, aChildBounds);
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsAbsoluteContainingBlock::ReflowAbsoluteFrame ( nsIFrame aDelegatingFrame,
nsPresContext aPresContext,
const nsHTMLReflowState aReflowState,
nscoord  aContainingBlockWidth,
nscoord  aContainingBlockHeight,
nsIFrame aKidFrame,
nsReflowReason  aReason,
nsReflowStatus aStatus 
) [protected]

Definition at line 446 of file nsAbsoluteContainingBlock.cpp.

{
#ifdef DEBUG
  if (nsBlockFrame::gNoisyReflow) {
    nsFrame::IndentBy(stdout,nsBlockFrame::gNoiseIndent);
    printf("abs pos ");
    if (nsnull != aKidFrame) {
      nsIFrameDebug*  frameDebug;
      if (NS_SUCCEEDED(CallQueryInterface(aKidFrame, &frameDebug))) {
        nsAutoString name;
        frameDebug->GetFrameName(name);
        printf("%s ", NS_LossyConvertUCS2toASCII(name).get());
      }
    }
    printf("r=%d",aReflowState.reason);

    if (aReflowState.reason == eReflowReason_Incremental) {
      nsHTMLReflowCommand *command = aReflowState.path->mReflowCommand;

      if (command) {
        // We're the target.
        printf("(%d)", command->Type());      
      }
    }
    char width[16];
    char height[16];
    PrettyUC(aReflowState.availableWidth, width);
    PrettyUC(aReflowState.availableHeight, height);
    printf(" a=%s,%s ", width, height);
    PrettyUC(aReflowState.mComputedWidth, width);
    PrettyUC(aReflowState.mComputedHeight, height);
    printf("c=%s,%s \n", width, height);
  }
  AutoNoisyIndenter indent(nsBlockFrame::gNoisy);
#endif // DEBUG

  nsresult  rv;
  // Get the border values
  const nsMargin& border = aReflowState.mStyleBorder->GetBorder();

  nscoord availWidth = aReflowState.mComputedWidth;
  enum { NOT_SHRINK_TO_FIT, SHRINK_TO_FIT_AVAILWIDTH, SHRINK_TO_FIT_MEW };
  PRUint32 situation = NOT_SHRINK_TO_FIT;
  while (1) {
    nsHTMLReflowMetrics kidDesiredSize(nsnull);
    if (situation == NOT_SHRINK_TO_FIT &&
        !(aKidFrame->GetStateBits() & NS_FRAME_REPLACED_ELEMENT)) {
      // CSS2.1 10.3.7 width:auto and at least one of left/right is auto...
      const nsStylePosition* stylePosition = aKidFrame->GetStylePosition();
      if (eStyleUnit_Auto == stylePosition->mWidth.GetUnit() &&
          (eStyleUnit_Auto == stylePosition->mOffset.GetLeftUnit() ||
           eStyleUnit_Auto == stylePosition->mOffset.GetRightUnit())) {
        situation = SHRINK_TO_FIT_AVAILWIDTH;
        if (aContainingBlockWidth != -1) {
          availWidth = aContainingBlockWidth;
        } else {
          availWidth = aReflowState.mComputedWidth;
        }
        kidDesiredSize.mComputeMEW = PR_TRUE;
      }
    }

    nsSize            availSize(availWidth, NS_UNCONSTRAINEDSIZE);
    nsHTMLReflowState kidReflowState(aPresContext, aReflowState, aKidFrame,
                                     availSize, aContainingBlockWidth,
                                     aContainingBlockHeight,
                                     aReason);

    if (situation == SHRINK_TO_FIT_MEW) {
      situation = NOT_SHRINK_TO_FIT; // This is the last reflow
      kidReflowState.mComputedWidth = PR_MIN(availWidth, kidReflowState.mComputedMaxWidth);
      if (kidReflowState.mComputedWidth < kidReflowState.mComputedMinWidth) {
        kidReflowState.mComputedWidth = kidReflowState.mComputedMinWidth;
      }
    } else if (situation == SHRINK_TO_FIT_AVAILWIDTH) {
      NS_ASSERTION(availWidth != NS_UNCONSTRAINEDSIZE,
                   "shrink-to-fit: expected a constrained available width");
      PRInt32 maxWidth = availWidth -
        (kidReflowState.mComputedMargin.left + kidReflowState.mComputedBorderPadding.left +
         kidReflowState.mComputedBorderPadding.right + kidReflowState.mComputedMargin.right);
      if (NS_AUTOOFFSET != kidReflowState.mComputedOffsets.right) {
        maxWidth -= kidReflowState.mComputedOffsets.right;
      }
      if (NS_AUTOOFFSET != kidReflowState.mComputedOffsets.left) {
        maxWidth -= kidReflowState.mComputedOffsets.left;
      }
      // The following also takes care of maxWidth<0
      if (kidReflowState.mComputedMaxWidth > maxWidth) {
        kidReflowState.mComputedMaxWidth = PR_MAX(maxWidth, kidReflowState.mComputedMinWidth);
      }
    }

    // Send the WillReflow() notification and position the frame
    aKidFrame->WillReflow(aPresContext);

    // XXXldb We can simplify this if we come up with a better way to
    // position views.
    nscoord x;
    if (NS_AUTOOFFSET == kidReflowState.mComputedOffsets.left) {
      // Just use the current x-offset
      x = aKidFrame->GetPosition().x;
    } else {
      x = border.left + kidReflowState.mComputedOffsets.left + kidReflowState.mComputedMargin.left;
    }
    aKidFrame->SetPosition(nsPoint(x, border.top +
                                      kidReflowState.mComputedOffsets.top +
                                      kidReflowState.mComputedMargin.top));

    // Position its view, but don't bother it doing it now if we haven't
    // yet determined the left offset
    if (NS_AUTOOFFSET != kidReflowState.mComputedOffsets.left) {
      nsContainerFrame::PositionFrameView(aKidFrame);
    }

    // Do the reflow
    rv = aKidFrame->Reflow(aPresContext, kidDesiredSize, kidReflowState, aStatus);

    if (situation == SHRINK_TO_FIT_AVAILWIDTH) {
      // ...continued CSS2.1 10.3.7 width:auto and at least one of left/right is auto
      availWidth -= kidReflowState.mComputedMargin.left + kidReflowState.mComputedMargin.right;

      if (NS_AUTOOFFSET == kidReflowState.mComputedOffsets.right) {
        NS_ASSERTION(NS_AUTOOFFSET != kidReflowState.mComputedOffsets.left,
                     "Can't solve for both left and right");
        availWidth -= kidReflowState.mComputedOffsets.left;
      } else {
        NS_ASSERTION(NS_AUTOOFFSET == kidReflowState.mComputedOffsets.left,
                     "Expected to solve for left");
        availWidth -= kidReflowState.mComputedOffsets.right;
      }
      if (availWidth < 0) {
        availWidth = 0;
      }

      // Shrink-to-fit: min(max(preferred minimum width, available width), preferred width).
      // XXX this is not completely correct - see bug 201897 comment 56/58 and bug 268499.
      if (kidDesiredSize.mMaxElementWidth > availWidth) {
        aKidFrame->DidReflow(aPresContext, &kidReflowState, NS_FRAME_REFLOW_FINISHED);
        availWidth = PR_MAX(0, kidDesiredSize.mMaxElementWidth -
                               kidReflowState.mComputedBorderPadding.left -
                               kidReflowState.mComputedBorderPadding.right);
        situation = SHRINK_TO_FIT_MEW;
        aReason = eReflowReason_Resize;
        continue; // Do a second reflow constrained to MEW.
      }
    }

    // If we're solving for 'left' or 'top', then compute it now that we know the
    // width/height
    if ((NS_AUTOOFFSET == kidReflowState.mComputedOffsets.left) ||
        (NS_AUTOOFFSET == kidReflowState.mComputedOffsets.top)) {
      if (-1 == aContainingBlockWidth) {
        // Get the containing block width/height
        kidReflowState.ComputeContainingBlockRectangle(aPresContext,
                                                       &aReflowState,
                                                       aContainingBlockWidth,
                                                       aContainingBlockHeight);
      }

      if (NS_AUTOOFFSET == kidReflowState.mComputedOffsets.left) {
        NS_ASSERTION(NS_AUTOOFFSET != kidReflowState.mComputedOffsets.right,
                     "Can't solve for both left and right");
        kidReflowState.mComputedOffsets.left = aContainingBlockWidth -
                                               kidReflowState.mComputedOffsets.right -
                                               kidReflowState.mComputedMargin.right -
                                               kidDesiredSize.width -
                                               kidReflowState.mComputedMargin.left;
      }
      if (NS_AUTOOFFSET == kidReflowState.mComputedOffsets.top) {
        kidReflowState.mComputedOffsets.top = aContainingBlockHeight -
                                              kidReflowState.mComputedOffsets.bottom -
                                              kidReflowState.mComputedMargin.bottom -
                                              kidDesiredSize.height -
                                              kidReflowState.mComputedMargin.top;
      }
    }

    // Position the child relative to our padding edge
    nsRect  rect(border.left + kidReflowState.mComputedOffsets.left + kidReflowState.mComputedMargin.left,
                 border.top + kidReflowState.mComputedOffsets.top + kidReflowState.mComputedMargin.top,
                 kidDesiredSize.width, kidDesiredSize.height);
    aKidFrame->SetRect(rect);

    // Size and position the view and set its opacity, visibility, content
    // transparency, and clip
    nsContainerFrame::SyncFrameViewAfterReflow(aPresContext, aKidFrame,
                                               aKidFrame->GetView(),
                                               &kidDesiredSize.mOverflowArea);
    aKidFrame->DidReflow(aPresContext, &kidReflowState, NS_FRAME_REFLOW_FINISHED);

    // If the frame has visible overflow, then store it as a property on the
    // frame. This allows us to be able to recover it without having to reflow
    // the frame
    if (aKidFrame->GetStateBits() & NS_FRAME_OUTSIDE_CHILDREN) {
      // Get the property (creating a rect struct if necessary)
      nsRect* overflowArea = aKidFrame->GetOverflowAreaProperty(PR_TRUE);

      NS_ASSERTION(overflowArea, "should have created rect");
      if (overflowArea) {
        *overflowArea = kidDesiredSize.mOverflowArea;
      }
    }
#ifdef DEBUG
    if (nsBlockFrame::gNoisyReflow) {
      nsFrame::IndentBy(stdout,nsBlockFrame::gNoiseIndent - 1);
      printf("abs pos ");
      if (nsnull != aKidFrame) {
        nsIFrameDebug*  frameDebug;
        if (NS_SUCCEEDED(CallQueryInterface(aKidFrame, &frameDebug))) {
          nsAutoString name;
          frameDebug->GetFrameName(name);
          printf("%s ", NS_LossyConvertUCS2toASCII(name).get());
        }
      }
      printf("%p rect=%d,%d,%d,%d", aKidFrame, rect.x, rect.y, rect.width, rect.height);
      printf("\n");
    }
#endif

    break;
  }
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 226 of file nsAbsoluteContainingBlock.cpp.

{
  // See if the reflow command is targeted at us.
  nsReflowPath *path = aReflowState.path;
  nsHTMLReflowCommand *command = path->mReflowCommand;

  if (command) {
    // It's targeted at us. See if it's for the positioned child frames
    if (GetChildListName() != command->GetChildListName()) {
      // A reflow command is targeted directly at this block.
      // The block will have to do a proper reflow.
      return PR_FALSE;
    }
  }

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

  if (iter != end && mAbsoluteFrames.NotEmpty()) {
    for ( ; iter != end; ++iter) {
      // See if it's one of our absolutely positioned child frames
      if (!mAbsoluteFrames.ContainsFrame(*iter)) {
        // At least one of the frames along the reflow path wasn't
        // absolutely positioned, so we'll need to deal with it in
        // normal block reflow.
        return PR_FALSE;
      }
    }
  }

  return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsAbsoluteContainingBlock::RemoveFrame ( nsIFrame aDelegatingFrame,
nsIAtom aListName,
nsIFrame aOldFrame 
)

Definition at line 112 of file nsAbsoluteContainingBlock.cpp.

{
  PRBool result = mAbsoluteFrames.DestroyFrame(aDelegatingFrame->
                                               GetPresContext(), aOldFrame);
  NS_ASSERTION(result, "didn't find frame to delete");
  // Because positioned frames aren't part of a flow, there's no additional
  // work to do, e.g. reflowing sibling frames. And because positioned frames
  // have a view, we don't need to repaint
  return result ? NS_OK : NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsAbsoluteContainingBlock::ReplaceFrame ( nsIFrame aDelegatingFrame,
nsIAtom aListName,
nsIFrame aOldFrame,
nsIFrame aNewFrame 
)

Definition at line 126 of file nsAbsoluteContainingBlock.cpp.

{
  PRBool result = mAbsoluteFrames.ReplaceFrame(aDelegatingFrame,
                                               aOldFrame, aNewFrame, PR_TRUE);
  NS_ASSERTION(result, "Problems replacing a frame");
  return result ? NS_OK : NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsAbsoluteContainingBlock::SetInitialChildList ( nsIFrame aDelegatingFrame,
nsPresContext aPresContext,
nsIAtom aListName,
nsIFrame aChildList 
)

Definition at line 63 of file nsAbsoluteContainingBlock.cpp.

{
  NS_PRECONDITION(GetChildListName() == aListName, "unexpected child list name");
#ifdef NS_DEBUG
  nsFrame::VerifyDirtyBitSet(aChildList);
#endif
  mAbsoluteFrames.SetFrames(aChildList);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 148 of file nsAbsoluteContainingBlock.h.


The documentation for this class was generated from the following files: