[csswg-drafts] Pull Request: [css-transforms-2] Fix the check for product == 1.0 to include the case when product is -1

birtles has just labeled a pull request from birtles for https://github.com/w3c/csswg-drafts as "css-transforms-2":

== [css-transforms-2] Fix the check for product == 1.0 to include the case when product is -1 ==
This occurs in the following code:

```
if (product == 1.0)
   quaternionDst = quaternionA
   return

theta = acos(dot)
w = sin(t * theta) * 1 / sqrt(1 - product * product)
```

If `product` is -1.0 we'll end up doing division by zero when we
calculate `w`.

WebKit works around this by inverting the angle (effectively doing the
same thing as taking the absolute value):

  https://github.com/WebKit/webkit/blob/425f9748af04b2c7e235cf3ff9396eecc23c0af5/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp#L542-L548

Chromium takes the absolute value like this patch does:

  https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/transforms/transformation_matrix.cc?l=762&rcl=cd5181ecb173efdef4163f066c27bd136fca01d5

See https://github.com/w3c/csswg-drafts/pull/3235

Received on Tuesday, 23 October 2018 06:38:31 UTC