-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Content-visibility][repaint] Boxes with "content-visibility: hidden"…
… lingers around https://bugs.webkit.org/show_bug.cgi?id=264173 Reviewed by Simon Fraser. When skipped content becomes hidden, a repaint should be issued to clear it, before the style change is processed. Add repaint logic for that similar to what is done when the visibility property changes to hidden on an element. However, absolute positioned elements are not always repainted correctly when hidden and the container changes. First, after layout repaints will have no effect since it is skipped for layers with hidden content. For the repaint before style change, the newly calculated clipped overflow rectangle can be empty, causing the artefact. Fix this by always using the cached clipped overflow ("old") rectangle for out of flow elements, if it is available, in before style change repainting. * LayoutTests/fast/repaint/content-visibility-hidden-container-with-abs-pos-c-v-auto-child-expected.txt: Added. * LayoutTests/fast/repaint/content-visibility-hidden-container-with-abs-pos-c-v-auto-child.html: Added. * LayoutTests/fast/repaint/content-visibility-hidden-container-with-abs-pos-child-expected.txt: Added. * LayoutTests/fast/repaint/content-visibility-hidden-container-with-abs-pos-child.html: Added. * LayoutTests/fast/repaint/position-relative-container-with-abs-pos-child-expected.txt: Added. * LayoutTests/fast/repaint/position-relative-container-with-abs-pos-child.html: Added. * Source/WebCore/rendering/RenderElement.cpp: (WebCore::RenderElement::repaintBeforeStyleChange): (WebCore::RenderElement::styleWillChange): Canonical link: https://commits.webkit.org/273602@main
- Loading branch information
Showing
7 changed files
with
159 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
...fast/repaint/content-visibility-hidden-container-with-abs-pos-c-v-auto-child-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
PASS window.internals.repaintRectsAsText().indexOf('50 50') is not -1 | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
43 changes: 43 additions & 0 deletions
43
...utTests/fast/repaint/content-visibility-hidden-container-with-abs-pos-c-v-auto-child.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<script>jsTestIsAsync = true;</script> | ||
<script src="../../resources/js-test-pre.js"></script> | ||
<head> | ||
<title>This tests that we don't leave bits behind, when an absolute positioned content-visibility: auto child is hidden due to content-visibility: hidden.</title> | ||
<style> | ||
#container { | ||
height: 100px; | ||
width: 100px; | ||
} | ||
|
||
#content { | ||
position: absolute; | ||
height: 50px; | ||
width: 50px; | ||
background: green; | ||
content-visibility: auto; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id=container> | ||
<div id=content></div> | ||
</div> | ||
<script> | ||
setTimeout( | ||
function() { | ||
if (window.internals) | ||
internals.startTrackingRepaints(); | ||
document.getElementById("container").style.contentVisibility = "hidden"; | ||
document.body.offsetWidth; | ||
|
||
if (window.internals) { | ||
shouldNotBe("window.internals.repaintRectsAsText().indexOf('50 50')", "-1"); | ||
internals.stopTrackingRepaints(); | ||
} | ||
finishJSTest(); | ||
}, 0); | ||
</script> | ||
</body> | ||
<script src="../../resources/js-test-post.js"></script> | ||
</html> |
5 changes: 5 additions & 0 deletions
5
LayoutTests/fast/repaint/content-visibility-hidden-container-with-abs-pos-child-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
PASS window.internals.repaintRectsAsText().indexOf('50 50') is not -1 | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
42 changes: 42 additions & 0 deletions
42
LayoutTests/fast/repaint/content-visibility-hidden-container-with-abs-pos-child.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<script>jsTestIsAsync = true;</script> | ||
<script src="../../resources/js-test-pre.js"></script> | ||
<head> | ||
<title>This tests that we don't leave bits behind, when an absolute positioned child is hidden due to content-visibility: hidden.</title> | ||
<style> | ||
#container { | ||
height: 100px; | ||
width: 100px; | ||
} | ||
|
||
#content { | ||
position: absolute; | ||
height: 50px; | ||
width: 50px; | ||
background: green; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id=container> | ||
<div id=content></div> | ||
</div> | ||
<script> | ||
setTimeout( | ||
function() { | ||
if (window.internals) | ||
internals.startTrackingRepaints(); | ||
document.getElementById("container").style.contentVisibility = "hidden"; | ||
document.body.offsetWidth; | ||
|
||
if (window.internals) { | ||
shouldNotBe("window.internals.repaintRectsAsText().indexOf('50 50')", "-1"); | ||
internals.stopTrackingRepaints(); | ||
} | ||
finishJSTest(); | ||
}, 0); | ||
</script> | ||
</body> | ||
<script src="../../resources/js-test-post.js"></script> | ||
</html> |
5 changes: 5 additions & 0 deletions
5
LayoutTests/fast/repaint/position-relative-container-with-abs-pos-child-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
PASS window.internals.repaintRectsAsText().indexOf('0 0 50 50') is not -1 | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
45 changes: 45 additions & 0 deletions
45
LayoutTests/fast/repaint/position-relative-container-with-abs-pos-child.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<script>jsTestIsAsync = true;</script> | ||
<script src="../../resources/js-test-pre.js"></script> | ||
<head> | ||
<title>This tests that we don't leave bits behind, when an absolute positioned child is hidden and at the same time is positioned against a different container.</title> | ||
<style> | ||
#container { | ||
height: 100px; | ||
width: 100px; | ||
} | ||
|
||
#content { | ||
position: absolute; | ||
height: 50px; | ||
width: 50px; | ||
left: 0px; | ||
top: 0px; | ||
background: green; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id=container> | ||
<div id=content></div> | ||
</div> | ||
<script> | ||
setTimeout( | ||
function() { | ||
if (window.internals) | ||
internals.startTrackingRepaints(); | ||
document.getElementById("container").style.position = "relative"; | ||
document.getElementById("content").style.visibility = "hidden"; | ||
document.body.offsetWidth; | ||
|
||
if (window.internals) { | ||
shouldNotBe("window.internals.repaintRectsAsText().indexOf('0 0 50 50')", "-1"); | ||
internals.stopTrackingRepaints(); | ||
} | ||
finishJSTest(); | ||
}, 0); | ||
</script> | ||
</body> | ||
<script src="../../resources/js-test-post.js"></script> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters