Re: [svgwg] Use DOMMatrix2DInit as parameters for methods. #326 (#577)

Sorry! Reviewing the linked geometry interfaces text, I think it safely covers the default behavior.

However, the way you have written the algorithm, I don't think you include the full error handling behavior from the validate and fix-up method, because you only run the steps as part of a hypothetical test for `is2D()`.

I would rewrite the steps as follows:

<ol class='algorithm'>
  <li>If the <a>SVGTransform</a> object is <a href='#ReadOnlyTransform'>read only</a>, then
  <a>throw</a> a <a>NoModificationAllowedError</a>.</li>
  <li> Let <var>newMatrix</var> be the result of <code><a>DOMMatrixReadOnly</a>.fromMatrix(<var>matrix</var>)</code>,
  including the <a href="https://drafts.fxtf.org/geometry/#dommatrixinit-dictionary">validate and fix-up</a> steps for missing values.
  If that method throws an error, then re-throw that error and abort these steps.</li>
  <li>If <var>newMatrix</var>.is2D() would return true,
  then set the <a>SVGTransform</a> object's
  <a href='#TransformValue'>value</a> to a <span class='prop-value'>matrix(…)</span>
  value that represents the same matrix as <var>newMatrix</var>.</li>
  <li>Otherwise, set the <a>SVGTransform</a> object's
  <a href='#TransformValue'>value</a> to a <span class='prop-value'>matrix3d(…)</span>
  value that represents the same matrix as <var>newMatrix</var>.</li>
  <li>In either case, set <var>newMatrix</var>
  as the <a>SVGTransform</a> object's <a href="#TransformMatrixObject">matrix object</a>.</li>
  <li>If the <a>SVGTransform</a> object
  <a href="#TransformMode">reflects a presentation attribute value of an element</a>,
  then <a>reserialize</a> the reflected attribute.</li>
</ol>

```html
<ol class='algorithm'>
  <li>If the <a>SVGTransform</a> object is <a href='#ReadOnlyTransform'>read only</a>, then
  <a>throw</a> a <a>NoModificationAllowedError</a>.</li>
  <li> Let <var>newMatrix</var> be the result of <code><a>DOMMatrixReadOnly</a>.fromMatrix(<var>matrix</var>)</code>,
  including the <a href="https://drafts.fxtf.org/geometry/#dommatrixinit-dictionary">validate and fix-up</a> steps for missing values.
  If that method throws an error, then re-throw that error and abort these steps.</li>
  <li>If <var>newMatrix</var>.is2D() would return true,
  then set the <a>SVGTransform</a> object's
  <a href='#TransformValue'>value</a> to a <span class='prop-value'>matrix(…)</span>
  value that represents the same matrix as <var>newMatrix</var>.</li>
  <li>Otherwise, set the <a>SVGTransform</a> object's
  <a href='#TransformValue'>value</a> to a <span class='prop-value'>matrix3d(…)</span>
  value that represents the same matrix as <var>newMatrix</var>.</li>
  <li>In either case, set <var>newMatrix</var>
  as the <a>SVGTransform</a> object's <a href="#TransformMatrixObject">matrix object</a>.</li>
  <li>If the <a>SVGTransform</a> object
  <a href="#TransformMode">reflects a presentation attribute value of an element</a>,
  then <a>reserialize</a> the reflected attribute.</li>
</ol>
```

-- 
GitHub Notification of comment by AmeliaBR
Please view or discuss this issue at https://github.com/w3c/svgwg/pull/577#issuecomment-446331113 using your GitHub account

Received on Tuesday, 11 December 2018 19:30:58 UTC