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)
Core
Graphics: Canvas2D
Tracking
()
RESOLVED
FIXED
130 Branch
People
(Reporter: MatsPalmgren_bugz, Assigned: TYLin)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
|
21.04 KB,
patch
|
Details | Diff | Splinter Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review |
No description provided.
Flags: in-testsuite-
| Reporter | ||
Comment 1•10 years ago
|
||
| Reporter | ||
Comment 2•10 years ago
|
||
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)
| Reporter | ||
Comment 3•10 years ago
|
||
Updated•3 years ago
|
Severity: minor → S4
| Assignee | ||
Comment 4•1 year ago
|
||
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.
Updated•1 year ago
|
Assignee: nobody → aethanyc
Status: NEW → ASSIGNED
| Assignee | ||
Updated•1 year ago
|
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
Comment 6•1 year ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
status-firefox130:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 130 Branch
Updated•1 year ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•