Source/WebCore: Fix repaint issue on "paints into ancestor" filtered layers

https://bugs.webkit.org/show_bug.cgi?id=120780

Reviewed by Tim Horton.

When a repaint happened on a layer with a filter, and which paints into
its compositing ancestor, we'd repaint the wrong layer (and assert).

Fix by ensuring that RenderLayer::enclosingFilterLayer() takes paintsIntoCompositedAncestor()
into account, by adding a function that we share between three callers who
check isComposited() && !paintsIntoCompositedAncestor(). I didn't use a function
on RenderLayer, because I wanted it to be inline but to not #include RenderLayerBacking
in RenderLayer.h.

Test: compositing/filters/opacity-change-on-filtered-paints-into-ancestor.html

* dom/Node.cpp: Drive-by removal of #include "RenderLayer.h"
* rendering/RenderLayer.cpp:
(WebCore::compositedWithOwnBackingStore):
(WebCore::RenderLayer::enclosingCompositingLayerForRepaint):
(WebCore::RenderLayer::enclosingFilterRepaintLayer):
(WebCore::RenderLayer::clippingRootForPainting):

LayoutTests: Fix repaint issue on "paints into ancestor" filtered layers
https://bugs.webkit.org/show_bug.cgi?id=120780
<rdar://problem/14884148>

Reviewed by Tim Horton.

Ref test for opacity change on a filtered layer which paints into its compositing ancestor.

* compositing/filters/opacity-change-on-filtered-paints-into-ancestor-expected.html: Added.
* compositing/filters/opacity-change-on-filtered-paints-into-ancestor.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155131 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ac5c6ad6
2013-09-05 Simon Fraser <simon.fraser@apple.com>
Fix repaint issue on "paints into ancestor" filtered layers
https://bugs.webkit.org/show_bug.cgi?id=120780
<rdar://problem/14884148>
Reviewed by Tim Horton.
Ref test for opacity change on a filtered layer which paints into its compositing ancestor.
* compositing/filters/opacity-change-on-filtered-paints-into-ancestor-expected.html: Added.
* compositing/filters/opacity-change-on-filtered-paints-into-ancestor.html: Added.
2013-09-05 Danilo Cesar Lemes de Paula <danilo.cesar@collabora.co.uk>
[GTK] improving tests expectations related to trackmenu
<!DOCTYPE html>
<html>
<head>
<style>
.container {
overflow: hidden;
position: absolute;
z-index: 1;
border: 1px solid black;
}
.composited {
-webkit-transform: translateZ(0);
}
.box {
width: 100px;
height: 100px;
margin: 10px;
background-color: blue;
}
.filtered {
-webkit-filter: blur(2px);
opacity: 0.8;
}
</style>
</head>
<body>
<div class="container">
<div class="filtered box"></div>
<div class="composited box"></div>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
.container {
overflow: hidden;
position: absolute;
z-index: 1;
border: 1px solid black;
}
.composited {
-webkit-transform: translateZ(0);
}
.box {
width: 100px;
height: 100px;
margin: 10px;
background-color: blue;
}
.filtered {
-webkit-filter: blur(2px);
opacity: 0.2;
}
.filtered.changed {
opacity: 0.8;
}
</style>
<script>
if (window.testRunner)
testRunner.waitUntilDone();
function doTest()
{
window.setTimeout(function() {
document.getElementById('target').classList.add('changed');
if (window.testRunner)
testRunner.notifyDone();
}, 0);
}
window.addEventListener('load', doTest, false);
</script>
</head>
<body>
<div class="container">
<div id="target" class="filtered box"></div>
<div class="composited box"></div>
</div>
</body>
</html>
2013-09-05 Simon Fraser <simon.fraser@apple.com>
Fix repaint issue on "paints into ancestor" filtered layers
https://bugs.webkit.org/show_bug.cgi?id=120780
Reviewed by Tim Horton.
When a repaint happened on a layer with a filter, and which paints into
its compositing ancestor, we'd repaint the wrong layer (and assert).
Fix by ensuring that RenderLayer::enclosingFilterLayer() takes paintsIntoCompositedAncestor()
into account, by adding a function that we share between three callers who
check isComposited() && !paintsIntoCompositedAncestor(). I didn't use a function
on RenderLayer, because I wanted it to be inline but to not #include RenderLayerBacking
in RenderLayer.h.
Test: compositing/filters/opacity-change-on-filtered-paints-into-ancestor.html
* dom/Node.cpp: Drive-by removal of #include "RenderLayer.h"
* rendering/RenderLayer.cpp:
(WebCore::compositedWithOwnBackingStore):
(WebCore::RenderLayer::enclosingCompositingLayerForRepaint):
(WebCore::RenderLayer::enclosingFilterRepaintLayer):
(WebCore::RenderLayer::clippingRootForPainting):
2013-09-05 Brent Fulgham <bfulgham@apple.com>
[Windows] Unreviewed build/link improvement after r155127 to be
......@@ -117,10 +117,6 @@
#include <wtf/text/CString.h>
#include <wtf/text/StringBuilder.h>
#ifndef NDEBUG
#include "RenderLayer.h"
#endif
#if ENABLE(GESTURE_EVENTS)
#include "GestureEvent.h"
#endif
......
......@@ -1417,6 +1417,11 @@ inline bool RenderLayer::shouldRepaintAfterLayout() const
#if USE(ACCELERATED_COMPOSITING)
static bool compositedWithOwnBackingStore(const RenderLayer* layer)
{
return layer->isComposited() && !layer->backing()->paintsIntoCompositedAncestor();
}
RenderLayer* RenderLayer::enclosingCompositingLayer(IncludeSelfOrNot includeSelf) const
{
if (includeSelf == IncludeSelf && isComposited())
......@@ -1436,7 +1441,7 @@ RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(IncludeSelfOrNot i
return const_cast<RenderLayer*>(this);
for (const RenderLayer* curr = compositingContainer(this); curr; curr = compositingContainer(curr)) {
if (curr->isComposited() && !curr->backing()->paintsIntoCompositedAncestor())
if (compositedWithOwnBackingStore(curr))
return const_cast<RenderLayer*>(curr);
}
......@@ -1461,7 +1466,7 @@ RenderLayer* RenderLayer::enclosingFilterLayer(IncludeSelfOrNot includeSelf) con
RenderLayer* RenderLayer::enclosingFilterRepaintLayer() const
{
for (const RenderLayer* curr = this; curr; curr = curr->parent()) {
if ((curr != this && curr->requiresFullLayerImageForFilters()) || curr->isComposited() || curr->isRootLayer())
if ((curr != this && curr->requiresFullLayerImageForFilters()) || compositedWithOwnBackingStore(curr) || curr->isRootLayer())
return const_cast<RenderLayer*>(curr);
}
return 0;
......@@ -1528,7 +1533,7 @@ bool RenderLayer::hasAncestorWithFilterOutsets() const
}
#endif
RenderLayer* RenderLayer::clippingRootForPainting() const
{
#if USE(ACCELERATED_COMPOSITING)
......@@ -1545,7 +1550,7 @@ RenderLayer* RenderLayer::clippingRootForPainting() const
ASSERT(current);
if (current->transform()
#if USE(ACCELERATED_COMPOSITING)
|| (current->isComposited() && !current->backing()->paintsIntoCompositedAncestor())
|| compositedWithOwnBackingStore(current)
#endif
)
return const_cast<RenderLayer*>(current);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment