iOS6でこのバグを再現し、iOS5.1(iPhone 4と4Sの両方)で完全に動作する簡単なテストケースを添付しました。iOS Chromeアプリは、UIWebViewを組み込んでいるため、このテストを実行するのに適した場所です。PhoneGap 2.0UIWebView内でこのサンプルスクリプトを実行している2台のiPhone4(1つはiOS 5.1を実行し、もう1つはiOS 6を実行)をアップロードしたら添付するビデオがあります。
現在、これらの要素はハードウェアアクセラレーションされているようですが、Appleの低レベルパイプラインにバグがあり、パフォーマンスが低下しているようです。ハードウェアアクセラレーションのいくつかの回避策を試しましたが、iOS5.1でGPUを呼び出すものはすべて、iOS6で大幅な速度低下を引き起こすようです。
私たちが構築しているアプリは、これが適切に機能することにかなり大きく依存しているため、修正を見つけたいと思います。この例で誰かがエラーを指摘できれば、それも非常にありがたいです。
編集:次のようにアニメーション機能を変更しても、バグは解決しません。
function animate(node) {
node.style.webkitAnimation = 'sample 5s infinite';
node.style.webkitPerspective = 1000;
node.style.webkitBackfaceVisibility = 'hidden';
}
これは、GPUを呼び出すとこの速度が低下することを強調しているようです。
編集2:http://bvgam.es/apple/でホストされている追加の例があります。これは、iOS 5.1でスムーズに実行され、iOS 6で1〜2FPSを取得します。
<!DOCTYPE html>
<html>
<head>
<title>Animation Playground</title>
<style>
@-webkit-keyframes sample {
0% { -webkit-transform: translate3d(0px, 0px, 0px); opacity: 1; }
10% { -webkit-transform: translate3d(0px, 0px, 0px); opacity: 0; }
20% { -webkit-transform: translate3d(10px, 0px, 0px); opacity: 1; }
40% { -webkit-transform: translate3d(10px, 10px, 0px); opacity: 0; }
50% { -webkit-transform: translate3d(10px, 20px, 0px); opacity: 1; }
80% { -webkit-transform: translate3d(20px, 20px, 0px); opacity: 0; }
100% { -webkit-transform: translate3d(0px, 0px, 0px); opacity: 1; }
}
</style>
<script type="text/javascript">
function fib(node, a, b) {
node.innerHTML = a;
setTimeout(function() {
fib(node, a + b, b);
}, 0);
}
function animate(node) {
node.style.webkitAnimation = 'sample 5s infinite';
}
function createNode(row, column) {
var node = document.createElement('div');
node.style.width = '7px';
node.style.height = '7px';
node.style.position = 'absolute';
node.style.top = 30 + (row * 9) + 'px';
node.style.left = (column * 9) + 'px';
node.style.background = 'green';
return node;
}
function run() {
for (var row = 0; row < 20; ++row) {
for (var column = 0; column < 20; ++column) {
var node = createNode(row, column);
document.body.appendChild(node);
animate(node);
}
}
var output = document.getElementById('output');
fib(output, 0, 1);
}
</script>
</head>
<body onload="run()">
<div id="output" style="font-size: 40px; position: absolute; left: 220px;"></div>
</body>
</html>