RESOLVED FIXED Bug 155955
border-image-repeat:round output doesn't match other browsers
https://bugs.webkit.org/show_bug.cgi?id=155955
Summary border-image-repeat:round output doesn't match other browsers
Chris Rebert
Reported 2016-03-28 13:57:32 PDT
Created attachment 275046 [details] Screenshot from WebKit Nightly r198607 (Tested in OS X WebKit Nightly r198607 and in iOS 9.3) Steps to reproduce: 1. Open http://output.jsbin.com/weqiqu/quiet in WebKit/Safari. 2. Note that the page's CSS uses `border-image-repeat: round round;` for the border in question. 3. Observe the red, blue, and transparent border. Expected result: Each segment of red, blue, and transparency in the border should be relatively short. (See attached screenshots from other browsers) Actual result: Each segment of red, blue, and transparency in the border is relatively long, roughly twice as long as in the other browsers. (See attached screenshot from WebKit Nightly)
Attachments
Screenshot from WebKit Nightly r198607 (315.95 KB, image/png)
2016-03-28 13:57 PDT, Chris Rebert
no flags
Screenshot from Firefox 47 (1.27 MB, image/png)
2016-03-28 13:58 PDT, Chris Rebert
no flags
Screenshot from Chrome 49 (399.03 KB, image/png)
2016-03-28 13:58 PDT, Chris Rebert
no flags
Chrome 126 (891.88 KB, image/png)
2024-07-08 16:36 PDT, Alexandr Shushunov
no flags
Safari 16.2 (817.55 KB, image/png)
2024-07-08 16:40 PDT, Alexandr Shushunov
no flags
Chris Rebert
Comment 1 2016-03-28 13:58:12 PDT
Created attachment 275047 [details] Screenshot from Firefox 47
Chris Rebert
Comment 2 2016-03-28 13:58:40 PDT
Created attachment 275049 [details] Screenshot from Chrome 49
Chris Rebert
Comment 3 2016-03-28 14:00:00 PDT
Alexey Proskuryakov
Comment 4 2016-09-08 14:01:11 PDT
Simon Fraser (smfr)
Comment 5 2016-09-29 22:15:52 PDT
We fail to implement the "and their width is scaled proportionally" bit of https://www.w3.org/TR/css3-background/#border-image-process. Fixing this and the rendering of the middle part of the image requires hoisting the tiling mode logic out of Image::drawTiled() and up into NicePieceImage.
Adenilson Cavalcanti Silva
Comment 6 2016-10-12 13:30:41 PDT
If this one is available, I would like to work on it.
Simon Fraser (smfr)
Comment 7 2016-10-12 14:01:58 PDT
Please do. I started looking at this and it's a bit more involved than I thought. Basically I think the fix should reflect this comment in Image::drawTiled(): // FIXME: These rules follow CSS border-image rules, but they should not be down here in Image. so the 'space' and 'round' logic there needs to pushed up into NinePieceImage::computeTileScales(), maybe as part of scaleSlicesIfNeeded(). This probably requires sending 'spacing' and 'phase' down through GraphicsContext::drawTiledImage(). I think this code move is necessary to implement this part of the spec: "The middle image's width is scaled by the same factor as the top image unless that factor is zero or infinity, in which case the scaling factor of the bottom is substituted, and failing that, the width is not scaled. The height of the middle image is scaled by the same factor as the left image unless that factor is zero or infinity, in which case the scaling factor of the right image is substituted, and failing that, the height is not scaled."
len
Comment 8 2021-09-01 22:13:32 PDT
Is this still not fixed? I'm still seeing this issue in 2021, 5.5 years after this was reported. https://stackoverflow.com/questions/68896770/border-image-slicing-differences-between-browsers
Ahmad Saleem
Comment 9 2022-09-01 04:34:47 PDT
I am able to reproduce this bug in Safari Technology Preview 152 using attached JSBin from URL field and the border does not match with other browsers (Chrome Canary 107 and Firefox Nightly 106). Just wanted to share updated testing results. Thanks!
Brent Fulgham
Comment 10 2023-03-17 16:54:33 PDT
(In reply to Simon Fraser (smfr) from comment #7) > Please do. I started looking at this and it's a bit more involved than I > thought. > > Basically I think the fix should reflect this comment in Image::drawTiled(): > // FIXME: These rules follow CSS border-image rules, but they should not > be down here in Image. > > so the 'space' and 'round' logic there needs to pushed up into > NinePieceImage::computeTileScales(), maybe as part of scaleSlicesIfNeeded(). > This probably requires sending 'spacing' and 'phase' down through > GraphicsContext::drawTiledImage(). I think this code move is necessary to > implement this part of the spec: > > "The middle image's width is scaled by the same factor as the top image > unless that factor is zero or infinity, in which case the scaling factor of > the bottom is substituted, and failing that, the width is not scaled. The > height of the middle image is scaled by the same factor as the left image > unless that factor is zero or infinity, in which case the scaling factor of > the right image is substituted, and failing that, the height is not scaled." I think the logic in NinePieceImage::computeMiddleTileScale(...) correctly addresses the above (at east for zero -- not sure if Infinity ever gets this far). I believe I've found a calculation error. Patch coming.
Brent Fulgham
Comment 11 2023-03-17 17:01:11 PDT
EWS
Comment 12 2023-03-20 18:25:22 PDT
Committed 261903@main (255da9f55bbe): <https://commits.webkit.org/261903@main> Reviewed commits have been landed. Closing PR #11668 and removing active labels.
Brent Fulgham
Comment 13 2023-03-21 14:12:48 PDT
Ahmad Saleem
Comment 14 2023-03-23 21:29:36 PDT
*** Bug 229803 has been marked as a duplicate of this bug. ***
Brent Fulgham
Comment 15 2023-03-31 15:15:36 PDT
*** Bug 254843 has been marked as a duplicate of this bug. ***
Alexandr Shushunov
Comment 16 2024-07-08 16:35:02 PDT
It looks like the bug still exists.
Alexandr Shushunov
Comment 17 2024-07-08 16:36:50 PDT
Created attachment 471846 [details] Chrome 126
Alexandr Shushunov
Comment 18 2024-07-08 16:40:08 PDT
Created attachment 471847 [details] Safari 16.2
Alexey Proskuryakov
Comment 19 2024-07-08 17:08:19 PDT
Safari 16.2 is very old, it shipped before the fix. Can you reproduce with Safari 17 or newer?
Alexandr Shushunov
Comment 20 2024-07-09 07:12:03 PDT
My mistake. It works correctly in Safari 17.
Note You need to log in before you can comment on or make changes to this bug.