Open Bug 1149515 Opened 10 years ago Updated 5 months ago

Consider creating a separate unit type for "image pixels"

Categories

(Core :: Layout, enhancement)

enhancement

Tracking

()

Tracking Status
firefox40 --- affected

People

(Reporter: MatsPalmgren_bugz, Unassigned)

References

Details

The type should probably follow the same general design as the other unit types in layout/base/Units.h. I think it should mostly be the same as CSSPixel although (in some cases?) it's translated into app units using AppUnitsPerDevPixel() instead. See bug 1149222 comment 12 and forward for background.
Blocks: 1149222
Blocks: 1149215
In what way would this be different from LayoutDevicePixel? That's translated into app units using AppUnitsPerDevPixel().
Yeah, I'm not sure we actually need a separate unit type for the <svg:image> issue in/around bug 1149222 comment 12. We just do two different things with 'width' & 'height', and I think we just need to keep those two things separate. The two things are: (1) We pass them to SVGImageContext's viewport. This helps the SVG document determine what region of its internal coordinate-system will be rendered. (in combination with several other things, like viewBox and preserveAspectRatio). We don't want the dev-pixel-to-css-pixel ratio to affect this, because we do *not* want full-page-zoom on an SVG document to modify what sections of its <svg:image> elements' internal documents are visible/clipped. (2) We scale them by appUnitsPerDevPixel and use that to create a destRect, & pass that to nsLayoutUtils::DrawSingleImage. This is in dev-pixels so that we actually end up drawing crisply, at the actual final resolution (e.g. 200px by 200px if the document is zoomed 2x, and we're displaying a 00-by-100 svg image) This should probably use LayoutDevicePixel. So I think we just need to keep those two things separate, rather than linking them as the patches in bug 1149222 partially did. (e.g. converting to dev pixels and then from that to CSS pixels)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.