Consider creating a separate unit type for "image pixels"

NEW
Unassigned

Status

()

--
enhancement
4 years ago
4 years ago

People

(Reporter: mats, Unassigned)

Tracking

Trunk
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox40 affected)

Details

(Reporter)

Description

4 years ago
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.
(Reporter)

Updated

4 years ago
Blocks: 1149222
(Reporter)

Updated

4 years ago
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)
You need to log in before you can comment on or make changes to this bug.