author Birunthan Mohanathas <>
Mon, 12 May 2014 22:29:04 +0300
changeset 201961 85228ee8ce8b1ed628e49baf88104469fb0ea7e6
parent 190967 content/svg/content/src/nsSVGPathGeometryElement.h@128a9757865e741d92d9a5e6143e207b0a560b41
permissions -rw-r--r--
Bug 946065 - Part 8: Move content/svg/ to dom/ and flatten subdirectories. r=jwatt

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at */


#include "mozilla/gfx/2D.h"
#include "SVGGraphicsElement.h"

struct gfxMatrix;

struct nsSVGMark {
  enum Type {


  float x, y, angle;
  Type type;
  nsSVGMark(float aX, float aY, float aAngle, Type aType) :
    x(aX), y(aY), angle(aAngle), type(aType) {}

class gfxContext;

typedef mozilla::dom::SVGGraphicsElement nsSVGPathGeometryElementBase;

class nsSVGPathGeometryElement : public nsSVGPathGeometryElementBase
  typedef mozilla::gfx::FillRule FillRule;
  typedef mozilla::gfx::Float Float;
  typedef mozilla::gfx::Path Path;
  typedef mozilla::gfx::PathBuilder PathBuilder;

  nsSVGPathGeometryElement(already_AddRefed<nsINodeInfo>& aNodeInfo);

  virtual bool AttributeDefinesGeometry(const nsIAtom *aName);

   * Returns true if this element's geometry depends on the width or height of its
   * coordinate context (typically the viewport established by its nearest <svg>
   * ancestor). In other words, returns true if one of the attributes for which
   * AttributeDefinesGeometry returns true has a percentage value.
   * This could be moved up to a more general class so it can be used for non-leaf
   * elements, but that would require care and for now there's no need.
  bool GeometryDependsOnCoordCtx();

  virtual bool IsMarkable();
  virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks);
  virtual void ConstructPath(gfxContext *aCtx) = 0;

   * Returns a Path that can be used to paint, hit-test or calculate bounds for
   * this element. May return nullptr if there is no [valid] path.
  virtual mozilla::TemporaryRef<Path> BuildPath() = 0;

  virtual mozilla::TemporaryRef<Path> GetPathForLengthOrPositionMeasuring();

   * Returns a PathBuilder object created using the current computed value of
   * the CSS property 'fill-rule' for this element.
  mozilla::TemporaryRef<PathBuilder> CreatePathBuilder();

   * Returns the current computed value of the CSS property 'fill-rule' for
   * this element.
  FillRule GetFillRule();

   * Returns the current computed value of the CSS property 'stroke-width' for
   * this element. (I.e. this does NOT take account of the value of the
   * 'stroke' and 'stroke-opacity' properties to, say, return zero if they are
   * "none" or "0", respectively.)
  Float GetStrokeWidth();