Skip to content

Commit

Permalink
Wrong layout while animating content in regions
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=125086

Reviewed by David Hyatt.

Source/WebCore:

The region to layer and regions to layer mappings should be cleared when the region chain changes.

Test: fast/regions/layers/region-removed-during-animation.html

* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::invalidateRegions): Clear the two maps and flag them for recomputation.
(WebCore::RenderFlowThread::cachedRegionForCompositedLayer): Assert that the returned region exists.

LayoutTests:

Add a test verifying the layout and painting of animated content inside regions
is correct.

* fast/regions/layers/region-removed-during-animation-expected.html: Added.
* fast/regions/layers/region-removed-during-animation.html: Added.


Canonical link: https://commits.webkit.org/149006@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166495 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
abucur committed Mar 31, 2014
1 parent 4566181 commit 380668a
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 1 deletion.
13 changes: 13 additions & 0 deletions LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
2014-03-31 Andrei Bucur <abucur@adobe.com>

Wrong layout while animating content in regions
https://bugs.webkit.org/show_bug.cgi?id=125086

Reviewed by David Hyatt.

Add a test verifying the layout and painting of animated content inside regions
is correct.

* fast/regions/layers/region-removed-during-animation-expected.html: Added.
* fast/regions/layers/region-removed-during-animation.html: Added.

2014-03-30 Gyuyoung Kim <gyuyoung.kim@samsung.com>

Move test cases of navigator content utils in own directory
Expand Down
@@ -0,0 +1,19 @@
<html>
<head>
<style>
.content {
width: 100px;
height: 100px;
background-color: green;

position: relative;
left: 300px;
}
</style>
</head>
<body>
<p>Test for the bug <a href="https://bugs.webkit.org/show_bug.cgi?id=125086">125086</a>.</p>
<p>You should see a green square scaling down and back. During the animation, it should shift to the left.</p>
<div class="content"></div>
</body>
</html>
@@ -0,0 +1,60 @@
<html>
<head>
<style>
.region {
-webkit-flow-from: flow;
width: 100px;
}
.content {
-webkit-flow-into: flow;
width: 100px;
height: 100px;
background-color: green;

-webkit-animation-name: spin;
-webkit-animation-duration: 0.1s;
-webkit-animation-timing-function: linear;
}
@-webkit-keyframes spin {
from { -webkit-transform: rotateX(0deg); }
to { -webkit-transform: rotateX(180deg); }
}
</style>
</head>
<body>
<p>Test for the bug <a href="https://bugs.webkit.org/show_bug.cgi?id=125086">125086</a>.</p>
<p>You should see a green square scaling down and back. During the animation, it should shift to the left.</p>
<div id="region" class="region"></div>
<div id="content" class="content"></div>
<script type="text/javascript">
if (window.testRunner)
testRunner.waitUntilDone();

var r = document.getElementById("region");
function remover() {
document.body.removeChild(r);
setTimeout(adder, 20);
}

function adder() {
r.style.position = "relative";
r.style.left = "300px";
document.body.appendChild(r);
}

function animation_end() {
setTimeout(done, 50);
}

function done() {
if (window.testRunner)
testRunner.notifyDone();
}

var content = document.getElementById("content");
content.addEventListener("webkitAnimationEnd", animation_end, false);

setTimeout(remover, 20);
</script>
</body>
</html>
15 changes: 15 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,18 @@
2014-03-31 Andrei Bucur <abucur@adobe.com>

Wrong layout while animating content in regions
https://bugs.webkit.org/show_bug.cgi?id=125086

Reviewed by David Hyatt.

The region to layer and regions to layer mappings should be cleared when the region chain changes.

Test: fast/regions/layers/region-removed-during-animation.html

* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::invalidateRegions): Clear the two maps and flag them for recomputation.
(WebCore::RenderFlowThread::cachedRegionForCompositedLayer): Assert that the returned region exists.

2014-03-31 Dániel Bátyai <dbatyai.u-szeged@partner.samsung.com>

Remove hostThisRegister() and hostThisValue()
Expand Down
9 changes: 8 additions & 1 deletion Source/WebCore/rendering/RenderFlowThread.cpp
Expand Up @@ -120,6 +120,11 @@ void RenderFlowThread::invalidateRegions()
m_regionRangeMap.clear();
m_breakBeforeToRegionMap.clear();
m_breakAfterToRegionMap.clear();
if (m_layerToRegionMap)
m_layerToRegionMap->clear();
if (m_regionToLayerListMap)
m_regionToLayerListMap->clear();
m_layersToRegionMappingsDirty = true;
setNeedsLayout();

m_regionsInvalidated = true;
Expand Down Expand Up @@ -273,7 +278,9 @@ RenderNamedFlowFragment* RenderFlowThread::regionForCompositedLayer(RenderLayer&
RenderNamedFlowFragment* RenderFlowThread::cachedRegionForCompositedLayer(RenderLayer& childLayer) const
{
ASSERT(m_layerToRegionMap);
return m_layerToRegionMap->get(&childLayer);
RenderNamedFlowFragment* namedFlowFragment = m_layerToRegionMap->get(&childLayer);
ASSERT(!namedFlowFragment || m_regionList.contains(namedFlowFragment));
return namedFlowFragment;
}

void RenderFlowThread::updateLayerToRegionMappings(RenderLayer& layer, LayerToRegionMap& layerToRegionMap, RegionToLayerListMap& regionToLayerListMap, bool& needsLayerUpdate)
Expand Down

0 comments on commit 380668a

Please sign in to comment.