Bug 3237

Summary: CSS2: Background repeats when it shouldn't
Product: WebKit Reporter: Dave Hyatt <hyatt>
Component: CSSAssignee: Dave Hyatt <hyatt>
Status: VERIFIED FIXED    
Severity: Normal    
Priority: P2    
Version: 412   
Hardware: All   
OS: All   
URL: http://sonofhans.net/css/snippets/background_position_safari.html
Attachments:
Description Flags
Test of x and y positioning
none
Proposed fix
none
Proposed fix #2 none

Dave Hyatt
Reported 2005-06-01 15:56:49 PDT
2/13/05 10:44 PM Randal Hansen: Summary: When told to position a background image taller than its container below the container top and not to repeat it, Safari does repeat the image. This is fiddly to describe but easy to see. Example: I have a simple test case at: http://sonofhans.net/css/snippets/background_position_safari.html This test page passes W3C XHTML and CSS validators, and works correctly in Mozilla 1.7 and Windows Internet Explorer 6.
Attachments
Test of x and y positioning (759 bytes, text/html)
2005-06-10 09:50 PDT, Nate Cook
no flags
Proposed fix (2.06 KB, patch)
2005-06-10 09:52 PDT, Nate Cook
no flags
Proposed fix #2 (3.79 KB, patch)
2005-06-10 14:55 PDT, Nate Cook
no flags
Dave Hyatt
Comment 1 2005-06-01 15:57:22 PDT
Apple Bug: rdar://4005553/
Nate Cook
Comment 2 2005-06-10 09:50:10 PDT
Created attachment 2221 [details] Test of x and y positioning The same thing also happens if the image is wider & positioned to the right of 0. This test case demonstrates that.
Nate Cook
Comment 3 2005-06-10 09:52:30 PDT
Created attachment 2222 [details] Proposed fix This makes it render properly.
Darin Adler
Comment 4 2005-06-10 13:24:51 PDT
Looks good to me, but I think Dave should review. Style-wise, I think the code is a tiny bit inelegant. The existing code always sets sx in all the code paths, even though it's initialized at the top of the function. The new code introduces code paths that rely on the default value of 0 for sx and sy. I'd prefer a patch that goes further and gets rid of the "sx = 0" cases by changing the if structure and just doing nothing in the "pixh == 0" cases. This is an example of something we can't test with a dumped render tree, so we probably shouldn't add this to the layout-tests subdirectory. While I don't want to go to a design where we dump the pixmap of every test result, it would be good to figure out a way to make a regression test for this bug some day.
Nate Cook
Comment 5 2005-06-10 14:55:02 PDT
Created attachment 2231 [details] Proposed fix #2 Good points. I was trying to edit as little as possible. For testing, maybe we could extend the layoutTestController so that individual tests could force a pixmap dump?
Dave Hyatt
Comment 6 2005-06-10 22:15:27 PDT
Fixed. I added a new directory to the layout tests... fast/backgrounds, that can at least be visually inspected for correctness until we come up with something better. Additional bg tests are encouraged.
Joost de Valk (AlthA)
Comment 7 2005-07-13 23:01:58 PDT
Fixed in 10.4.2
Note You need to log in before you can comment on or make changes to this bug.