haikuwebkit/PerformanceTests/SVG/SvgNestedUse.html

83 lines
3.1 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE html>
<html>
<head>
<script src="../resources/runner.js"></script>
</head>
<body>
<div id="wrapper">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<g id="unit">
<polygon points="0,0 10,0 5,8.66025403784439"/>
</g>
<g id="q">
<use id="q0" xlink:href="#unit" x="10" y="0" fill="red"/>
<use id="q1" xlink:href="#unit" transform="translate(10,0) rotate(60)" fill="green"/>
<use id="q2" xlink:href="#unit" transform="translate(10,0) rotate(120)" fill="blue"/>
<use id="q3" xlink:href="#unit" transform="rotate(60) translate(10,0) rotate(-60)" fill="purple"/>
</g>
<g id="qq">
<use id="qq0" xlink:href="#q" x="20" y="0"/>
<use id="qq1" xlink:href="#q" transform="translate(20,0) rotate(60)"/>
<use id="qq2" xlink:href="#q" transform="translate(20,0) rotate(120)"/>
<use id="qq3" xlink:href="#unit" transform="rotate(60) translate(20,0) rotate(-60) scale(2)" fill="purple"/>
</g>
<g id="qqq">
<use xlink:href="#qq" x="40" y="0"/>
<use xlink:href="#qq" transform="translate(40,0) rotate(60)"/>
<use xlink:href="#qq" transform="translate(40,0) rotate(120)"/>
<use xlink:href="#q" transform="rotate(60) translate(40,0) rotate(-60) scale(2)"/>
</g>
</defs>
<use xlink:href="#qqq"/>
<g transform="translate(300 200)">
<rect width="70" height="26" stroke-width="1" fill="rgb(255,255,255)" fill-opacity="1.000" stroke="rgb(0,0,0)" stroke-opacity="1.000"/>
<text id="FPS" y="23" font-family="Verdana" font-size="23">0</text>
</g>
</svg>
</div>
<script type="text/javascript">
var frame = 0;
var times = [PerfTestRunner.now()];
var unit = document.getElementById("unit");
requestAnimationFrame =
window['requestAnimationFrame'] ||
window['webkitRequestAnimationFrame'] ||
window['mozRequestAnimationFrame'] ||
window['oRequestAnimationFrame'] ||
window['msRequestAnimationFrame'] ||
function(callback) {
window.setTimeout(callback, 1000 / 60);
};
function newFrame() {
times.push(PerfTestRunner.now());
var avg = (times[times.length - 1] - times[0]) / (times.length - 1);
while (times.length > 10)
times.shift();
document.getElementById("FPS").textContent = (1000 / avg).toFixed(2);
unit.setAttribute('transform', 'scale(' + (Math.abs(frame++ % 20 - 10) / 10) + ')');
};
function animate() {
newFrame();
requestAnimationFrame(animate);
}
if (window.testRunner) {
Rename PerfTestRunner.runPerSecond to PerfTestRunner.measureRunsPerSecond for consistency https://bugs.webkit.org/show_bug.cgi?id=99642 Reviewed by Dirk Pranke. Renamed the method. * Bindings/append-child.html: * Bindings/create-element.html: * Bindings/event-target-wrapper.html: * Bindings/first-child.html: * Bindings/get-attribute.html: * Bindings/get-element-by-id.html: * Bindings/get-elements-by-tag-name.html: * Bindings/id-getter.html: * Bindings/id-setter.html: * Bindings/insert-before.html: * Bindings/node-list-access.html: * Bindings/scroll-top.html: * Bindings/set-attribute.html: * Bindings/typed-array-construct-from-array.html: * Bindings/typed-array-construct-from-same-type.html: * Bindings/typed-array-construct-from-typed.html: * Bindings/typed-array-set-from-typed.html: * Bindings/undefined-first-child.html: * Bindings/undefined-get-element-by-id.html: * Bindings/undefined-id-getter.html: * CSS/CSSPropertySetterGetter.html: * CSS/CSSPropertyUpdateValue.html: * CSS/PseudoClassSelectors.html: * DOM/textarea-dom.html: * DOM/textarea-edit.html: * Interactive/resources/window-resize.js: * Layout/flexbox-column-nowrap.html: * Layout/flexbox-column-wrap.html: * Layout/flexbox-row-nowrap.html: * Layout/flexbox-row-wrap.html: * Layout/line-layout.html: * Parser/css-parser-yui.html: * Parser/innerHTML-setter.html: * Parser/query-selector-deep.html: * Parser/query-selector-first.html: * Parser/query-selector-last.html: * Parser/simple-url.html: * Parser/textarea-parsing.html: * Parser/tiny-innerHTML.html: * Parser/url-parser.html: * Parser/xml-parser.html: * SVG/SvgNestedUse.html: * resources/runner.js: Canonical link: https://commits.webkit.org/117606@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@131651 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-10-17 22:06:52 +00:00
PerfTestRunner.measureRunsPerSecond({ run: newFrame, done: function() {
document.getElementById('wrapper').style.display = 'none';
}});
} else
requestAnimationFrame(animate);
</script>
</body>
</html>