Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / canvas / canvas-set-font-with-updated-style.html
blob9290f32bf36153f01f5ca29c89f09756d9608d4b
1 <!DOCTYPE HTML>
2 <html>
3 <body onload="runTest();">
4 <div>
5 <span>Tests that setting font of Canvas 2d context always uses up-to-date style and has font value: <span id="result"></span></span><br>
6 <canvas id="canvasTest"></canvas>
7 </div>
8 <script type="text/javascript">
9 if (window.testRunner)
10 testRunner.dumpAsText();
12 function drawCanvasText(id, text)
14 var canvasElement = document.getElementById(id);
15 var context = canvasElement.getContext('2d');
17 // Pre-draw pass to add the font to the font cache. This way, the test also
18 // verifies that the style change correctly invalidates the font resolution cache.
19 context.font = '1em Calibri';
20 context.fillText(text, 0, 100);
22 canvasElement.style.fontSize = '64px';
23 context.font = '1em Calibri';
24 context.fillText(text, 0, 100);
25 return context.font;
28 function runTest()
30 var fontSize = drawCanvasText('canvasTest', 'Some Text');
31 var resultElement = document.getElementById('result');
32 resultElement.textContent = fontSize;
34 </script>
35 </body>
36 </html>