Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / html / set-text-direction.html
blob75228e46d8e8f820eda96ae91c869f47fb394003
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <script language="javascript" type="text/javascript">
8 description('Test that WebKit changes the dir attribute and sends an input event when we change the text direction.');
10 // The string used for storing the expected text direction when we receive an input event.
11 var expected = '';
12 var sentInputEvent = false;
14 function removeChildAndForceGC(child) {
15 document.body.removeChild(child);
16 gc();
19 // Create a textarea element and an input element. These elements are used for
20 // changing their text direction with Editor::setBaseWritingDirection() calls.
21 var textarea = document.createElement('textarea');
22 textarea.rows = 10;
23 textarea.cols = 10;
24 textarea.oninput = function() {
25 shouldBe('expected', 'textarea.dir');
26 sentInputEvent = true;
28 // When we change the direction to ltr, we remove this element to verify WebKit
29 // continue running without crashes.
30 if (expected == 'ltr')
31 removeChildAndForceGC(textarea);
33 document.body.appendChild(textarea);
35 var input = document.createElement('input');
36 input.type = 'text';
37 input.oninput = function() {
38 shouldBe('expected', 'input.dir');
39 sentInputEvent = true;
41 // When we change the direction to ltr, we remove this element to verify WebKit
42 // continue running without crashes.
43 if (expected == 'ltr')
44 removeChildAndForceGC(input);
46 document.body.appendChild(input);
48 // Change the text direction of the textarea element to RTL.
49 expected = 'rtl';
50 sentInputEvent = false;
51 textarea.focus();
52 testRunner.setTextDirection('rtl');
53 shouldBeTrue('sentInputEvent');
55 // Change the text direction of the textarea element to LTR.
56 // This also removes the element to verify WebKit works without crashes.
57 expected = 'ltr';
58 sentInputEvent = false;
59 textarea.focus();
60 testRunner.setTextDirection('ltr');
61 shouldBeTrue('sentInputEvent');
63 // Change the text direction of the input element to RTL.
64 expected = 'rtl';
65 sentInputEvent = false;
66 input.focus();
67 testRunner.setTextDirection('rtl');
68 shouldBeTrue('sentInputEvent');
70 // Change the text direction of the input element to LTR.
71 // This also removes the element to verify WebKit works without crashes.
72 expected = 'ltr';
73 sentInputEvent = false;
74 input.focus();
75 testRunner.setTextDirection('ltr');
76 shouldBeTrue('sentInputEvent');
77 </script>
78 </body>
79 </html>