Closed Bug 371225 Opened 18 years ago Closed 18 years ago

large background image tiled against half-pixel aligned right edge doesn't fill right pixel

Categories

(Core :: Graphics, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla1.9alpha3

People

(Reporter: dbaron, Assigned: dbaron)

Details

(Whiteboard: [patch])

Attachments

(2 files)

A background image that is: * on an element with a 'background-position' property that right-aligns the image * is larger than the element (so that we go through the optimization that draws the image clipped rather than tiling it) * on an element whose right edge is on a half-pixel boundary (or perhaps it's on an element with a half-pixel width? -- haven't checked yet) ends up not filling the rightmost pixel that it should (and the rightmost pixel that a background image would fill). This causes reftest failures in layout/reftests/pixel-rounding/ (haven't figured out exactly which tests yet). It doesn't appear to be present in Firefox 2.0, but it's present on trunk on Linux and Windows.
Search for "371225" in layout/reftests/pixel-rounding/reftest.list for the failures attributed to this bug. There's a basic failure in one height test and one width test, but then there's another cluster of tests whose failures I don't understand (and vary by platform) but that are probably (at least somewhat) related to this bug. The two that should definitely serve as testcases are background-image-height-5.html and background-image-width-5.html .
But, curiously enough, this bug does not appear to be present on Mac. (Although perhaps that's bug 371188 talking.)
Your tests appear to work fine on my Mac (both Camino trunk and Minefield trunk). But I've seen similar clipping of background images on a site I made for a client. At least I think it is the same. In that case, there is a right-floated block with percentage width that contains a block with a background image positioned right/bottom. Test case coming. If the block is left floated or just in-flow there are no problems.
Attached file test case for comment #3 (deleted) —
Resize window to see the right border (part of the image) appear and disappear. Tested OS X 10.4.8 PPC
Attached patch patch (deleted) — Splinter Review
This fixes the most basic testcases for this bug. It also fixes an image sizing problem in layout/reftests/pixel-rounding/image-top-height-4.html (and similar tests), although that test was also failing because of bug 371316, so I hadn't noticed immediately. The most common cases for this being important in reality are images with percentage widths, but it's much easier to test with explicit fractional pixel widths. (And with scaled images I think the src rect can also have fractional pixels.)
Assignee: nobody → dbaron
Status: NEW → ASSIGNED
Attachment #256136 - Flags: review?(vladimir)
(Note that I'll need to test this patch on multiple platforms to figure out exactly what updating of the reftest manifests is needed, but that doesn't need code review, so I didn't wait for attaching the patch for that...)
Priority: -- → P2
Whiteboard: [patch]
Target Milestone: --- → mozilla1.9alpha3
Comment on attachment 256136 [details] [diff] [review] patch Ah whoops, there might be some other cases of incorrect rectangle conversions lurking... I'll go through the code this weekend.
Attachment #256136 - Flags: review?(vladimir) → review+
Checked in to trunk.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: