4 <style type=
"text/css">
11 background-color: green
;
14 #canvas-padding { padding: 5px; }
15 #canvas-border { border: 5px solid
; }
16 #canvas-image { background-image: url
("../resources/simple_image.png"); }
17 #canvas-transparent-background { background-color: rgba
(0, 255, 0, 0.5); }
20 if (window
.testRunner
) {
21 testRunner
.overridePreference("WebKitWebGLEnabled", "1");
22 testRunner
.dumpAsText();
25 function drawCanvas(canvasID
) {
26 var canvas
= document
.getElementById(canvasID
);
27 var gl
= canvas
.getContext("webgl");
28 gl
.clearColor(0, 0, 0, 0);
29 gl
.clear(gl
.COLOR_BUFFER_BIT
| gl
.DEPTH_BUFFER_BIT
);
33 // Simple background can be direct-composited with content-layer.
34 // The container GraphicsLayer does not paint anything.
35 drawCanvas('canvas-simple');
37 // Padding makes the background-box bigger than content-box.
38 // The container GraphicsLayer needs to paint background.
39 drawCanvas('canvas-padding');
41 // Content layer cannot direct-composite any kind of box decoration.
42 // The container GraphicsLayer needs to paint box decorations.
43 drawCanvas('canvas-border');
45 // Content layer cannot direct-composite background image.
46 // The container GraphicsLayer needs to paint background image.
47 drawCanvas('canvas-image');
49 // Simple background can be direct-composited with content-layer.
50 // The container GraphicsLayer does not paint anything.
51 // The container Graphics layer must not be treated as opaque
52 drawCanvas('canvas-transparent-background');
54 if (window
.testRunner
&& window
.internals
)
55 document
.getElementById('layer-tree').innerText
= window
.internals
.layerTreeAsText(document
);
57 window
.addEventListener('load', doTest
, false);
62 <div class=
"container">
63 <canvas id=
"canvas-simple" width=
"50" height=
"50"></canvas>
65 <div class=
"container">
66 <canvas id=
"canvas-padding" width=
"50" height=
"50"></canvas>
68 <div class=
"container">
69 <canvas id=
"canvas-border" width=
"50" height=
"50"></canvas>
71 <div class=
"container">
72 <canvas id=
"canvas-image" width=
"50" height=
"50"></canvas>
74 <div class=
"container">
75 <canvas id=
"canvas-transparent-background" width=
"50" height=
"50"></canvas>
77 <pre id=
"layer-tree"></pre>