[Webkit-unassigned] [Bug 116146] New: Handling of background-size auto may lead to no background-image being displayed

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed May 15 04:31:24 PDT 2013


           Summary: Handling of background-size auto may lead to no
                    background-image being displayed
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: CSS
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: dtrebbien at gmail.com
                CC: dtrebbien at gmail.com

Created an attachment (id=201816)
 --> (https://bugs.webkit.org/attachment.cgi?id=201816&action=review)
Test case

Attached is a test case. In Safari 6.0.4, Firefox 21.0, and Opera 12.15, all four boxes have a gradient background. In Chrome 26.0.1410.65, Chromium 29.0.1507.0 (199664), and WebKit r150098 built on 15 May 2013, the first two boxes have a gray background.

The problem is that the gradient image is 1x40 and because background-size is set to auto for the width (which causes the intrinsic ratio to be preserved along the width), the width is scaled to less than 1px logically in order to fit the height to 20px and 39px. Later versions of WebKit must be truncating the scaled width so that WebKit resolves the width to 0 and the background image is not displayed.

Alexey Proskuryakov determined that the change in behavior was introduced in r121296:  https://lists.webkit.org/pipermail/webkit-help/2013-May/003504.html

As mentioned in the commit message for r121296, the spec http://www.w3.org/TR/css3-background/#background-size says: "If the background image's width or height resolves to zero, this causes the image not to be displayed. (The effect is the same as if it had been a transparent image.)" This does not say, though, how dimensions are to be resolved if a dimension needs to be rounded.

If a dimension must be rounded, I think that it makes sense to truncate the value, but ensure that the truncated value is greater than or equal to 1 so that something is always displayed. My reasoning is that if I wanted not to display a background image, I could have set the background-size for one of the dimensions to 0. If WebKit has to err because of the inability to tile images of non-integral dimensions, I think that it should err on the side of displaying something rather than nothing.

Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

More information about the webkit-unassigned mailing list