Bug 1686244 - Handle degenerate linear gradients. r=aosmond
Bug 1686244 - Handle degenerate linear gradients. r=aosmond

This just reorders some checks to fail against NaNs and also checks for finiteness.

Differential Revision: https://phabricator.services.mozilla.com/D106347

[ghsync] From https://hg.mozilla.org/mozilla-central/rev/7be47f00f8cfb94c2fbf68c094ddf7071a24bc44

servo/webrender,servo/webrender,servo/webrender,servo/webrender,servo/webrender,servo/webrender