Full invalidate <img> on resize

Because <img> scale its contents on resize, incremental invalidation
doesn't apply to it. Force full invalidate if the image content is
resized during layout.

BUG=397939
TEST=fast/repaint/image-resize.html
TEST=fast/repaint/percent-size-image-resize-container.html

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

git-svn-id: svn://svn.chromium.org/blink/trunk@180015 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent d760f18d
{
"bounds": [800, 600],
"children": [
{
"bounds": [800, 600],
"contentsOpaque": true,
"drawsContent": true,
"repaintRects": [
[0, 50, 150, 150],
[0, 50, 100, 200]
]
}
]
}
<!DOCTYPE html>
<script src="resources/text-based-repaint.js"></script>
<script>
function repaintTest() {
var img = document.getElementsByTagName('img')[0];
img.style.width = '100px';
img.style.height = '200px';
}
onload = runRepaintTest;
</script>
<style>
img {
position: absolute;
top: 50px;
left: 0px;
width: 150px;
height: 150px;
}
</style>
The image should be fully repainted on resize. Passes if there is a whole apple after resize.
<img src="resources/apple.jpg">
{
"bounds": [800, 600],
"children": [
{
"bounds": [800, 600],
"contentsOpaque": true,
"drawsContent": true,
"repaintRects": [
[100, 50, 50, 150],
[0, 200, 100, 50],
[0, 50, 150, 150],
[0, 50, 100, 200]
]
}
]
}
<!DOCTYPE html>
<script src="resources/text-based-repaint.js"></script>
<script>
function repaintTest() {
var div = document.getElementsByTagName('div')[0];
div.style.width = '100px';
div.style.height = '200px';
}
onload = runRepaintTest;
</script>
<style>
div {
position: absolute;
top: 50px;
left: 0px;
width: 150px;
height: 150px;
}
img {
position: absolute;
width: 100%;
height: 100%;
}
</style>
The percent-sized image should be fully repainted on container's resize. Passes if there is a whole apple after resize.
<div>
<img src="resources/apple.jpg">
</div>
......@@ -6,7 +6,8 @@
"contentsOpaque": true,
"drawsContent": true,
"repaintRects": [
[48, 150, 100, 50],
[48, 100, 100, 100],
[48, 100, 100, 50],
[30, 155, 762, 50],
[30, 100, 762, 104]
]
......
......@@ -6,7 +6,8 @@
"contentsOpaque": true,
"drawsContent": true,
"repaintRects": [
[48, 144, 100, 50],
[48, 94, 100, 100],
[48, 94, 100, 50],
[31, 148, 761, 50],
[31, 94, 761, 104]
]
......
......@@ -6,7 +6,8 @@
"contentsOpaque": true,
"drawsContent": true,
"repaintRects": [
[48, 150, 100, 50],
[48, 100, 100, 100],
[48, 100, 100, 50],
[30, 155, 762, 50],
[30, 100, 762, 104]
]
......
......@@ -6,7 +6,8 @@
"contentsOpaque": true,
"drawsContent": true,
"repaintRects": [
[48, 144, 100, 50],
[48, 94, 100, 100],
[48, 94, 100, 50],
[31, 148, 761, 50],
[31, 94, 761, 103]
]
......
......@@ -551,8 +551,12 @@ void RenderImage::updateAltText()
void RenderImage::layout()
{
LayoutRect oldContentRect = replacedContentRect();
RenderReplaced::layout();
updateInnerContentRect();
if (replacedContentRect() != oldContentRect) {
setShouldDoFullPaintInvalidation(true);
updateInnerContentRect();
}
}
bool RenderImage::updateImageLoadingPriorities()
......
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