openlayers/ol3 — pull request #2602 by elemoine (2014-08-22 16:33:30+00:00)
Title: Fix Uncaught RangeError in canvas tile renderer

This PR aims to fix https://github.com/openlayers/ol3/issues/2542.

The bug triggers when a tile layer has an extent and when the layer extent and the view extent do not intersect. In that case the canvas tile layer renderer's `prepareFrame` function calculates tile ranges and canvas width and height values that cause js errors further down in the function.

This PR fixes the problems by making the canvas tile renderer's `prepareFrame` clear its canvas and immediately return when the layer extent and view extent don't intersect. We could probably do better and avoid clearing the canvas when that condition happens. I added a FIXME for this.

Please review.

Closes #2542.