Bug 156817 - position:fixed and background-color lead to painting artifacts on non-retina displays
Summary: position:fixed and background-color lead to painting artifacts on non-retina ...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: Safari 9
Hardware: Mac OS X 10.11
: P2 Normal
Assignee: Nobody
URL: https://jsfiddle.net/Lcu6Lrv9/7/
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-20 16:14 PDT by Trevor Rundell
Modified: 2016-04-20 16:32 PDT (History)
3 users (show)

See Also:


Attachments
The bug in a JSFiddle (70.06 KB, image/png)
2016-04-20 16:15 PDT, Trevor Rundell
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Trevor Rundell 2016-04-20 16:14:37 PDT
This bug is a little finicky and doesn't manifest consistently. However, the setup in this JSFiddle (https://jsfiddle.net/Lcu6Lrv9/7/) seems to reproduce it fairly reliably. 

We have three dom elements: a container which is styled with 'position: fixed', a box with a background color, and a div with a background image that is scaled / positioned to be centered within our box. Often the background color of the box element that is *outside* of the bounding box of the image is colored incorrectly. The incorrect color seems to be a function of the original background color (e.g if our background color is blue the buggy color is orange). I've reproduced this using a background-image, an <img> tag, and with an inline SVG (though it seems to happen most consistently with the setup above.) I have also reproduced this bug with PNGs and SVGs so I don't think it's related to the image type. The most important aspect seems to be that the top level container element has 'positioned: fixed'.

This bug *only* manifests on non-retina displays. I have never reproduced it on a retina display. Usually opening the inspector or dragging the window around or anything that might cause a repaint causes the weird background color to fix itself.

The only workaround I have found so far is to use a pre-scaled image that is larger that the box element with transparent background, rather than scaling the image with CSS.
Comment 1 Trevor Rundell 2016-04-20 16:15:31 PDT
Created attachment 276862 [details]
The bug in a JSFiddle