blob: f65a25e76d06566eb76d1cf740be1eb3a26026bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
<!DOCTYPE html>
<script src="resources/text-based-repaint.js"></script>
<script>
function changePositionKeepingGeometry(id, newPosition) {
var target = document.getElementById(id);
var originalTop = target.offsetTop;
var originalLeft = target.offsetLeft;
target.style.position = newPosition;
target.style.top = originalTop + 'px';
target.style.left = originalLeft + 'px';
}
function repaintTest()
{
changePositionKeepingGeometry('target1', 'absolute');
changePositionKeepingGeometry('target2', 'absolute');
changePositionKeepingGeometry('target3', 'fixed');
}
onload = runRepaintTest;
</script>
<style>
body {
margin: 0;
}
div {
width: 100px;
height: 100px;
top: 20px;
background-color: blue;
}
#target0 {
left: 20px;
position: relative;
}
#target1 {
left: 20px;
position: relative;
}
#target2 {
left: 220px;
position: fixed;
z-index: 0;
}
#target3 {
left: 420px;
position: absolute;
z-index: 0;
}
</style>
There should be no invalildations on change of position without actual change of position and size.
<!-- target0 ensures we don't strip anonymous wrappers (and trigger a layout) when the other elements change position. -->
<div id="target0"></div>
<div id="target1"></div>
<div id="target2"></div>
<div id="target3"></div>
|