Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / ManualTests / canvas-mask-redraw.html
blob315ede28cdf5c14261627a1087c0366a2383c977
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
4 <html lang="en">
5 <head>
6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
7 <title>Canvas Mask</title>
8 <style type="text/css" media="screen">
9 #canvas1 {
10 height: 300px;
11 width: 400px;
12 border: 1px solid black;
15 .masked {
16 /* transform: rotate(10deg);*/
17 -webkit-mask: -webkit-canvas(canvas1);
19 </style>
20 <script type="text/javascript" charset="utf-8">
22 var gPageWidth = 320;
23 var gPageHeight = 200;
25 function drawPageShadow(shadowWidth)
27 var ctx = document.getCSSCanvasContext('2d', 'canvas1', gPageWidth, gPageHeight);
28 ctx.clearRect (0, 0, gPageWidth, gPageHeight);
30 var gradient = ctx.createLinearGradient(0, 0, shadowWidth, 0);
31 gradient.addColorStop(0, 'rgba(0,0,0,1)');
32 gradient.addColorStop(1, 'rgba(0,0,0,0)');
33 ctx.fillStyle = gradient;
34 ctx.fillRect (0, 0, shadowWidth, gPageHeight);
37 function redrawCanvas(event)
39 drawPageShadow(event.pageX);
42 function onPageLoad()
44 drawPageShadow(640);
47 window.addEventListener('load', onPageLoad, false);
49 </script>
50 </head>
51 <body>
53 <p>Hovering over the image or text should cause the element to be redrawn with a new mask</p>
54 <a href="https://bugs.webkit.org/show_bug.cgi?id=19954">https://bugs.webkit.org/show_bug.cgi?id=19954</a>
55 <h2>Image with mask</h2>
56 <img src="http://www.google.com/intl/en_ALL/images/logo.gif" width="320" height="200" alt="Clown Fish" class="masked"
57 onmousemove="redrawCanvas(event)">
59 <h2>Div with mask</h2>
60 <div class="masked" style="width: 640px" onmousemove="redrawCanvas(event)">
61 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
62 </div>
64 </body>
65 </html>