[CSS Blending] Isolation descendant dependent flags are not updated correctly
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Apr 2014 08:42:53 +0000 (08:42 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Apr 2014 08:42:53 +0000 (08:42 +0000)
commita238b8a0c39ec7d7ffc39e4dab3523ead46a8045
tree97368367634186b3d789f91b24b202a0cbf0500d
parentf6987f1637927485e09beab95762cbe16bf7fbe0
[CSS Blending] Isolation descendant dependent flags are not updated correctly
https://bugs.webkit.org/show_bug.cgi?id=130892

Patch by Ion Rosca <rosca@adobe.com> on 2014-04-17
Reviewed by Dean Jackson.

Source/WebCore:
The isolation descendant dependent flag (m_hasUnisolatedBlendingDescendants)
will help us to determine if a layer should isolate blending descendants or not.
The m_hasUnisolatedBlendingDescendants flag should be set for layers that have blending descendant layers
not isolated by descendant stacking contexts.
An element isolatesBlending() if it has this flag set and creates stacking context.

Tests: css3/compositing/blend-mode-isolation-flags-append-non-stacking-context-blending.html
       css3/compositing/blend-mode-isolation-flags-append-stacking-context-blending.html
       css3/compositing/blend-mode-isolation-flags-remove-non-stacking-context-blending.html
       css3/compositing/blend-mode-isolation-flags-remove-stacking-context-blending.html
       css3/compositing/blend-mode-isolation-flags-turn-off-blending-no-isolation.html
       css3/compositing/blend-mode-isolation-flags-turn-off-blending.html
       css3/compositing/blend-mode-isolation-flags-turn-off-stacking-context.html
       css3/compositing/blend-mode-isolation-flags-turn-on-blending.html
       css3/compositing/blend-mode-isolation-flags-turn-on-stacking-context.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::RenderLayer):
(WebCore::RenderLayer::updateBlendMode):
(WebCore::RenderLayer::updateAncestorChainHasBlendingDescendants):
    When a layer has blending and it hasn't had it before, we set the isolation
flag for all its ancestors up to the first layer creating stacking context.
I removed the isComposited() check here. Isolation flags should be correct regardless
of compositing state. Moreover, if this method is called from styleChanged(),
the compositing state might not be accurate, it's going to be recalculated afterwards.
(WebCore::RenderLayer::dirtyAncestorChainHasBlendingDescendants):
    When a layer doesn't have blending, but it used to have it before, we mark
the isolation flag as dirty for all its ancestors up to the first layer
creating stacking context. The isolation flags will be recalculated by
RenderLayer::updateDescendantDependentFlags.
(WebCore::RenderLayer::updateDescendantDependentFlags):
    Evaluates if the layer has unisolated blending descendants by traversing
the layer subtree.
(WebCore::RenderLayer::addChild):
    When adding a subtree that has blending or has some unisolated descendants,
we set the flag for all the ancestors, up to the stacking context layer.
(WebCore::RenderLayer::removeChild):
    When removing a subtree that had blending or had some unisolated descendants,
we dirty the flag so that it could be reevaluated.
(WebCore::RenderLayer::calculateClipRects):
(WebCore::RenderLayer::updateTransform):
* rendering/RenderLayer.h:
    Rename m_hasBlendedElementInChildStackingContext => m_hasUnisolatedBlendingDescendants
and m_hasBlendedElementInChildStackingContextStatusDirty => m_hasUnisolatedBlendingDescendantsStatusDirty,
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::computeCompositingRequirements):
    Add an assert to make sure that if m_hasUnisolatedCompositedBlendingDescendants is true,
then m_hasUnisolatedBlendingDescendants is true as well.

LayoutTests:
* css3/compositing/blend-mode-isolation-flags-append-non-stacking-context-blending.html: Added.
* css3/compositing/blend-mode-isolation-flags-append-stacking-context-blending.html: Added.
* css3/compositing/blend-mode-isolation-flags-remove-non-stacking-context-blending.html: Added.
* css3/compositing/blend-mode-isolation-flags-remove-stacking-context-blending.html: Added.
* css3/compositing/blend-mode-isolation-flags-turn-off-blending-no-isolation.html: Added.
* css3/compositing/blend-mode-isolation-flags-turn-off-blending.html: Added.
* css3/compositing/blend-mode-isolation-flags-turn-off-stacking-context.html: Added.
* css3/compositing/blend-mode-isolation-flags-turn-on-blending.html: Added.
* css3/compositing/blend-mode-isolation-flags-turn-on-stacking-context.html: Added.
* platform/mac/css3/compositing/blend-mode-background-expected.txt:
* platform/mac/css3/compositing/blend-mode-isolated-group-1-expected.txt:
* platform/mac/css3/compositing/blend-mode-isolated-group-2-expected.txt:
* platform/mac/css3/compositing/blend-mode-isolated-group-3-expected.txt:
* platform/mac/css3/compositing/blend-mode-isolation-flags-append-non-stacking-context-blending-expected.txt: Added.
* platform/mac/css3/compositing/blend-mode-isolation-flags-append-stacking-context-blending-expected.txt: Added.
* platform/mac/css3/compositing/blend-mode-isolation-flags-remove-non-stacking-context-blending-expected.txt: Added.
* platform/mac/css3/compositing/blend-mode-isolation-flags-remove-stacking-context-blending-expected.txt: Added.
* platform/mac/css3/compositing/blend-mode-isolation-flags-turn-off-blending-expected.txt: Added.
* platform/mac/css3/compositing/blend-mode-isolation-flags-turn-off-blending-no-isolation-expected.txt: Added.
* platform/mac/css3/compositing/blend-mode-isolation-flags-turn-off-stacking-context-expected.txt: Added.
* platform/mac/css3/compositing/blend-mode-isolation-flags-turn-on-blending-expected.txt: Added.
* platform/mac/css3/compositing/blend-mode-isolation-flags-turn-on-stacking-context-expected.txt: Added.
* platform/mac/css3/compositing/blend-mode-layers-expected.txt:
* platform/mac/css3/compositing/blend-mode-reflection-expected.txt:
* platform/mac/css3/compositing/blend-mode-simple-composited-expected.txt:
* platform/mac/css3/compositing/blend-mode-simple-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167424 268f45cc-cd09-0410-ab3c-d52691b4dbfc
31 files changed:
LayoutTests/ChangeLog
LayoutTests/css3/compositing/blend-mode-isolation-flags-append-non-stacking-context-blending.html [new file with mode: 0644]
LayoutTests/css3/compositing/blend-mode-isolation-flags-append-stacking-context-blending.html [new file with mode: 0644]
LayoutTests/css3/compositing/blend-mode-isolation-flags-remove-non-stacking-context-blending.html [new file with mode: 0644]
LayoutTests/css3/compositing/blend-mode-isolation-flags-remove-stacking-context-blending.html [new file with mode: 0644]
LayoutTests/css3/compositing/blend-mode-isolation-flags-turn-off-blending-no-isolation.html [new file with mode: 0644]
LayoutTests/css3/compositing/blend-mode-isolation-flags-turn-off-blending.html [new file with mode: 0644]
LayoutTests/css3/compositing/blend-mode-isolation-flags-turn-off-stacking-context.html [new file with mode: 0644]
LayoutTests/css3/compositing/blend-mode-isolation-flags-turn-on-blending.html [new file with mode: 0644]
LayoutTests/css3/compositing/blend-mode-isolation-flags-turn-on-stacking-context.html [new file with mode: 0644]
LayoutTests/platform/mac/css3/compositing/blend-mode-background-expected.txt
LayoutTests/platform/mac/css3/compositing/blend-mode-isolated-group-1-expected.txt
LayoutTests/platform/mac/css3/compositing/blend-mode-isolated-group-2-expected.txt
LayoutTests/platform/mac/css3/compositing/blend-mode-isolated-group-3-expected.txt
LayoutTests/platform/mac/css3/compositing/blend-mode-isolation-flags-append-non-stacking-context-blending-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/css3/compositing/blend-mode-isolation-flags-append-stacking-context-blending-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/css3/compositing/blend-mode-isolation-flags-remove-non-stacking-context-blending-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/css3/compositing/blend-mode-isolation-flags-remove-stacking-context-blending-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/css3/compositing/blend-mode-isolation-flags-turn-off-blending-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/css3/compositing/blend-mode-isolation-flags-turn-off-blending-no-isolation-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/css3/compositing/blend-mode-isolation-flags-turn-off-stacking-context-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/css3/compositing/blend-mode-isolation-flags-turn-on-blending-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/css3/compositing/blend-mode-isolation-flags-turn-on-stacking-context-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/css3/compositing/blend-mode-layers-expected.txt
LayoutTests/platform/mac/css3/compositing/blend-mode-reflection-expected.txt
LayoutTests/platform/mac/css3/compositing/blend-mode-simple-composited-expected.txt
LayoutTests/platform/mac/css3/compositing/blend-mode-simple-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayer.h
Source/WebCore/rendering/RenderLayerCompositor.cpp