Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / focus-on-control-with-zero-size.html
blobaf896a224a67c07142f7cd96c94635e511a03bd5
1 <!DOCTYPE html>
2 <body>
3 <script src="../../resources/js-test.js"></script>
4 <style>
5 input {
6 border: none;
7 padding: 0;
8 margin: 0;
10 </style>
11 <input id="input1">
12 <script>
13 function handleKeydown(event) {
14 event.target.style.width = '0px';
17 function handleBlur(event) {
18 testFailed('Event: blur');
19 event.target.style.width = '';
22 window.onload = function() {
23 debug('Check if a control won\'t loose focus when it becomes 0-size.');
24 input1.focus();
25 input1.addEventListener('keydown', handleKeydown, false);
26 input1.addEventListener('blur', handleBlur, false);
27 eventSender.keyDown('0');
28 event.target.removeEventListener('keydown', handleKeydown);
29 setTimeout(step2, 1);
32 function step2() {
33 // We need to check activeElement twice because
34 // FrameSelection::setFocusedNodeIfNeeded can change focus.
35 shouldBe('document.activeElement', 'input1');
36 eventSender.keyDown('1');
37 shouldBeEqualToString('input1.value', '01');
38 shouldBe('document.activeElement', 'input1');
40 debug('');
41 debug('Check if 0-size control can get focus.');
42 input1.removeEventListener('blur', handleBlur);
43 input1.blur();
44 shouldBe('document.activeElement', 'document.body', true);
45 input1.style.height = '0px';
46 shouldBe('input1.offsetHeight', '0', true);
47 input1.focus();
48 shouldBe('document.activeElement', 'input1');
50 finishJSTest();
53 jsTestIsAsync = true;
54 </script>
55 </body>