Closed Bug 1150182 Opened 10 years ago Closed 1 year ago

Make HTMLCanvasElement::GetSize/GetWidthHeight return CSSIntSize instead of unitless nsIntSize

Categories

(Core :: Graphics: Canvas2D, task)

task

Tracking

()

RESOLVED FIXED
130 Branch
Tracking Status
firefox40 --- wontfix
firefox130 --- fixed

People

(Reporter: MatsPalmgren_bugz, Assigned: TYLin)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

No description provided.
Flags: in-testsuite-
Attached patch wipSplinter Review
I think HTMLCanvasElement::GetSize/GetWidthHeight are dealing in CSS pixels, and by extension also nsHTMLCanvasFrame::GetCanvasSize() (which is the one I'm primarily interested in fixing). HTMLCanvasElement::GetSize just returns GetWidthHeight(): http://mxr.mozilla.org/mozilla-central/source/dom/html/HTMLCanvasElement.cpp#850 GetWidthHeight just returns the value of @width/@height or default to 300 if not present (which usually means they are CSS pixels IME): http://mxr.mozilla.org/mozilla-central/source/dom/html/HTMLCanvasElement.cpp#146 Now to the strange stuff. In multiple places we pass along these CSS pixels directly into GFX to size the surface. I've marked those in the patch with XXX comments. Perhaps this is intentional to make the rendering "crisp" when zoomed in (same as for images) as described in bug 1149222 comment 16? On line 6703 here for example: http://hg.mozilla.org/mozilla-central/annotate/e5b72a8edb82/layout/base/nsLayoutUtils.cpp#l6696 Does anyone know why we're doing this? (so I can add better explanations than my XXX comments)
Severity: minor → S4

Canvas uses CSS pixels, so this patch encodes the information into the type
system. Some painting code still uses unknown sizes, so we need to use
CSSIntSize::FromUnknownSize and ToUnknownSize() to convert them.

This patch doesn't change behavior.

Assignee: nobody → aethanyc
Status: NEW → ASSIGNED
Blocks: 1907668
Type: defect → task
Component: Layout → Graphics: Canvas2D
Priority: P4 → --
Pushed by aethanyc@gmail.com: https://hg.mozilla.org/integration/autoland/rev/399b1edeca46 Use strong-typed CSSIntSize instead of nsIntSize for canvas sizes. r=gfx-reviewers,layout-reviewers,emilio,nical
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 130 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: