position:fixed that doesn't render any content should not force compositing
https://bugs.webkit.org/show_bug.cgi?id=108112

Source/WebCore:

Reviewed by Beth Dakin.

It's not uncommon for pages to have position:fixed elements with no content.
When these are behind other elements, they can cause those other elements
to become composited, using lots of backing store memory.

Optimize for the case where the position:fixed element has no rendered
content and no children by not making it composited in that case.

Test: compositing/layer-creation/fixed-position-no-content.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::hasNonEmptyChildRenderers): Moved from RenderLayerBacking.cpp.
(WebCore::hasBoxDecorations): Ditto.
(WebCore::RenderLayer::hasBoxDecorationsOrBackground): Ditto.
(WebCore::RenderLayer::hasVisibleBoxDecorations): Check for visibility:visible, box decorations and
overflow controls.
(WebCore::RenderLayer::isVisuallyNonEmpty): Returns true if this layer has some visible
representation.
* rendering/RenderLayer.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateGraphicsLayerConfiguration): Need to call updateDescendantDependentFlags()
to ensure that the visibility flags are up to date.
(WebCore::RenderLayerBacking::updateDrawsContent): Call RenderLayer::hasBoxDecorationsOrBackground() now.
(WebCore::RenderLayerBacking::paintsBoxDecorations): Call RenderLayer::hasVisibleBoxDecorations() now.
(WebCore::RenderLayerBacking::paintsChildren): Call RenderLayer::hasNonEmptyChildRenderers().
(WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer): Whitespace.
(WebCore::RenderLayerBacking::containsPaintedContent): Call RenderLayer::hasBoxDecorationsOrBackground().
(WebCore::RenderLayerBacking::isDirectlyCompositedImage): Ditto.
* rendering/RenderLayerBacking.h:
(RenderLayerBacking):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::requiresCompositingForPosition): If the layer has no content to paint,
or visible descendant layers, then don't make it composited.

LayoutTests:

Reviewed by Beth Dakin.

Change tests to put a background color on position:fixed elements that need to be composited.
New test with an empty fixed position element.

* compositing/layer-creation/fixed-position-change-out-of-view-in-view.html:
* compositing/layer-creation/fixed-position-no-content-expected.txt: Added.
* compositing/layer-creation/fixed-position-no-content.html: Copied from LayoutTests/compositing/layer-creation/fixed-position-out-of-view.html.
* compositing/layer-creation/fixed-position-out-of-view-scaled-scroll.html:
* compositing/layer-creation/fixed-position-out-of-view-scaled.html:
* compositing/layer-creation/fixed-position-out-of-view.html:
* platform/mac/tiled-drawing/fixed/fixed-position-out-of-view-negative-zindex.html:
* platform/mac/tiled-drawing/fixed/fixed-position-out-of-view.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@141039 268f45cc-cd09-0410-ab3c-d52691b4dbfc