Skip to content

Commit

Permalink
[CSS Regions] Elements using transforms are not repainted correctly w…
Browse files Browse the repository at this point in the history
…hen rendered in a region

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

Reviewed by David Hyatt.

Source/WebCore:

When the page is composited, all the elements will have a composited repaint container. In that case we will
never catch the repaints in the RenderFlowThread, but they will go directly to the RenderView.
There's a single case when the parent composited layer of an element inside the RenderFlowThread will get
its own repaints. That case only happens when the parent composited layer is also part of the same flow thread.
Right now compositing is disabled for elements inside the RenderFlowThread, so that case doesn't even happen yet.
That will be fixed in https://bugs.webkit.org/show_bug.cgi?id=84900.

Test: fast/repaint/region-painting-in-composited-view.html

* rendering/RenderObject.cpp:
(WebCore::RenderObject::containerForRepaint):

LayoutTests:

Added test file to check for repainting inside a RenderFlowThread when the page is in composited mode.

* fast/repaint/region-painting-in-composited-view-expected.html: Added.
* fast/repaint/region-painting-in-composited-view.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@135921 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
[email protected] committed Nov 27, 2012
1 parent 4ebfa13 commit a62ca72
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 5 deletions.
12 changes: 12 additions & 0 deletions LayoutTests/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
2012-11-27 Alexandru Chiculita <[email protected]>

[CSS Regions] Elements using transforms are not repainted correctly when rendered in a region
https://bugs.webkit.org/show_bug.cgi?id=102826

Reviewed by David Hyatt.

Added test file to check for repainting inside a RenderFlowThread when the page is in composited mode.

* fast/repaint/region-painting-in-composited-view-expected.html: Added.
* fast/repaint/region-painting-in-composited-view.html: Added.

2012-11-27 Tony Chang <[email protected]>

Unreviewed, updating TestExpectations after input slider change.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!doctype html>
<head>
<title>Test for https://bugs.webkit.org/show_bug.cgi?id=102826</title>
<style type="text/css">
#region1, #region2 {
position: absolute;
top: 0px;
left: 0px;
width: 100px;
height: 50px;
}

#region1 {
left: 120px;
background-color: red;
/* We need a composited layer, to make the output
exactly the same as the test file. */
-webkit-transform: translate3d(0,0,0);
}

#region2 {
background-color: green;
}

</style>
<script src="resources/repaint.js" type="text/javascript"></script>
<script>
function repaintTest()
{
// Using the same repaint behavior, so that we get the same repaint area.
document.getElementById('region1').style.backgroundColor = 'green';
}
</script>
</head>
<body onload="runRepaintTest();">
<div id="region1"></div>
<div id="region2"></div>
</body>
</html>
58 changes: 58 additions & 0 deletions LayoutTests/fast/repaint/region-painting-in-composited-view.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<!doctype html>
<head>
<title>Test for https://bugs.webkit.org/show_bug.cgi?id=102826</title>
<script>
if (window.testRunner)
window.testRunner.overridePreference("WebKitCSSRegionsEnabled", "1");
</script>
<style type="text/css">
#content {
-webkit-flow-into: flow1;
}

#target {
background: red;
width: 100px;
height: 50px;
}

#region1, #region2 {
position: absolute;
top: 0px;
width: 100px;
height: 50px;
-webkit-flow-from: flow1;
}

#region1 {
/* Make sure that the content of the first region will display in a totally
different place than it would have been displayed if regions were not used. */
left: 120px;
/* Force the composited mode on the current page. */
-webkit-transform: translate3d(0,0,0);
}

#region2 {
left: 0px;
background-color: green;
}

</style>
<script src="resources/repaint.js" type="text/javascript"></script>
<script>
function repaintTest()
{
document.getElementById('target').style.backgroundColor = 'green';
}
</script>
</head>
<body onload="runRepaintTest();">
<!-- Testing that the repaint goes through the RenderRegions and not
directly to the viewport. You should see two green rectangles. -->
<div id="content">
<div id="target"></div>
</div>
<div id="region1"></div>
<div id="region2"></div>
</body>
</html>
19 changes: 19 additions & 0 deletions Source/WebCore/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
2012-11-27 Alexandru Chiculita <[email protected]>

[CSS Regions] Elements using transforms are not repainted correctly when rendered in a region
https://bugs.webkit.org/show_bug.cgi?id=102826

Reviewed by David Hyatt.

When the page is composited, all the elements will have a composited repaint container. In that case we will
never catch the repaints in the RenderFlowThread, but they will go directly to the RenderView.
There's a single case when the parent composited layer of an element inside the RenderFlowThread will get
its own repaints. That case only happens when the parent composited layer is also part of the same flow thread.
Right now compositing is disabled for elements inside the RenderFlowThread, so that case doesn't even happen yet.
That will be fixed in https://bugs.webkit.org/show_bug.cgi?id=84900.

Test: fast/repaint/region-painting-in-composited-view.html

* rendering/RenderObject.cpp:
(WebCore::RenderObject::containerForRepaint):

2012-11-27 Tony Chang <[email protected]>

Unreviewed, win compile fix take 2.
Expand Down
13 changes: 8 additions & 5 deletions Source/WebCore/rendering/RenderObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1290,12 +1290,15 @@ RenderLayerModelObject* RenderObject::containerForRepaint() const
#endif

// If we have a flow thread, then we need to do individual repaints within the RenderRegions instead.
// Return the flow thread as a repaint container in order to create a chokepoint that allows us to change
// Return the flow thread as a repaint container in order to create a checkpoint that allows us to change
// repainting to do individual region repaints.
// FIXME: Composited layers inside a flow thread will bypass this mechanism and will malfunction. It's not
// clear how to address this problem for composited descendants of a RenderFlowThread.
if (!repaintContainer && inRenderFlowThread())
repaintContainer = enclosingRenderFlowThread();
if (inRenderFlowThread()) {
RenderFlowThread* parentRenderFlowThread = enclosingRenderFlowThread();
// If we have already found a repaint container then we will repaint into that container only if it is part of the same
// flow thread. Otherwise we will need to catch the repaint call and send it to the flow thread.
if (!(repaintContainer && repaintContainer->inRenderFlowThread() && repaintContainer->enclosingRenderFlowThread() == parentRenderFlowThread))
repaintContainer = parentRenderFlowThread;
}
return repaintContainer;
}

Expand Down

0 comments on commit a62ca72

Please sign in to comment.