Like in http://techcrunch.com, a out-of-viewport fixed positioned element with negative z-index makes the whole page composited, even the element is never visible, causing unnecessary layer compositings. Should check if the fixed element is visible when determining if it should be composited. This avoids the problem of excessive repaints which still needs to be investigated and resolved. Experiments on chromium-linux showed that with the checking, the number of layers of http://techcrunch.com reduced from about 100 to 0. Experiments on chromium-android showed the number of layers reduced from 31 (including 3 fullscreen layers) to only 5~6. (http://techcrunch.com returns different pages for chromium-linux and chromium-android)
Created attachment 126202 [details] patch for preview (missing test)
Comment on attachment 126202 [details] patch for preview (missing test) This is a nice find. For testing, I'd recommend use the layerTreeAsText() hook to make sure that we aren't making GraphicsLayers that we don't need to.
Created attachment 126418 [details] patch with layout test
Comment on attachment 126418 [details] patch with layout test Great! R=me
Comment on attachment 126418 [details] patch with layout test Clearing flags on attachment: 126418 Committed r107364: <http://trac.webkit.org/changeset/107364>
All reviewed patches have been landed. Closing bug.
Changed title to be more accurate.
There's a problem with this strategy, when combined with zooming;when zoomed in, we may consider a fixed element to be outside the viewport, and not composite it. However, zooming may bring that element back into the viewport, but if it doesn't have a layer yet, it won't be visible while zooming.
(In reply to comment #8) > There's a problem with this strategy, when combined with zooming;when zoomed in, we may consider a fixed element to be outside the viewport, and not composite it. However, zooming may bring that element back into the viewport, but if it doesn't have a layer yet, it won't be visible while zooming. Thanks for the finding. Filed bug 105202.