Closed Bug 112988 Opened 24 years ago Closed 24 years ago

Add support for subpieces of an image to the XUL image frame

Categories

(Core Graveyard :: Skinability, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED
mozilla0.9.7

People

(Reporter: hyatt, Assigned: hyatt)

References

Details

Attachments

(2 files)

The idea behidn this bug is to be able to extract a piece of an image from a larger image and use it when painting. Something like foo.gif#0,0,16,16 where the numbers to the right are top,left,width,height of the subimage to extract.
Blocks: 112980
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9.7
Target Milestone: mozilla0.9.7 → mozilla0.9.8
Patch to implement support.
This patch does the following: (1) Adds support for a new property, -moz-image-region, that is a rect. Its syntax is identical to the CSS 'clip' property. This rect, if specified, is used by XUL image frames to carve out a piece of a larger image and only paint that piece as part of the image frame. (2) Cleans up and removes #ifdefs from the XUL image frame. (3) Fixes a perf problem related to allocating many needless URIs whenever the style context for a XUL image frame changed. (4) Patches a bug in the rendering context's DrawImage routine. It was adding in the src rect's x/y offsets to the destination point, which is not what DrawScaledImage does with its dest rect's x/y. Fixing this inconsistency involved tweaking the HTML image frame a little bit.
Target Milestone: mozilla0.9.8 → mozilla0.9.7
Note that this fix to the DrawImage routine has fixed some printing issues when images are split across pages. The incorrect offsetting was messing up images in that case. For an example of how this bug has fixed that problem, see the 1.x megabyte images in this directory: http://rsd.gsfc.nasa.gov/goesg/earth/Weather/GOES-8/jpg/vis/4km/ Although there are numerous painting issues that still plague this case when printing, and I suspect they are related to the dirty rect intersection optimization in HTMLImageFrame, this patch clearly makes things a bit better.
shouldn't the default dimensions of the image region (when 'auto' is used?) be the width and height of the image, rather than 0?
Probably, but I'd have to add an extra member variable to the style struct like clip does for auto, and I don't want to bloat the style struct just for purity's sake. :) Basically I'd have to have an mImageRegionFlags member variable like mClipFlags does for clip that stored the fact that the rect was auto. I found it easier to just use (0,0,0,0) as the auto values and make the code use the full rect when it got a 0,0,0,0 subrect.
Comment on attachment 60101 [details] [diff] [review] Patch that enables -moz-image-region support in CSS. ok. r=ben@netscape.com
Attachment #60101 - Flags: review+
Comment on attachment 60101 [details] [diff] [review] Patch that enables -moz-image-region support in CSS. sr=hewitt
Attachment #60101 - Flags: superreview+
Fixed. I moved image-region into the list struct so that it would inherit. Other than that, the patch stayed the same.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Verified the patch
Status: RESOLVED → VERIFIED
This patch didn't update the nsStyleList copy constructor, and thus caused bug 220717.
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: