Bug 28440

Summary: background-size: X treated as background-size: X X, not background-size: X auto
Product: WebKit Reporter: Jeff Walden (remove +bwo to email) <jwalden+bwo>
Component: CSSAssignee: mitz
Status: RESOLVED FIXED    
Severity: Normal CC: bdakin, hyatt, mitz
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
URL: data:text/html,%3Cstyle%3Ediv%20{%20-moz-background-size:%20100%;%20-webkit-background-size:%20100%;%20background-image:%20url(https://bugs.webkit.org/images/favicon.ico);%20}%3C/style%3E%3Cdiv%20style=%22height:%20256px;%20width:%20128px;%22%3E%3C/div%3E%3Cp%3EThere%20should%20be%20two%20copies%20of%20the%20bugs.webkit.org%20favicon%20above,%20proportionately%20scaled%20to%208x%20original%20size.%3C/p%3E
Bug Depends on:    
Bug Blocks: 27569    
Attachments:
Description Flags
Reinstate -webkit-background-size and keep its behavior of using a copy of the first value; and change background-size to use 'auto' bdakin: review+

Description Jeff Walden (remove +bwo to email) 2009-08-18 16:51:01 PDT
See URL.
Comment 1 mitz 2009-08-23 21:15:47 PDT
The draft <http://dev.w3.org/csswg/css3-background/#the-background-size> does say “If only one value is given the second is assumed to be ‘auto’”, but this sort of behavior doesn’t make much sense to me, especially given the behavior of background-repeat and the 4-value (top-right-bottom-left) properties, where missing values are filled in with specified values.

If the spec isn’t going to change, we will need to fix this bug, but we will also have to undo the aliasing of -webkit-background-size to background-size and have the former maintain the current parsing. We also need to decide what to do about -webkit-mask-size.
Comment 2 Jeff Walden (remove +bwo to email) 2009-08-24 12:31:06 PDT
Interpreting as background-size: X auto does have the useful property that it produces an undistorted rendering.  There doesn't seem to be a comparably obvious way to interpret background-repeat or any of the 4-value properties to produce a "good" rendering every time.  The 4-values have an obvious symmetry argument for repeating that I think doesn't apply here as a general rule.  Drawing without distortion seems the best default, to me, when the one specified value in general only has meaning in the context of all the other surrounding widths (and the aspect ratio of the image itself).

I wasn't paying attention to www-style when the change was made, tho, so I have no idea what arguments were or were not presented in favor of this default.
Comment 3 mitz 2009-10-26 15:21:30 PDT
Created attachment 41905 [details]
Reinstate -webkit-background-size and keep its behavior of using a copy of the first value; and change background-size to use 'auto'
Comment 4 mitz 2009-10-26 15:42:09 PDT
Fixed in <http://trac.webkit.org/projects/webkit/changeset/50108>.