Bug 85560 - [chromium] CCMathUtil projectPoint needs to avoid divide-by-zero
Summary: [chromium] CCMathUtil projectPoint needs to avoid divide-by-zero
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Shawn Singh
Depends on:
Reported: 2012-05-03 17:40 PDT by Shawn Singh
Modified: 2012-05-07 11:47 PDT (History)
4 users (show)

See Also:

Patch (5.80 KB, patch)
2012-05-07 10:07 PDT, Shawn Singh
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Shawn Singh 2012-05-03 17:40:39 PDT
I'm not sure if this is causing any known rendering artifacts / bugs, but of course it needs to be fixed anyway.

When m33() is zero in projectPoint(), that implies the projection plane is parallel to the ray being traced, so it doesn't really project to any specific point on the plane.

To my knowledge, its correct enough to just return any point in this case, as long as we don't divide by zero and cause Infs and NaNs for the rest of the code.  I think this case only happens for layers that are not visible anyway (rotated perfectly so that they don't show up, or co-planar with the camera point).
Comment 1 Shawn Singh 2012-05-07 10:07:26 PDT
Created attachment 140543 [details]

Please note, one unit test had to be updated so it does not fail due to the new divide-by-zero code.  By a lucky fluke, it turned out that the test was still providing worthwhile coverage before this fix, but now it is even better
Comment 2 Adrienne Walker 2012-05-07 11:01:35 PDT
Comment on attachment 140543 [details]

Nice catch.  R=me.
Comment 3 WebKit Review Bot 2012-05-07 11:47:24 PDT
Comment on attachment 140543 [details]

Clearing flags on attachment: 140543

Committed r116332: <http://trac.webkit.org/changeset/116332>
Comment 4 WebKit Review Bot 2012-05-07 11:47:33 PDT
All reviewed patches have been landed.  Closing bug.