I have an img
inside a picture
styled with rounded corners and a drop shadow:
img {
border-radius: 22%;
filter: drop-shadow(0px 0px 1px rgba(0, 0, 0, 0.75));
}
<picture>
<source type="image/webp" srcset="https://cdn.crispedge.com/c78b95.webp" />
<source type="image/png" srcset="https://cdn.crispedge.com/c78b95.png" />
<img width="100" height="100" src="https://cdn.crispedge.com/c78b95.png" />
</picture>
When first loaded in Safari (mobile or desktop) the shadow will only show on the corners, as shown below:
When the page is refreshed (or loaded in other browsers) the shadow is shown all around the image:
I had a JSFiddle that demonstrates this: https://jsfiddle.net/s0dy5jwa/17/show
I see even stranger results when using multiple elements. For example the following will be missing the drop shadow on the top of the first image and the bottom of the last image.
<code>img</code> inside <code>picture</code>
<br/>
<picture>
<img width="100" height="100" src="https://cdn.crispedge.com/c78b95.png" />
</picture>
<br/>
Just an <code>img</code> with PNG
<br/>
<img width="100" height="100" src="https://cdn.crispedge.com/c78b95.png" />
<br/>
Just an <code>img</code> with WebP
<br/>
<img width="100" height="100" src="https://cdn.crispedge.com/c78b95.webp" />
Demo: https://jsfiddle.net/s0dy5jwa/22/show
I've seen the same bug when using a mask to round the image so it seems to occur whenever the shape of the element changes.
Can this bug be worked around?