[Webkit-unassigned] [Bug 39149] Canvas element cannot have negative width or height

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun May 16 19:52:57 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=39149





--- Comment #6 from Darin Adler <darin at apple.com>  2010-05-16 19:52:57 PST ---
(From update of attachment 56199)
I think this patch is not entirely correct or at least not complete.

The code in HTMLCanvasElement::reset seems fine, but the changes to HTMLCanvasSetElement::setHeight and setWidth are either wrong or incomplete.

>  void HTMLCanvasElement::setHeight(int value)
>  {
> -    setAttribute(heightAttr, String::number(value));
> +    int height = (value >= 0) ? value : DefaultHeight;
> +    setAttribute(heightAttr, String::number(height));
>  }

In other similar call sites, I've seen behavior where attempting to set to an illegal value leaves the attribute alone rather than setting it to a default value.

To test this we'd want to set the height attribute of a canvas to something other than the default and see what an attempt to change it to a negative number does in that case.

It also seems strange and probably wrong that this would add a height attribute of "150" to a canvas element that previously had no height attribute of all.

I'd also like to know what happens if we attempt to set the height attribute to a non-numeric string. Both by assigning that value to height and using the setAttribute function. Also, what happens if we set a canvas's height attribute to a negative number using the setAttribute function.

I'd also like to see test cases where we set height to NaN and infinity to see how those cases should be handled. And hear what canvas implementations in other browser engines do in all those cases.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list