Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / ManualTests / arrow-key-events.html
blob81231f158dd8de666c230370795dd4cdfb99b7e8
1 <body>
2 <p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=3387">bug 3387</a>:
3 Redundant keydown, keypress, keyup events sent for arrow keys.</p>
5 <p>Try pressing arrow keys, PgUp/PgDown/Home/End, Esc, or function keys.
6 The test passes if the box below doesn't turn red.<p>
8 <div id="result" style="width:100px; height:100px; background-color:blue;"></div>
10 <script>
12 var console_messages = document.createElement("ol");
13 document.body.appendChild(console_messages);
15 window.onkeydown = registerWindow;
16 window.onkeypress = registerWindow;
17 window.onkeyup = registerWindow;
19 document.onkeydown = registerDocument;
20 document.onkeypress = registerDocument;
21 document.onkeyup = registerDocument;
23 document.body.onkeydown = registerBody;
24 document.body.onkeypress = registerBody;
25 document.body.onkeyup = registerBody;
27 document.documentElement.onkeydown = registerDocumentElement;
28 document.documentElement.onkeypress = registerDocumentElement;
29 document.documentElement.onkeyup = registerDocumentElement;
31 var bodyKeyDownCount = 0;
32 var documentElementKeyDownCount = 0;
33 var windowKeyDownCount = 0;
34 var documentKeyDownCount = 0;
36 function log(message)
38 var item = document.createElement("li");
39 item.appendChild(document.createTextNode(message));
40 item.style.fontSize = '8px';
41 console_messages.appendChild(item);
44 function registerBody(e)
46 if ((e.type == "keydown" && ++bodyKeyDownCount != 1)
47 || (e.type == "keyup" && --bodyKeyDownCount != 0))
48 document.getElementById("result").style.backgroundColor = "red";
50 if (!e)
51 e = window.event;
52 log("body: " + e.type);
53 return true;
56 function registerDocumentElement(e)
58 if ((e.type == "keydown" && ++documentElementKeyDownCount != 1)
59 || (e.type == "keyup" && --documentElementKeyDownCount != 0))
60 document.getElementById("result").style.backgroundColor = "red";
62 if (!e)
63 e = window.event;
64 log(" documentElement: " + e.type);
65 return true;
68 function registerDocument(e)
70 if ((e.type == "keydown" && ++documentKeyDownCount != 1)
71 || (e.type == "keyup" && --documentKeyDownCount != 0))
72 document.getElementById("result").style.backgroundColor = "red";
74 if (!e)
75 e = window.event;
76 log("  document: " + e.type);
77 return true;
80 function registerWindow(e)
82 if ((e.type == "keydown" && ++windowKeyDownCount != 1)
83 || (e.type == "keyup" && --windowKeyDownCount != 0))
84 document.getElementById("result").style.backgroundColor = "red";
86 if (!e)
87 e = window.event;
88 log("   window: " + e.type);
89 return true;
92 </script>
93 </body>