Closed Bug 586126 Opened 14 years ago Closed 7 years ago

Most unsigned longs in HTML IDLs are implemented as longs


(Core :: DOM: Core & HTML, defect)

Not set





(Reporter: ayg, Unassigned)



(Keywords: html5)

For instance, in dom/interfaces/html/nsIDOMHTMLCanvasElement.idl, width and height are long instead of unsigned long:

In dom/interfaces/html/nsIDOMHTMLImageElement.idl, hspace and vspace are long instead of unsigned long:

Etc.  In fact, there are only four attributes total in that whole directory that are unsigned longs in Gecko's IDLs:

$ grep "unsigned long[^)]*;" dom/interfaces/html/*Element.idl
dom/interfaces/html/nsIDOMHTMLInputElement.idl:           attribute unsigned long         size;
dom/interfaces/html/nsIDOMHTMLSelectElement.idl:           attribute unsigned long         length;
dom/interfaces/html/nsIDOMHTMLVideoElement.idl:  readonly attribute unsigned long videoWidth;
dom/interfaces/html/nsIDOMHTMLVideoElement.idl:  readonly attribute unsigned long videoHeight;
> In dom/interfaces/html/nsIDOMHTMLImageElement.idl, hspace and vspace are long
> instead of unsigned long:

Yes, that's what they are in the DOM 2 HTML specification too, which is what the IDL is from.  Is there a reason HTML5 changed that, exactly?  Seems like a gratuitous change to me...
Version: Other Branch → Trunk
Severity: normal → minor
Keywords: html5
I've filed bugs on HTML5 for at least some of those.
For reference:

I put a full list there of all the discrepancies that my tests picked up.  <canvas> height/width is still a Firefox bug, though, right?  Or should that be changed in the spec too?
(In reply to comment #4)
> Canvas is long in WebKit as well:
> <>

Test case:

<!doctype html>
    var el = document.createElement("canvas");
    el.setAttribute("width", "-2");

IE9PP4 and Safari 5 alert -2, Firefox 4.0b3 alerts 0, Chrome dev and Opera 10.60 alert 300.  The spec agrees with Chrome dev and Opera 10.60.  This is what makes the most sense, since

<!doctype html>
<canvas width=-2></canvas>
    var context = document.getElementsByTagName("canvas")[0].getContext("2d");
    context.fillStyle = "green";
    context.fillRect(0, 0, 300, 300);

does actually draw a rectangle in Firefox (as well as Chrome and Opera, but not IE9 or Safari), so the width is effectively 300 and that's what it makes sense to return.  So I think this is a Firefox bug, not a spec bug.
Comment 5 is not really about this bug.
This bug is (or at least was) about long attributes in some .idl files.
That's what comment 5 is about, no?  This .idl file defines canvas width/height as long, when the spec says unsigned long:

Comment 5 is why I think this is a bug in Firefox and not the spec.
The spec bug was closed WONTFIX a few days ago:
OS: Linux → Windows Server 2003
Component: DOM → DOM: Core & HTML
OS: Windows Server 2003 → All
Hardware: x86 → All
Depends on: 610212
Depends on: 630889
Closed: 11 years ago
Resolution: --- → DUPLICATE
The duplicate status seems a bit unclear here.
Marking this bug as depending on bug 826738. If bug 826738 fixes it, we will mark this bug as fixed.
Depends on: 826738
Resolution: DUPLICATE → ---
I'm pretty sure this is fixed now.  Someone can reopen if it's not.
Closed: 11 years ago7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.