Commit 94a0c238 authored by trchen@chromium.org's avatar trchen@chromium.org

Non-composited scrolling div should invalidate when it has descendant paints to its backing

This CL fixes a bug that non-composited scrolling div forgets to invalidate
because the div believed all its descandants are composited, when actually
some descendants paints to ancestor backing although composited.

BUG=401047

Review URL: https://codereview.chromium.org/460883002

git-svn-id: svn://svn.chromium.org/blink/trunk@180309 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 2f124b2c
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
"bounds": [200, 200], "bounds": [200, 200],
"drawsContent": true, "drawsContent": true,
"repaintRects": [ "repaintRects": [
[0, 0, 200, 200],
[0, 0, 200, 200], [0, 0, 200, 200],
[0, 0, 200, 200] [0, 0, 200, 200]
] ]
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
"drawsContent": true, "drawsContent": true,
"backgroundColor": "#ADD8E6", "backgroundColor": "#ADD8E6",
"repaintRects": [ "repaintRects": [
[0, 0, 200, 200],
[0, 0, 200, 200], [0, 0, 200, 200],
[0, 0, 200, 200] [0, 0, 200, 200]
] ]
......
...@@ -70,7 +70,6 @@ CASE 2, scrolling y to 80, new layers will be squashed, so things repaint: ...@@ -70,7 +70,6 @@ CASE 2, scrolling y to 80, new layers will be squashed, so things repaint:
"drawsContent": true, "drawsContent": true,
"backgroundColor": "#00FFFF", "backgroundColor": "#00FFFF",
"repaintRects": [ "repaintRects": [
[0, 0, 200, 100],
[0, 0, 200, 100] [0, 0, 200, 100]
] ]
}, },
...@@ -158,7 +157,6 @@ CASE 4, scrolling y to 170 new layers will be squashed, so things repaint: ...@@ -158,7 +157,6 @@ CASE 4, scrolling y to 170 new layers will be squashed, so things repaint:
"drawsContent": true, "drawsContent": true,
"backgroundColor": "#00FF00", "backgroundColor": "#00FF00",
"repaintRects": [ "repaintRects": [
[0, 0, 200, 100],
[0, 0, 200, 100] [0, 0, 200, 100]
] ]
}, },
......
<!DOCTYPE html>
<style>
#container {
overflow: scroll;
width: 400px;
height: 300px;
background: linear-gradient(black, white);
background-attachment: local;
}
#bloat {
height: 1000px;
}
</style>
<div id="container">
<div id="bloat"></div>
</div>
<script>
document.getElementById('container').scrollTop = 1000;
</script>
<!DOCTYPE html>
<style>
#container {
overflow: scroll;
width: 400px;
height: 300px;
background: linear-gradient(black, white);
background-attachment: local;
}
#bloat {
height: 1000px;
transform: translateZ(0);
}
</style>
<div id="container">
<div id="bloat"></div>
</div>
<script>
if (window.testRunner) {
testRunner.waitUntilDone();
testRunner.displayAsyncThen(function() {
document.getElementById('container').scrollTop = 1000;
testRunner.notifyDone();
});
}
</script>
<!DOCTYPE html>
<style>
#container {
overflow: scroll;
width: 400px;
height: 300px;
}
#clipping {
height: 1000px;
}
#clipped {
height: 10px;
border: solid 1px black;
}
</style>
<div id="container">
<div id="clipping">
<div>Lorem ipsum</div>
<div id="clipped"></div>
</div>
</div>
<script>
document.getElementById('container').scrollTop = 1000;
</script>
<!DOCTYPE html>
<style>
#container {
overflow: scroll;
width: 400px;
height: 300px;
}
#clipping {
overflow: hidden;
height: 1000px;
position: relative;
z-index: 0;
}
#clipped {
height: 10px;
border: solid 1px black;
transform: translateZ(0);
}
</style>
<div id="container">
<div id="clipping">
<div>Lorem ipsum</div>
<div id="clipped"></div>
</div>
</div>
<script>
if (window.testRunner) {
testRunner.waitUntilDone();
testRunner.displayAsyncThen(function() {
document.getElementById('container').scrollTop = 1000;
testRunner.notifyDone();
});
}
</script>
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
"drawsContent": true, "drawsContent": true,
"backgroundColor": "#ADD8E6", "backgroundColor": "#ADD8E6",
"repaintRects": [ "repaintRects": [
[0, 0, 200, 200],
[0, 0, 200, 200], [0, 0, 200, 200],
[0, 0, 200, 200] [0, 0, 200, 200]
] ]
......
...@@ -629,7 +629,7 @@ void RenderLayer::updateScrollingStateAfterCompositingChange() ...@@ -629,7 +629,7 @@ void RenderLayer::updateScrollingStateAfterCompositingChange()
m_hasNonCompositedChild = false; m_hasNonCompositedChild = false;
for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) { for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) {
if (child->compositingState() == NotComposited) { if (child->compositingState() == NotComposited || child->compositingState() == HasOwnBackingButPaintsIntoAncestor) {
m_hasNonCompositedChild = true; m_hasNonCompositedChild = true;
return; return;
} }
......
...@@ -388,7 +388,8 @@ void RenderLayerScrollableArea::setScrollOffset(const IntPoint& newScrollOffset) ...@@ -388,7 +388,8 @@ void RenderLayerScrollableArea::setScrollOffset(const IntPoint& newScrollOffset)
bool onlyScrolledCompositedLayers = scrollsOverflow() bool onlyScrolledCompositedLayers = scrollsOverflow()
&& !layer()->hasVisibleNonLayerContent() && !layer()->hasVisibleNonLayerContent()
&& !layer()->hasNonCompositedChild() && !layer()->hasNonCompositedChild()
&& !layer()->hasBlockSelectionGapBounds(); && !layer()->hasBlockSelectionGapBounds()
&& box().style()->backgroundLayers().attachment() != LocalBackgroundAttachment;
if (usesCompositedScrolling() || onlyScrolledCompositedLayers) if (usesCompositedScrolling() || onlyScrolledCompositedLayers)
requiresRepaint = false; requiresRepaint = false;
......
...@@ -161,8 +161,8 @@ CompositedLayerMapping::CompositedLayerMapping(RenderLayer& layer) ...@@ -161,8 +161,8 @@ CompositedLayerMapping::CompositedLayerMapping(RenderLayer& layer)
: m_owningLayer(layer) : m_owningLayer(layer)
, m_pendingUpdateScope(GraphicsLayerUpdateNone) , m_pendingUpdateScope(GraphicsLayerUpdateNone)
, m_isMainFrameRenderViewLayer(false) , m_isMainFrameRenderViewLayer(false)
, m_requiresOwnBackingStoreForIntrinsicReasons(true) , m_requiresOwnBackingStoreForIntrinsicReasons(false)
, m_requiresOwnBackingStoreForAncestorReasons(true) , m_requiresOwnBackingStoreForAncestorReasons(false)
, m_backgroundLayerPaintsFixedRootBackground(false) , m_backgroundLayerPaintsFixedRootBackground(false)
, m_scrollingContentsAreEmpty(false) , m_scrollingContentsAreEmpty(false)
{ {
......
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