2011-03-22 Simon Fraser <simon.fraser@apple.com>
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Mar 2011 23:17:23 +0000 (23:17 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Mar 2011 23:17:23 +0000 (23:17 +0000)
commit35efa5a32316911eab032d975da9b0c693217b2e
treec7e98b387967e5e6d8c932c74908dae8ab8d9bea
parent09a74b17797e75c968842a1c41a42b03799422f9
2011-03-22  Simon Fraser  <simon.fraser@apple.com>

        Reviewed by Beth Dakin.

        Incorrect rendering of composited element with negative z-index child
        https://bugs.webkit.org/show_bug.cgi?id=56846

        When a composited element has a child with negative z-index, we make
        a separate layer for that element's foreground content. This layer
        was positioned incorrectly (but the content happened to paint at
        the right location), resulting in right/bottom clipping.

        Fix this, remove the little-used graphicsLayerToContentsCoordinates()
        contentsToGraphicsLayerCoordinates() methods, and optimize incremental
        repaints in the foreground and mask layers.

        Tests: compositing/geometry/foreground-layer.html
               compositing/geometry/repaint-foreground-layer.html

        * platform/graphics/ca/GraphicsLayerCA.cpp:
        (WebCore::GraphicsLayerCA::setNeedsDisplayInRect): Cull repaints
        which fall outside the layer bounds, so callers don't have to,
        and to avoid unnecessary layer commits.

        * rendering/RenderLayerBacking.cpp:
        (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): If
        we have a foreground layer inside a clipping layer, the foreground
        layer's offset is zero, since the clipping layer is its parent.

        (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect): Use
        offsetFromRenderer() directly instead of contentsToGraphicsLayerCoordinates().
        Also do incremental repaints of the foreground and mask layers.

        (WebCore::RenderLayerBacking::paintContents): It was incorrect to always
        use compositedBounds() to compute the painting offset, since that's
        per-RenderLayerBacking, but a single RenderLayerBacking can have different
        GraphicsLayers with different offsets (e.g. the foreground layer).
        Instead, use offsetFromRenderer(), which gives has the correct offset.

        * rendering/RenderLayerBacking.h: Remove unused methods.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@81715 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
LayoutTests/ChangeLog
LayoutTests/compositing/geometry/foreground-layer-expected.txt [new file with mode: 0644]
LayoutTests/compositing/geometry/foreground-layer.html [new file with mode: 0644]
LayoutTests/compositing/geometry/repaint-foreground-layer-expected.txt [new file with mode: 0644]
LayoutTests/compositing/geometry/repaint-foreground-layer.html [new file with mode: 0644]
LayoutTests/platform/mac/compositing/geometry/foreground-layer-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/compositing/geometry/foreground-layer-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/compositing/geometry/repaint-foreground-layer-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/compositing/geometry/repaint-foreground-layer-expected.png [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderLayerBacking.h