Back to index

lightning-sunbird  0.9+nobinonly
Functions
nsLayoutUtils.cpp File Reference
#include "nsLayoutUtils.h"
#include "nsIFrame.h"
#include "nsPresContext.h"
#include "nsIContent.h"
#include "nsFrameList.h"
#include "nsLayoutAtoms.h"
#include "nsIAtom.h"
#include "nsCSSPseudoElements.h"
#include "nsIView.h"
#include "nsIScrollableView.h"
#include "nsPlaceholderFrame.h"
#include "nsIScrollableFrame.h"
#include "nsCSSFrameConstructor.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIDOMEvent.h"
#include "nsGUIEvent.h"

Go to the source code of this file.

Functions

static nsIFrameGetFirstChildFrame (nsIFrame *aFrame, nsIContent *aContent)
 A namespace class for static layout utilities.
static nsIFrameGetLastChildFrame (nsIFrame *aFrame, nsIContent *aContent)
 GetLastChildFrame returns the last "real" child frame of a given frame.

Function Documentation

static nsIFrame* GetFirstChildFrame ( nsIFrame aFrame,
nsIContent aContent 
) [static]

A namespace class for static layout utilities.

GetFirstChildFrame returns the first "real" child frame of a given frame. It will descend down into pseudo-frames (unless the pseudo-frame is the :before generated frame).

Parameters:
aFramethe frame
aFramethe frame's content node

Definition at line 67 of file nsLayoutUtils.cpp.

{
  NS_PRECONDITION(aFrame, "NULL frame pointer");

  // Get the first child frame
  nsIFrame* childFrame = aFrame->GetFirstChild(nsnull);

  // If the child frame is a pseudo-frame, then return its first child.
  // Note that the frame we create for the generated content is also a
  // pseudo-frame and so don't drill down in that case
  if (childFrame &&
      childFrame->IsPseudoFrame(aContent) &&
      !childFrame->IsGeneratedContentFrame()) {
    return GetFirstChildFrame(childFrame, aContent);
  }

  return childFrame;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static nsIFrame* GetLastChildFrame ( nsIFrame aFrame,
nsIContent aContent 
) [static]

GetLastChildFrame returns the last "real" child frame of a given frame.

It will descend down into pseudo-frames (unless the pseudo-frame is the :after generated frame).

Parameters:
aFramethe frame
aFramethe frame's content node

Definition at line 95 of file nsLayoutUtils.cpp.

{
  NS_PRECONDITION(aFrame, "NULL frame pointer");

  // Get the last in flow frame
  nsIFrame* lastInFlow = aFrame->GetLastInFlow();

  // Get the last child frame
  nsIFrame* firstChildFrame = lastInFlow->GetFirstChild(nsnull);
  if (firstChildFrame) {
    nsFrameList frameList(firstChildFrame);
    nsIFrame*   lastChildFrame = frameList.LastChild();

    NS_ASSERTION(lastChildFrame, "unexpected error");

    // Get the frame's first-in-flow. This matters in case the frame has
    // been continuted across multiple lines
    lastChildFrame = lastChildFrame->GetFirstInFlow();
    
    // If the last child frame is a pseudo-frame, then return its last child.
    // Note that the frame we create for the generated content is also a
    // pseudo-frame and so don't drill down in that case
    if (lastChildFrame &&
        lastChildFrame->IsPseudoFrame(aContent) &&
        !lastChildFrame->IsGeneratedContentFrame()) {
      return GetLastChildFrame(lastChildFrame, aContent);
    }

    return lastChildFrame;
  }

  return nsnull;
}

Here is the call graph for this function:

Here is the caller graph for this function: