Bug 1333418 - Don't exceed index of KeyframeValueEntry more than entry's length. r=birtles

MozReview-Commit-ID: FMmUiWjtLDM

--HG--
extra : rebase_source : d69a98763b899b64ebe4339984c3b84d9f0976d5
This commit is contained in:
Hiroyuki Ikezoe 2017-01-30 12:51:04 +09:00
Родитель e0408a458a
Коммит 36f0781758
4 изменённых файлов: 52 добавлений и 2 удалений

Просмотреть файл

@ -1347,7 +1347,8 @@ BuildSegmentsFromValueEntries(nsTArray<KeyframeValueEntry>& aEntries,
// We need to generate an initial zero-length segment.
MOZ_ASSERT(aEntries[i].mProperty == aEntries[i + 1].mProperty);
j = i + 1;
while (aEntries[j + 1].mOffset == 0.0f &&
while (j + 1 < n &&
aEntries[j + 1].mOffset == 0.0f &&
aEntries[j + 1].mProperty == aEntries[j].mProperty) {
++j;
}

Просмотреть файл

@ -789,7 +789,7 @@ var gTests = [
value(0.5, '5px', 'replace', 'linear'),
value(1, undefined, 'add') ] } ]
},
{ desc: 'missing propertes in both of initial and final keyframe along'
{ desc: 'missing propertes in both of initial and final keyframe along '
+ 'with other values',
frames: [ { left: '5px', offset: 0 },
{ right: '5px', offset: 0.5 },
@ -802,6 +802,36 @@ var gTests = [
value(0.5, '5px', 'replace', 'linear'),
value(1, undefined, 'add') ] } ]
},
{ desc: 'a missing property in final keyframe with duplicate offset ' +
+ 'along with other values',
frames: [ { left: '5px', right: '5px', offset: 0 },
{ left: '8px', right: '8px', offset: 0 },
{ left: '10px', offset: 1 } ],
expected: [ { property: 'left',
values: [ value(0, '5px', 'replace'),
value(0, '8px', 'replace', 'linear'),
value(1, '10px', 'replace') ] },
{ property: 'right',
values: [ value(0, '5px', 'replace'),
value(0, '8px', 'replace', 'linear'),
value(1, undefined, 'add') ] } ]
},
{ desc: 'a missing property in initial keyframe with duplicate offset '
+ 'along with other values',
frames: [ { left: '10px', offset: 0 },
{ left: '8px', right: '8px', offset: 1 },
{ left: '5px', right: '5px', offset: 1 } ],
expected: [ { property: 'left',
values: [ value(0, '10px', 'replace', 'linear'),
value(1, '8px', 'replace'),
value(1, '5px', 'replace') ] },
{ property: 'right',
values: [ value(0, undefined, 'add', 'linear'),
value(1, '8px', 'replace'),
value(1, '5px', 'replace') ] } ]
},
];
SpecialPowers.pushPrefEnv(

Просмотреть файл

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script>
window.onload = function(){
let body = document.getElementsByTagName("body")[0];
let o = new KeyframeEffect(body, [
{ "perspective": "none", "width": "auto" },
{ "perspective": "172.17866832in", "width": "auto" },
{ "perspective": "0" }],
{ spacing:"paced(perspective)" }
);
};
</script>
</head>
<body></body>
</html>

Просмотреть файл

@ -21,3 +21,4 @@ skip-if(stylo) pref(dom.animations-api.core.enabled,true) load 1325193-1.html #
skip-if(stylo) pref(dom.animations-api.core.enabled,true) load 1330190-1.html # bug 1311257
skip-if(stylo) pref(dom.animations-api.core.enabled,true) load 1330190-2.html # bug 1311257
skip-if(stylo) pref(dom.animations-api.core.enabled,true) load 1330513-1.html # bug 1311257
skip-if(stylo) pref(dom.animations-api.core.enabled,true) load 1333418-1.html # bug 1311257