wiki:SVG properties

Version 7 (modified by Said Abou-Hallawa, 2 years ago) (diff)

--

SVG Properties

What is an SVG property?

It is a data type which can be primitive DOM type or SVG type. Example of primitive types are int, float, boolean. Examples for DOM type is DOMString. And examples for SVG types are SVGNumber, SVGNumberList, SVGLength, SVGLengthList, SVGAngle, SVGPoint, SVGPointList.

What is so special about SVG property?

  1. It has its own DOM interface which is separate from getAttribute() and setAttribute() methods.
  2. It is a reflection of a DOM attribute. Two cases need to be handled
  3. When setAttribute called for the underlaying attribute, SVGElement::parseAttribute() will be called to update th SVG property and then SVGElement::svgAttributeChanged() is called to invalidate the renderer and the dependent SVG objects.
  4. When the SVG property is changed through the DOM interface. In this handed in two steps: (1) commit and (2) synchronize. The commit step is called immediately after changing the property. It will mark value of the underlaying attribute to be invalid and it call SVGElement::svgAttributeChanged(). The synchronize. step happens later when the value of attribute is required. The valueAsString(0 of the SVG property is set as the attribute. value.
  5. Most of the properties are animated properties. The animated property has two members baseVal() and the animal(). Each of them are from the same SVG property type. animal() differs from baseVal() only when animating. Otherwise they have to be the same value.
  6. The animal() of the animated property is read only; no changes from the DOM is allowed.
  7. The SVG property can be attached to an SVGElement or it can be detached.

What things to consider for storing, modifying and animating the SVG property?

  1. It has to be RefCounted because the DOM object will encapsulate the same SVG property and this DOM object can outlive the owner element.
  2. Some properties are SVG lists of SVG types, e.g. SVGNumberList and SVGPointList. In addition of having the list itself Refcounted, all the items of this list have to be RefCounted also. The items can outlive the owner list.