Index: content/test/data/gpu/mem_css3d.html |
diff --git a/content/test/data/gpu/mem_css3d.html b/content/test/data/gpu/mem_css3d.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..735cf721013d71aab42f389a7854624217faad8d |
--- /dev/null |
+++ b/content/test/data/gpu/mem_css3d.html |
@@ -0,0 +1,52 @@ |
+<!DOCTYPE HTML> |
+<html> |
+<head> |
+<title>GPU Memory Test: Use N MB of GPU Memory with 3D CSS</title> |
+<style> |
+.block { |
+ background: #FF0000; |
+ font-size: 150px; |
+ height: 512px; |
+ position: absolute; |
+ width: 512px; |
+ |
+} |
+.perspective |
+{ |
+ border: 1px solid black; |
+ height: 512px; |
+ text-align: center; |
+ width: 512px; |
+ -webkit-perspective: 600px; |
+ -webkit-perspective-origin: center center; |
+ -webkit-transform-style: preserve-3d; |
+} |
+</style> |
+<script type="text/javascript"> |
+// Generate n 3D CSS elements that are each about 1 MB in size |
nduca
2013/01/05 05:14:42
how about splitting this patch up into a few patch
ccameron
2013/01/07 21:36:34
This I feel strongly about.
I had considered doin
|
+function useGpuMemory(mb_to_use) { |
+ n = mb_to_use; |
+ var blocks = document.getElementById("blocks"); |
+ var blockArray = document.getElementsByClassName("block"); |
+ for (var i = 0; i < n; i++) { |
+ var block = document.createElement("div"); |
+ block.className = "block"; |
+ block.style.WebkitTransform = "rotateZ(" + i + "deg) translate3d(" + i + "px, " + i + "px, " + 2*(i-n+1) + "px)"; |
nduca
2013/01/05 05:14:42
is the rotation important?
is there a simpler cas
ccameron
2013/01/07 21:36:34
Importantly, the test does verify that these pages
|
+ block.style.zIndex = -i; |
nduca
2013/01/05 05:14:42
is the backward zIndex ordering important?
ccameron
2013/01/07 21:36:34
Nope, that was a mistake -- I'd meant translate3d.
|
+ var r = 16 + 240 * (i % 2); |
+ var g = 16; |
+ var b = 255 - i; |
+ block.style.background = "#" + r.toString(16) + g.toString(16) + b.toString(16); |
+ block.innerHTML = i; |
nduca
2013/01/05 05:14:42
prefer
block.textContent = i;
unless you're inser
ccameron
2013/01/07 21:36:34
Fixed.
|
+ blocks.appendChild(block); |
+ } |
+ |
+ // Signal back to the test runner that we're done allocating memory. |
+ domAutomationController.send("DONE"); |
+} |
+</script> |
+</head> |
+<body> |
+<div id="blocks" class="perspective"/> |
+</body> |
+</html> |