Created attachment 373520 [details] [diff] [review] patch? Hopefully the right approach, compiles but untested as I don't really know much about canvas.
Hmm.. that's not quite right; there are two pieces here, the filter applied to rendering the canvas itself when it's being CSS scaled, and whether the images rendered to the canvas are rendered with smoothing. The latter should probably have an 'auto' mode which will honor the image's style (if there is one? there may well not be a frame for an image that's to be drawn, I guess we'd just use the default then). I can take a look at fixing up the patch in the next few days.
Actually I think Robert's patch is fine as far as it goes. It makes the rendering of the canvas onto a destination surface honour the canvas's image-rendering property. Rendering images or videos into the canvas using drawImage honors imageSmoothingEnabled. That's all OK right? The only thing that's missing, possibly, is the 'auto' value you suggest to honor an image's style. I guess that could be useful but it would make sense to be a separate patch. (I guess in principle it would be logical for image formats themselves to specify how the image data should be resampled, but I guess that's not possible except for SVG images, so never mind.)
Comment on attachment 373520 [details] [diff] [review] patch? I encountered someone who actually needs this!
Comment on attachment 373520 [details] [diff] [review] patch? Ok; I think this is fine, it'd be nice if we could avoid passing the filter down to ThebesSufaceFromElement since in theory that should always be grabbing a 1:1 surface... but there may be cases where that's not true, or if we ever support SVG images, etc.
Created attachment 377834 [details] [diff] [review] update to tip
try server builds are here https://email@example.com/ roc can the someone who needs this confirm that it does what he/she needs?
You've tested it, right?
That's my problem. I don't really know much about canvas and how to test it. It compiles and passes the existing reftests.
If you take an existing canvas demo (e.g. https://bug491595.bugzilla.mozilla.org/attachment.cgi?id=375888 ), set image-rendering:-moz-crispEdges and then zoom in, it should look blocky, not bilinear filtered.
(In reply to comment #10) That works although it's -moz-crisp-edges
Created attachment 377922 [details] [diff] [review] updated patch with reftest
Created attachment 377929 [details] [diff] [review] updated
checked in http://hg.mozilla.org/mozilla-central/rev/a927df82dfcd and http://hg.mozilla.org/mozilla-central/rev/5b40dab2d442
Just needs the existing dev doc for image-rendering tweaking to remove the reference to this bug.
(In reply to comment #15) Done.