Back to index

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

#include <nsSVGPathDataParser.h>

List of all members.

Public Member Functions

 nsSVGPathDataParser (nsVoidArray *data)
nsresult Parse (const char *str)

Protected Types

enum  {
  DIGIT, WSP, COMMA, POINT,
  SIGN, OTHER, END
}

Protected Member Functions

nsresult AppendSegment (nsIDOMSVGPathSeg *seg)
void getNextToken ()
void windBack (const char *pos)
nsresult match (char tok)
nsresult matchSvgPath ()
nsresult matchSubPaths ()
PRBool isTokenSubPathsStarter ()
nsresult matchSubPath ()
PRBool isTokenSubPathStarter ()
nsresult matchSubPathElements ()
PRBool isTokenSubPathElementsStarter ()
nsresult matchSubPathElement ()
PRBool isTokenSubPathElementStarter ()
nsresult matchMoveto ()
nsresult matchMovetoArgSeq (PRBool absCoords)
nsresult matchClosePath ()
nsresult matchLineto ()
nsresult matchLinetoArgSeq (PRBool absCoords)
PRBool isTokenLinetoArgSeqStarter ()
nsresult matchHorizontalLineto ()
nsresult matchHorizontalLinetoArgSeq (PRBool absCoords)
nsresult matchVerticalLineto ()
nsresult matchVerticalLinetoArgSeq (PRBool absCoords)
nsresult matchCurveto ()
nsresult matchCurvetoArgSeq (PRBool absCoords)
nsresult matchCurvetoArg (float *x, float *y, float *x1, float *y1, float *x2, float *y2)
PRBool isTokenCurvetoArgStarter ()
nsresult matchSmoothCurveto ()
nsresult matchSmoothCurvetoArgSeq (PRBool absCoords)
nsresult matchSmoothCurvetoArg (float *x, float *y, float *x2, float *y2)
PRBool isTokenSmoothCurvetoArgStarter ()
nsresult matchQuadBezierCurveto ()
nsresult matchQuadBezierCurvetoArgSeq (PRBool absCoords)
nsresult matchQuadBezierCurvetoArg (float *x, float *y, float *x1, float *y1)
PRBool isTokenQuadBezierCurvetoArgStarter ()
nsresult matchSmoothQuadBezierCurveto ()
nsresult matchSmoothQuadBezierCurvetoArgSeq (PRBool absCoords)
nsresult matchEllipticalArc ()
nsresult matchEllipticalArcArgSeq (PRBool absCoords)
nsresult matchEllipticalArcArg (float *x, float *y, float *r1, float *r2, float *angle, PRBool *largeArcFlag, PRBool *sweepFlag)
PRBool isTokenEllipticalArcArgStarter ()
nsresult matchCoordPair (float *x, float *y)
PRBool isTokenCoordPairStarter ()
nsresult matchCoord (float *x)
PRBool isTokenCoordStarter ()
nsresult matchNonNegativeNumber (float *x)
PRBool isTokenNonNegativeNumberStarter ()
nsresult matchNumber (float *x)
PRBool isTokenNumberStarter ()
nsresult matchFlag (PRBool *f)
nsresult matchCommaWsp ()
PRBool isTokenCommaWspStarter ()
nsresult matchIntegerConst ()
nsresult matchFloatingPointConst ()
nsresult matchFractConst ()
nsresult matchExponent ()
PRBool isTokenExponentStarter ()
nsresult matchDigitSeq ()
PRBool isTokenDigitSeqStarter ()
nsresult matchWsp ()
PRBool isTokenWspStarter ()

Protected Attributes

nsVoidArraymData
const char * inputpos
char tokenval
const char * tokenpos
enum nsSVGPathDataParser:: { ... }  tokentype

Detailed Description

Definition at line 51 of file nsSVGPathDataParser.h.


Member Enumeration Documentation

anonymous enum [protected]
Enumerator:
DIGIT 
WSP 
COMMA 
POINT 
SIGN 
OTHER 
END 

Definition at line 64 of file nsSVGPathDataParser.h.


Constructor & Destructor Documentation

Definition at line 51 of file nsSVGPathDataParser.cpp.

    : mData(data)
{
}

Member Function Documentation

Definition at line 70 of file nsSVGPathDataParser.cpp.

{
  NS_ADDREF(seg);
  mData->AppendElement((void*)seg);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 78 of file nsSVGPathDataParser.cpp.

{
  tokenpos  = inputpos;
  tokenval  = *inputpos;
  
  switch (tokenval) {
    case '0': case '1': case '2': case '3': case '4':
    case '5': case '6': case '7': case '8': case '9':
      tokentype = DIGIT;
      break;
    case '\x20': case '\x9': case '\xd': case '\xa':
      tokentype = WSP;
      break;
    case ',':
      tokentype = COMMA;
      break;
    case '+': case '-':
      tokentype = SIGN;
      break;
    case '.':
      tokentype = POINT;
      break;
    case '\0':
      tokentype = END;
      break;
    default:
      tokentype = OTHER;
  }
  
  if (*inputpos != '\0') {
    ++inputpos;
  }
}

Here is the caller graph for this function:

Definition at line 1142 of file nsSVGPathDataParser.cpp.

{
  return (isTokenWspStarter() || tokentype == COMMA);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1024 of file nsSVGPathDataParser.cpp.

{
  return isTokenCoordStarter();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1038 of file nsSVGPathDataParser.cpp.

{
  return isTokenNumberStarter();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 659 of file nsSVGPathDataParser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1232 of file nsSVGPathDataParser.cpp.

{
  return (tokentype == DIGIT);
}

Here is the caller graph for this function:

Definition at line 1004 of file nsSVGPathDataParser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1214 of file nsSVGPathDataParser.cpp.

{
  return (tolower(tokenval) == 'e');
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 437 of file nsSVGPathDataParser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1066 of file nsSVGPathDataParser.cpp.

{
  return (tokentype == DIGIT || tokentype == POINT);
}

Here is the caller graph for this function:

Definition at line 1096 of file nsSVGPathDataParser.cpp.

{
  return (tokentype == DIGIT || tokentype == POINT || tokentype == SIGN);
}

Here is the caller graph for this function:

Definition at line 825 of file nsSVGPathDataParser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 742 of file nsSVGPathDataParser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 221 of file nsSVGPathDataParser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 265 of file nsSVGPathDataParser.cpp.

{
  switch (tolower(tokenval)) {
    case 'z': case 'l': case 'h': case 'v': case 'c':
    case 's': case 'q': case 't': case 'a':
      return PR_TRUE;
      break;
    default:
      return PR_FALSE;
      break;
  }
  return PR_FALSE;
}  

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 169 of file nsSVGPathDataParser.cpp.

{
  return isTokenSubPathStarter();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 190 of file nsSVGPathDataParser.cpp.

{
  return (tolower(tokenval) == 'm');
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1250 of file nsSVGPathDataParser.cpp.

{
  return (tokentype == WSP);
}  

Here is the caller graph for this function:

nsresult nsSVGPathDataParser::match ( char  tok) [protected]

Definition at line 118 of file nsSVGPathDataParser.cpp.

{
  if (tokenval != tok) return NS_ERROR_FAILURE;
  getNextToken();
  return NS_OK;
}

Here is the call graph for this function:

Definition at line 351 of file nsSVGPathDataParser.cpp.

{
  switch (tokenval) {
    case 'Z':
    case 'z':
      getNextToken();
      break;
    default:
      return NS_ERROR_FAILURE;
  }

  nsresult rv;
  nsCOMPtr<nsIDOMSVGPathSegClosePath> seg;
  rv = NS_NewSVGPathSegClosePath(getter_AddRefs(seg));
  if (NS_FAILED(rv)) return rv;
  rv = AppendSegment(seg);
  if (NS_FAILED(rv)) return rv;
  
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1121 of file nsSVGPathDataParser.cpp.

{
  switch (tokentype) {
    case WSP:
      ENSURE_MATCHED(matchWsp());
      if (tokentype == COMMA)
        getNextToken();
      break;
    case COMMA:
      getNextToken();
      break;
    default:
      return NS_ERROR_FAILURE;
  }

  while (isTokenWspStarter()) {
    ENSURE_MATCHED(matchWsp());
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsSVGPathDataParser::matchCoord ( float *  x) [protected]

Definition at line 1031 of file nsSVGPathDataParser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsSVGPathDataParser::matchCoordPair ( float *  x,
float *  y 
) [protected]

Definition at line 1011 of file nsSVGPathDataParser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 574 of file nsSVGPathDataParser.cpp.

{
  PRBool absCoords;
  
  switch (tokenval) {
    case 'C':
      absCoords = PR_TRUE;
      break;
    case 'c':
      absCoords = PR_FALSE;
      break;
    default:
      return NS_ERROR_FAILURE;
  }

  getNextToken();

  while (isTokenWspStarter()) {
    ENSURE_MATCHED(matchWsp());
  }

  ENSURE_MATCHED(matchCurvetoArgSeq(absCoords));
  
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsSVGPathDataParser::matchCurvetoArg ( float *  x,
float *  y,
float *  x1,
float *  y1,
float *  x2,
float *  y2 
) [protected]

Definition at line 639 of file nsSVGPathDataParser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 601 of file nsSVGPathDataParser.cpp.

{
  while(1) {
    float x, y, x1, y1, x2, y2;
    ENSURE_MATCHED(matchCurvetoArg(&x, &y, &x1, &y1, &x2, &y2));
    
    nsresult rv;
    nsCOMPtr<nsIDOMSVGPathSeg> seg;
    if (absCoords) {
      nsCOMPtr<nsIDOMSVGPathSegCurvetoCubicAbs> segAbs;
      rv = NS_NewSVGPathSegCurvetoCubicAbs(getter_AddRefs(segAbs), x, y, x1, y1, x2, y2);
      seg = segAbs;
    }
    else {
      nsCOMPtr<nsIDOMSVGPathSegCurvetoCubicRel> segRel;
      rv = NS_NewSVGPathSegCurvetoCubicRel(getter_AddRefs(segRel), x, y, x1, y1, x2, y2);
      seg = segRel;
    }
    if (NS_FAILED(rv)) return rv;
    rv = AppendSegment(seg);
    if (NS_FAILED(rv)) return rv;
    
    const char* pos = tokenpos;

    if (isTokenCommaWspStarter()) {
      ENSURE_MATCHED(matchCommaWsp());
    }

    if (!isTokenCurvetoArgStarter()) {
      if (pos != tokenpos) windBack(pos);
      return NS_OK;
    }
  }
  
  return NS_OK;      
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1221 of file nsSVGPathDataParser.cpp.

{
  if (!(tokentype == DIGIT)) return NS_ERROR_FAILURE;

  do {
    getNextToken();
  } while (tokentype == DIGIT);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 897 of file nsSVGPathDataParser.cpp.

{
  PRBool absCoords;
  
  switch (tokenval) {
    case 'A':
      absCoords = PR_TRUE;
      break;
    case 'a':
      absCoords = PR_FALSE;
      break;
    default:
      return NS_ERROR_FAILURE;
  }

  getNextToken();

  while (isTokenWspStarter()) {
    ENSURE_MATCHED(matchWsp());
  }

  ENSURE_MATCHED(matchEllipticalArcArgSeq(absCoords));
  
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsSVGPathDataParser::matchEllipticalArcArg ( float *  x,
float *  y,
float *  r1,
float *  r2,
float *  angle,
PRBool largeArcFlag,
PRBool sweepFlag 
) [protected]

Definition at line 923 of file nsSVGPathDataParser.cpp.

{
  while(1) {
    float x, y, r1, r2, angle;
    PRBool largeArcFlag, sweepFlag;
    
    ENSURE_MATCHED(matchEllipticalArcArg(&x, &y, &r1, &r2, &angle, &largeArcFlag, &sweepFlag));
    
    nsresult rv;
    nsCOMPtr<nsIDOMSVGPathSeg> seg;
    if (absCoords) {
      nsCOMPtr<nsIDOMSVGPathSegArcAbs> segAbs;
      rv = NS_NewSVGPathSegArcAbs(getter_AddRefs(segAbs), x, y, r1, r2, angle,
                                  largeArcFlag, sweepFlag);
      seg = segAbs;
    }
    else {
      nsCOMPtr<nsIDOMSVGPathSegArcRel> segRel;
      rv = NS_NewSVGPathSegArcRel(getter_AddRefs(segRel), x, y, r1, r2, angle,
                                  largeArcFlag, sweepFlag);
      seg = segRel;
    }
    if (NS_FAILED(rv)) return rv;
    rv = AppendSegment(seg);
    if (NS_FAILED(rv)) return rv;
    
    const char* pos = tokenpos;

    if (isTokenCommaWspStarter()) {
      ENSURE_MATCHED(matchCommaWsp());
    }

    if (!isTokenEllipticalArcArgStarter()) {
      if (pos != tokenpos) windBack(pos);
      return NS_OK;
    }
  }
  
  return NS_OK;        
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1200 of file nsSVGPathDataParser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1103 of file nsSVGPathDataParser.cpp.

{
  switch (tokenval) {
    case '0':
      *f = PR_FALSE;
      break;
    case '1':
      *f = PR_TRUE;
      break;
    default:
      return NS_ERROR_FAILURE;
  }
  getNextToken();
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1157 of file nsSVGPathDataParser.cpp.

{
  // XXX inefficient implementation. It would be nice if we could make
  // this predictive and wouldn't have to backtrack...
  
  const char* pos = tokenpos;

  nsresult rv = matchFractConst();
  if (NS_SUCCEEDED(rv)) {
    if (isTokenExponentStarter())
      ENSURE_MATCHED(matchExponent());
  }
  else {
    windBack(pos);
    ENSURE_MATCHED(matchDigitSeq());
    ENSURE_MATCHED(matchExponent());    
  }

  return NS_OK;  
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1180 of file nsSVGPathDataParser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 444 of file nsSVGPathDataParser.cpp.

{
  PRBool absCoords;
  
  switch (tokenval) {
    case 'H':
      absCoords = PR_TRUE;
      break;
    case 'h':
      absCoords = PR_FALSE;
      break;
    default:
      return NS_ERROR_FAILURE;
  }

  getNextToken();

  while (isTokenWspStarter()) {
    ENSURE_MATCHED(matchWsp());
  }

  ENSURE_MATCHED(matchHorizontalLinetoArgSeq(absCoords));
  
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 470 of file nsSVGPathDataParser.cpp.

{
  while(1) {
    float x;
    ENSURE_MATCHED(matchCoord(&x));
    
    nsresult rv;
    nsCOMPtr<nsIDOMSVGPathSeg> seg;
    if (absCoords) {
      nsCOMPtr<nsIDOMSVGPathSegLinetoHorizontalAbs> segAbs;
      rv = NS_NewSVGPathSegLinetoHorizontalAbs(getter_AddRefs(segAbs), x);
      seg = segAbs;
    }
    else {
      nsCOMPtr<nsIDOMSVGPathSegLinetoHorizontalRel> segRel;
      rv = NS_NewSVGPathSegLinetoHorizontalRel(getter_AddRefs(segRel), x);
      seg = segRel;
    }
    if (NS_FAILED(rv)) return rv;
    rv = AppendSegment(seg);
    if (NS_FAILED(rv)) return rv;
    
    const char* pos = tokenpos;

    if (isTokenCommaWspStarter()) {
      ENSURE_MATCHED(matchCommaWsp());
    }

    if (!isTokenCoordStarter()) {
      if (pos != tokenpos) windBack(pos);
      return NS_OK;
    }
  }
  
  return NS_OK;    
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1149 of file nsSVGPathDataParser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 374 of file nsSVGPathDataParser.cpp.

{
  PRBool absCoords;
  
  switch (tokenval) {
    case 'L':
      absCoords = PR_TRUE;
      break;
    case 'l':
      absCoords = PR_FALSE;
      break;
    default:
      return NS_ERROR_FAILURE;
  }

  getNextToken();

  while (isTokenWspStarter()) {
    ENSURE_MATCHED(matchWsp());
  }

  ENSURE_MATCHED(matchLinetoArgSeq(absCoords));
  
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 400 of file nsSVGPathDataParser.cpp.

{
  while(1) {
    float x, y;
    ENSURE_MATCHED(matchCoordPair(&x, &y));
    
    nsresult rv;
    nsCOMPtr<nsIDOMSVGPathSeg> seg;
    if (absCoords) {
      nsCOMPtr<nsIDOMSVGPathSegLinetoAbs> segAbs;
      rv = NS_NewSVGPathSegLinetoAbs(getter_AddRefs(segAbs), x, y);
      seg = segAbs;
    }
    else {
      nsCOMPtr<nsIDOMSVGPathSegLinetoRel> segRel;
      rv = NS_NewSVGPathSegLinetoRel(getter_AddRefs(segRel), x, y);
      seg = segRel;
    }
    if (NS_FAILED(rv)) return rv;
    rv = AppendSegment(seg);
    if (NS_FAILED(rv)) return rv;
    
    const char* pos = tokenpos;

    if (isTokenCommaWspStarter()) {
      ENSURE_MATCHED(matchCommaWsp());
    }

    if (!isTokenCoordPairStarter()) {
      if (pos != tokenpos) windBack(pos);
      return NS_OK;
    }
  }
  
  return NS_OK;  
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 281 of file nsSVGPathDataParser.cpp.

{
  PRBool absCoords;
  
  switch (tokenval) {
    case 'M':
      absCoords = PR_TRUE;
      break;
    case 'm':
      absCoords = PR_FALSE;
      break;
    default:
      return NS_ERROR_FAILURE;
  }

  getNextToken();

  while (isTokenWspStarter()) {
    ENSURE_MATCHED(matchWsp());
  }

  ENSURE_MATCHED(matchMovetoArgSeq(absCoords));
  
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 311 of file nsSVGPathDataParser.cpp.

{
  
  float x, y;
  ENSURE_MATCHED(matchCoordPair(&x, &y));

  nsresult rv;
  nsCOMPtr<nsIDOMSVGPathSeg> seg;
  if (absCoords) {
    nsCOMPtr<nsIDOMSVGPathSegMovetoAbs> segAbs;
    rv = NS_NewSVGPathSegMovetoAbs(getter_AddRefs(segAbs), x, y);
    seg = segAbs;
  }
  else {
    nsCOMPtr<nsIDOMSVGPathSegMovetoRel> segRel;
    rv = NS_NewSVGPathSegMovetoRel(getter_AddRefs(segRel), x, y);
    seg = segRel;
  }
  if (NS_FAILED(rv)) return rv;
  rv = AppendSegment(seg);
  if (NS_FAILED(rv)) return rv;
    
  const char* pos = tokenpos;

  if (isTokenCommaWspStarter()) {
    ENSURE_MATCHED(matchCommaWsp());
  }

  if (isTokenLinetoArgSeqStarter()) {
    ENSURE_MATCHED(matchLinetoArgSeq(absCoords));
  }
  else {
    if (pos != tokenpos) windBack(pos);
  }
  
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1045 of file nsSVGPathDataParser.cpp.

{
  // XXX inefficient implementation. We probably hit the windback case
  // often.
  
  const char* pos = tokenpos;

  nsresult rv = matchFloatingPointConst();

  if (NS_FAILED(rv)) {
    windBack(pos);
    ENSURE_MATCHED(matchIntegerConst());
  }

  char* end;
  *x = (float) PR_strtod(pos, &end);
  NS_ASSERTION(end == tokenpos, "number parse error");
               
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsSVGPathDataParser::matchNumber ( float *  x) [protected]

Definition at line 1073 of file nsSVGPathDataParser.cpp.

{
  const char* pos = tokenpos;
  
  if (tokentype == SIGN)
    getNextToken();

  const char* pos2 = tokenpos;

  nsresult rv = matchFloatingPointConst();

  if (NS_FAILED(rv)) {
    windBack(pos);
    ENSURE_MATCHED(matchIntegerConst());
  }

  char* end;
  *x = (float) PR_strtod(pos, &end);
  NS_ASSERTION(end == tokenpos, "number parse error");
               
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 749 of file nsSVGPathDataParser.cpp.

{
  PRBool absCoords;
  
  switch (tokenval) {
    case 'Q':
      absCoords = PR_TRUE;
      break;
    case 'q':
      absCoords = PR_FALSE;
      break;
    default:
      return NS_ERROR_FAILURE;
  }

  getNextToken();

  while (isTokenWspStarter()) {
    ENSURE_MATCHED(matchWsp());
  }

  ENSURE_MATCHED(matchQuadBezierCurvetoArgSeq(absCoords));
  
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsSVGPathDataParser::matchQuadBezierCurvetoArg ( float *  x,
float *  y,
float *  x1,
float *  y1 
) [protected]

Definition at line 812 of file nsSVGPathDataParser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 775 of file nsSVGPathDataParser.cpp.

{
  while(1) {
    float x, y, x1, y1;
    ENSURE_MATCHED(matchQuadBezierCurvetoArg(&x, &y, &x1, &y1));
    
    nsresult rv;
    nsCOMPtr<nsIDOMSVGPathSeg> seg;
    if (absCoords) {
      nsCOMPtr<nsIDOMSVGPathSegCurvetoQuadraticAbs> segAbs;
      rv = NS_NewSVGPathSegCurvetoQuadraticAbs(getter_AddRefs(segAbs), x, y, x1, y1);
      seg = segAbs;
    }
    else {
      nsCOMPtr<nsIDOMSVGPathSegCurvetoQuadraticRel> segRel;
      rv = NS_NewSVGPathSegCurvetoQuadraticRel(getter_AddRefs(segRel), x, y, x1, y1);
      seg = segRel;
    }
    if (NS_FAILED(rv)) return rv;
    rv = AppendSegment(seg);
    if (NS_FAILED(rv)) return rv;
    
    const char* pos = tokenpos;

    if (isTokenCommaWspStarter()) {
      ENSURE_MATCHED(matchCommaWsp());
    }

    if (!isTokenQuadBezierCurvetoArgStarter()) {
      if (pos != tokenpos) windBack(pos);
      return NS_OK;
    }
  }
  
  return NS_OK;        
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 666 of file nsSVGPathDataParser.cpp.

{
  PRBool absCoords;
  
  switch (tokenval) {
    case 'S':
      absCoords = PR_TRUE;
      break;
    case 's':
      absCoords = PR_FALSE;
      break;
    default:
      return NS_ERROR_FAILURE;
  }

  getNextToken();

  while (isTokenWspStarter()) {
    ENSURE_MATCHED(matchWsp());
  }

  ENSURE_MATCHED(matchSmoothCurvetoArgSeq(absCoords));
  
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsSVGPathDataParser::matchSmoothCurvetoArg ( float *  x,
float *  y,
float *  x2,
float *  y2 
) [protected]

Definition at line 729 of file nsSVGPathDataParser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 692 of file nsSVGPathDataParser.cpp.

{
  while(1) {
    float x, y, x2, y2;
    ENSURE_MATCHED(matchSmoothCurvetoArg(&x, &y, &x2, &y2));
    
    nsresult rv;
    nsCOMPtr<nsIDOMSVGPathSeg> seg;
    if (absCoords) {
      nsCOMPtr<nsIDOMSVGPathSegCurvetoCubicSmoothAbs> segAbs;
      rv = NS_NewSVGPathSegCurvetoCubicSmoothAbs(getter_AddRefs(segAbs), x, y, x2, y2);
      seg = segAbs;
    }
    else {
      nsCOMPtr<nsIDOMSVGPathSegCurvetoCubicSmoothRel> segRel;
      rv = NS_NewSVGPathSegCurvetoCubicSmoothRel(getter_AddRefs(segRel), x, y, x2, y2);
      seg = segRel;
    }
    if (NS_FAILED(rv)) return rv;
    rv = AppendSegment(seg);
    if (NS_FAILED(rv)) return rv;
    
    const char* pos = tokenpos;

    if (isTokenCommaWspStarter()) {
      ENSURE_MATCHED(matchCommaWsp());
    }

    if (!isTokenSmoothCurvetoArgStarter()) {
      if (pos != tokenpos) windBack(pos);
      return NS_OK;
    }
  }
  
  return NS_OK;        
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 832 of file nsSVGPathDataParser.cpp.

{
  PRBool absCoords;
  
  switch (tokenval) {
    case 'T':
      absCoords = PR_TRUE;
      break;
    case 't':
      absCoords = PR_FALSE;
      break;
    default:
      return NS_ERROR_FAILURE;
  }

  getNextToken();

  while (isTokenWspStarter()) {
    ENSURE_MATCHED(matchWsp());
  }

  ENSURE_MATCHED(matchSmoothQuadBezierCurvetoArgSeq(absCoords));
  
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 858 of file nsSVGPathDataParser.cpp.

{
  while(1) {
    float x, y;
    ENSURE_MATCHED(matchCoordPair(&x, &y));
    
    nsresult rv;
    nsCOMPtr<nsIDOMSVGPathSeg> seg;
    if (absCoords) {
      nsCOMPtr<nsIDOMSVGPathSegCurvetoQuadraticSmoothAbs> segAbs;
      rv = NS_NewSVGPathSegCurvetoQuadraticSmoothAbs(getter_AddRefs(segAbs), x, y);
      seg = segAbs;
    }
    else {
      nsCOMPtr<nsIDOMSVGPathSegCurvetoQuadraticSmoothRel> segRel;
      rv = NS_NewSVGPathSegCurvetoQuadraticSmoothRel(getter_AddRefs(segRel), x, y);
      seg = segRel;
    }
    if (NS_FAILED(rv)) return rv;
    rv = AppendSegment(seg);
    if (NS_FAILED(rv)) return rv;
    
    const char* pos = tokenpos;

    if (isTokenCommaWspStarter()) {
      ENSURE_MATCHED(matchCommaWsp());
    }

    if (!isTokenCoordPairStarter()) {
      if (pos != tokenpos) windBack(pos);
      return NS_OK;
    }
  }
  
  return NS_OK;        
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 176 of file nsSVGPathDataParser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 228 of file nsSVGPathDataParser.cpp.

{
  switch (tolower(tokenval)) {
    case 'z':
      ENSURE_MATCHED(matchClosePath());
      break;
    case 'l':
      ENSURE_MATCHED(matchLineto());
      break;      
    case 'h':
      ENSURE_MATCHED(matchHorizontalLineto());
      break;
    case 'v':
      ENSURE_MATCHED(matchVerticalLineto());
      break;
    case 'c':
      ENSURE_MATCHED(matchCurveto());
      break;      
    case 's':
      ENSURE_MATCHED(matchSmoothCurveto());
      break;
    case 'q':
      ENSURE_MATCHED(matchQuadBezierCurveto());
      break;
    case 't':
      ENSURE_MATCHED(matchSmoothQuadBezierCurveto());
      break;
    case 'a':
      ENSURE_MATCHED(matchEllipticalArc());
      break;
    default:
      return NS_ERROR_FAILURE;
      break;
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 197 of file nsSVGPathDataParser.cpp.

{
  ENSURE_MATCHED(matchSubPathElement());

  while (1) {
    const char* pos = tokenpos;

    while (isTokenWspStarter()) {
      ENSURE_MATCHED(matchWsp());
    }


    if (isTokenSubPathElementStarter()) {
        ENSURE_MATCHED(matchSubPathElement());
    }
    else {
      if (pos != tokenpos) windBack(pos);
      return NS_OK;
    }
  }
  
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 146 of file nsSVGPathDataParser.cpp.

{
  ENSURE_MATCHED(matchSubPath());

  while (1) {
    const char* pos = tokenpos;

    while (isTokenWspStarter()) {
      ENSURE_MATCHED(matchWsp());
    }

    if (isTokenSubPathStarter()) {
      ENSURE_MATCHED(matchSubPath());
    }
    else {
      if (pos != tokenpos) windBack(pos);
      break;
    }
  }
  
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 127 of file nsSVGPathDataParser.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 509 of file nsSVGPathDataParser.cpp.

{
  PRBool absCoords;
  
  switch (tokenval) {
    case 'V':
      absCoords = PR_TRUE;
      break;
    case 'v':
      absCoords = PR_FALSE;
      break;
    default:
      return NS_ERROR_FAILURE;
  }

  getNextToken();

  while (isTokenWspStarter()) {
    ENSURE_MATCHED(matchWsp());
  }

  ENSURE_MATCHED(matchVerticalLinetoArgSeq(absCoords));
  
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 535 of file nsSVGPathDataParser.cpp.

{
  while(1) {
    float y;
    ENSURE_MATCHED(matchCoord(&y));
    
    nsresult rv;
    nsCOMPtr<nsIDOMSVGPathSeg> seg;
    if (absCoords) {
      nsCOMPtr<nsIDOMSVGPathSegLinetoVerticalAbs> segAbs;
      rv = NS_NewSVGPathSegLinetoVerticalAbs(getter_AddRefs(segAbs), y);
      seg = segAbs;
    }
    else {
      nsCOMPtr<nsIDOMSVGPathSegLinetoVerticalRel> segRel;
      rv = NS_NewSVGPathSegLinetoVerticalRel(getter_AddRefs(segRel), y);
      seg = segRel;
    }
    if (NS_FAILED(rv)) return rv;
    rv = AppendSegment(seg);
    if (NS_FAILED(rv)) return rv;
    
    const char* pos = tokenpos;

    if (isTokenCommaWspStarter()) {
      ENSURE_MATCHED(matchCommaWsp());
    }

    if (!isTokenCoordStarter()) {
      if (pos != tokenpos) windBack(pos);
      return NS_OK;
    }
  }
  
  return NS_OK;      
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1239 of file nsSVGPathDataParser.cpp.

{
  if (!(tokentype == WSP)) return NS_ERROR_FAILURE;

  do {
    getNextToken();
  } while (tokentype == WSP);

  return NS_OK;  
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 56 of file nsSVGPathDataParser.cpp.

{
  nsresult rv = NS_OK;
  inputpos = str;
  getNextToken();
  rv = matchSvgPath();
  if (tokentype != END)
    rv = NS_ERROR_FAILURE; // not all tokens were consumed

  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsSVGPathDataParser::windBack ( const char *  pos) [protected]

Definition at line 112 of file nsSVGPathDataParser.cpp.

{
  inputpos = pos;
  getNextToken();
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 60 of file nsSVGPathDataParser.h.

Definition at line 58 of file nsSVGPathDataParser.h.

Definition at line 63 of file nsSVGPathDataParser.h.

enum { ... } nsSVGPathDataParser::tokentype [protected]

Definition at line 62 of file nsSVGPathDataParser.h.


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