Back to index

lightning-sunbird  0.9+nobinonly
Classes | Typedefs | Functions
nsSVGTextPathFrame.cpp File Reference
#include "nsSVGTSpanFrame.h"
#include "nsIDOMSVGTextPathElement.h"
#include "nsIDOMSVGAnimatedLength.h"
#include "nsIDOMSVGAnimatedString.h"
#include "nsSVGLengthList.h"
#include "nsISVGPathFlatten.h"
#include "nsSVGLength.h"
#include "nsIDOMSVGAnimatedPathData.h"
#include "nsIDOMSVGPathSegList.h"
#include "nsIDOMSVGURIReference.h"
#include "nsIDOMDocument.h"
#include "nsIDocument.h"

Go to the source code of this file.


class  nsSVGTextPathFrame


typedef nsSVGTSpanFrame nsSVGTextPathFrameBase


nsresult NS_NewSVGTextPathFrame (nsIPresShell *aPresShell, nsIContent *aContent, nsIFrame *parentFrame, nsIFrame **aNewFrame)
nsresult GetReferencedFrame (nsIFrame **aServer, nsCAutoString &uriSpec, nsIContent *aContent, nsIPresShell *aPresShell)

Typedef Documentation

Definition at line 51 of file nsSVGTextPathFrame.cpp.

Function Documentation

nsresult GetReferencedFrame ( nsIFrame **  aServer,
nsCAutoString uriSpec,
nsIContent aContent,
nsIPresShell aPresShell 

Definition at line 225 of file nsSVGTextPathFrame.cpp.

  nsresult rv = NS_OK;
  *aServer = nsnull;

  // Get the ID from the spec (no ID = an error)
  PRInt32 pos = uriSpec.FindChar('#');
  if (pos == -1) {
    NS_ASSERTION(pos != -1, "URI Spec not a reference");
    return NS_ERROR_FAILURE;

  // Strip off the hash and get the name
  nsCAutoString aURICName;
  uriSpec.Right(aURICName, uriSpec.Length()-(pos + 1));

  // Get a unicode string
  nsAutoString  aURIName;
  CopyUTF8toUTF16(aURICName, aURIName);

  // Get the domDocument
  nsCOMPtr<nsIDOMDocument>domDoc = do_QueryInterface(aContent->GetDocument());
  NS_ASSERTION(domDoc, "Content doesn't reference a dom Document");
  if (domDoc == nsnull) {
    return NS_ERROR_FAILURE;

  // Get the element
  nsCOMPtr<nsIDOMElement> element;
  rv = domDoc->GetElementById(aURIName, getter_AddRefs(element));
  if (!NS_SUCCEEDED(rv) || element == nsnull) {
    return rv;

  // Get the Primary Frame
  nsCOMPtr<nsIContent> aGContent = do_QueryInterface(element);
  NS_ASSERTION(aPresShell, "Get referenced SVG frame -- no pres shell provided");
  if (!aPresShell)
    return NS_ERROR_FAILURE;

  rv = aPresShell->GetPrimaryFrameFor(aGContent, aServer);
  if (!(*aServer)) return NS_ERROR_FAILURE;
  return rv;

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult NS_NewSVGTextPathFrame ( nsIPresShell aPresShell,
nsIContent aContent,
nsIFrame parentFrame,
nsIFrame **  aNewFrame 

Definition at line 114 of file nsSVGTextPathFrame.cpp.

  *aNewFrame = nsnull;

  NS_ASSERTION(parentFrame, "null parent");
  nsISVGTextFrame *text_container;
  parentFrame->QueryInterface(NS_GET_IID(nsISVGTextFrame), (void**)&text_container);
  if (!text_container) {
    NS_ERROR("trying to construct an SVGTextPathFrame for an invalid container");
    return NS_ERROR_FAILURE;

  nsCOMPtr<nsIDOMSVGTextPathElement> tspan_elem = do_QueryInterface(aContent);
  if (!tspan_elem) {
    NS_ERROR("Trying to construct an SVGTextPathFrame for a "
             "content element that doesn't support the right interfaces");
    return NS_ERROR_FAILURE;

  nsSVGTextPathFrame* it = new (aPresShell) nsSVGTextPathFrame;
  if (nsnull == it)

  *aNewFrame = it;

  return NS_OK;

Here is the call graph for this function: