Closed Bug 635380 Opened 9 years ago Closed 9 years ago

Difference between Mozilla/Webkit interpreting "If the numeric arguments don't make sense...throws an INDEX_SIZE_ERR exception"

Categories

(Core :: Canvas: 2D, defect)

defect
Not set

Tracking

()

RESOLVED DUPLICATE of bug 629875

People

(Reporter: humph, Unassigned)

References

()

Details

Given:

ctx.drawImage(obj, 0, 0, 150, 185, 185, -150, 75, -92.5)

We do this, and throw, due to the negative values:

3397     // check args
3398     if (sx < 0.0 || sy < 0.0 ||
3399         sw < 0.0 || sw > (double) imgSize.width ||
3400         sh < 0.0 || sh > (double) imgSize.height ||
3401         dw < 0.0 || dh < 0.0)
3402     {
3403         // XXX ERRMSG we need to report an error to developers here! (bug 329026)
3404         rv = NS_ERROR_DOM_INDEX_SIZE_ERR;
3405         goto FINISH;
3406     }

Webkit happily draws it.

I think the difference may come from the spec being ambiguous and saying:

"If the numeric arguments don't make sense (e.g. the destination is a 0×0 rectangle), throws an INDEX_SIZE_ERR exception...The destination rectangle is the rectangle whose corners are the four points (dx, dy), (dx+dw, dy), (dx+dw, dy+dh), (dx, dy+dh)."

It doesn't specify the behaviour of negative values for y or w, though leaves the door open for both interpretations.

Whoever is right, we do it differently.
Sadly.  Thanks bz.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 629875
You need to log in before you can comment on or make changes to this bug.