Proposals/IDL interface reorganization

From SVG
Jump to: navigation, search

Removal of interface multiple inheritance

Incorporate SVGLangSpace into SVGElement

 interface SVGElement {
   // Existing members:
   attribute DOMString xmlbase;
   readonly attribute SVGSVGElement ownerSVGElement;
   readonly attribute SVGElement viewportElement;
   // removed "id", since that is now in DOM Core
   // From SVGLangSpace:
   attribute DOMString xmllang;
   attribute DOMString xmlspace;

Use primary interfaces for "stylable", "locatable" and "transformable"

 interface SVGStylableElement : SVGElement {
   // Existing members of SVGStylable:
   readonly attribute SVGAnimatedString className;
   readonly attribute CSSStyleDeclaration style;
   CSSValue getPresentationAttribute(DOMString name);

Should all elements by stylable?

[GA] What is the difference between getPresentationAttribute(name) and style.getPropertyCSSValue(name)? I also note that getPresentationAttribute indicates this method is deprecated.

 interface SVGLocatableElement : SVGStylableElement {
   readonly attribute SVGElement nearestViewportElement;
   readonly attribute SVGElement farthestViewportElement;
   SVGRect getBBox();
   SVGMatrix getCTM(); 
   SVGMatrix getScreenCTM();
   SVGMatrix getTransformToElement(SVGElement element);
 interface SVGTransformableElement : SVGLocatableElement {
   // Existing member of SVGTransformable:
   readonly attribute SVGAnimatedTransformList transform;

In SVG 1.1, all elements that are transformable are stylable already.

In SVG 1.1, the only element that is locatable but not transformable is <svg>, but we are planning on allowing transform="" on <svg> - ISSUE-2252.

Introduce some intermediate interfaces

 // Things that render.
 interface SVGGraphicsElement : SVGTransformableElement { };
 interface SVGRectElement : SVGGraphicsElement { ... };
 interface SVGSVGElement : SVGGraphicsElement { ... };
 interface SVGForeignObjectElement : SVGGraphicsElement { ... };
 // Things that only define something graphical.
 interface SVGDefinitionElement : SVGStylableElement { };
 interface SVGFilterElement : SVGDefinitionElement { ... };
 interface SVGGradientElement : SVGDefinitionElement { ... };
 interface SVGMaskElement : SVGDefinitionElement { ... };
 interface SVGSymbolElement : SVGDefinitionElement { ... };

Having these two interfaces gives us a place to mix in other common interfaces (like SVGTests) without having to do it on each sub-interface.

Text interfaces

 interface SVGTextContentElement : SVGGraphicsElement { ... };
 interface SVGTextPositioningElement : SVGTextContentElement { ... };
 interface SVGTextElement : SVGTextPositioningElement { ... };
 interface SVGTSpanElement : SVGTextPositioningElement { ... };
 interface SVGTextPathElement : SVGTextContentElement { ... };

Note that this allows transform="" on text children, which we have planned to do.

Although I think we should merge the two interfaces, and allow positioning attributes on <textPath>.

Use [NoInterfaceObject] for other element mixin interfaces

 interface SVGExternalResourcesRequired {
   readonly attribute SVGAnimatedBoolean externalResourcesRequired;

(Can we in fact get rid of externalResourcesRequired="" altogether?)

 interface SVGTests {
   readonly attribute SVGStringList requiredFeatures;
   readonly attribute SVGStringList requiredExtensions;
   readonly attribute SVGStringList systemLanguage;
   boolean hasExtension(DOMString);
 SVGGraphicsElement implements SVGTests;
 SVGDefinitionElement implements SVGTests;
 SVGAnimationElement implements SVGTests;
 interface SVGFitToViewBox {
   readonly attribute SVGAnimatedRect viewBox;
   readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio;
 SVGSVGElement implements SVGFitToViewBox;
 SVGMarkerElement implements SVGFitToViewBox;
 interface SVGZoomAndPan {
   const unsigned short SVG_ZOOMANDPAN_UNKNOWN = 0;
   const unsigned short SVG_ZOOMANDPAN_DISABLE = 1;
   const unsigned short SVG_ZOOMANDPAN_MAGNIFY = 2;
   attribute unsigned short zoomAndPan;

Incorporate SVGURIReference into interfaces where it's needed

 interface SVGImageElement {
   readonly attribute SVGAnimatedString href;
 interface SVGMPathElement {
   readonly attribute SVGAnimatedString href;

Incorporate ElementTimeControl into SVGAnimationElement

No need for a separate interface, it's not used anywhere else.