Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Side by Side Diff: LayoutTests/fast/forms/listbox-selection-2.html

Issue 347773002: Implement select listbox using shadow DOM (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/js-test.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <p id="description"></p> 7 <p id="description"></p>
8 <div id="console"></div> 8 <div id="console"></div>
9 <script> 9 <script>
10 description('&lt;select> selection test for scrolling.'); 10 description('&lt;select> selection test for scrolling.');
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 var itemHeight = Math.floor(sl1.offsetHeight / sl1.size); 42 var itemHeight = Math.floor(sl1.offsetHeight / sl1.size);
43 sl1.removeAttribute('size'); 43 sl1.removeAttribute('size');
44 var height = itemHeight * 9 + 9; 44 var height = itemHeight * 9 + 9;
45 sl1.setAttribute('style', 'height: ' + height + 'px; border: 10px solid; padding : 5px;'); 45 sl1.setAttribute('style', 'height: ' + height + 'px; border: 10px solid; padding : 5px;');
46 46
47 function mouseDownOnSelect(selId, index) 47 function mouseDownOnSelect(selId, index)
48 { 48 {
49 var sl = document.getElementById(selId); 49 var sl = document.getElementById(selId);
50 var borderPaddingTop = 15; 50 var borderPaddingTop = 15;
51 var borderPaddingLeft = 15; 51 var borderPaddingLeft = 15;
52 var y = index * itemHeight + itemHeight / 3 - window.pageYOffset + borderPad dingTop; 52 var y = index * itemHeight + itemHeight / 2 - window.pageYOffset + borderPad dingTop;
53 var event = document.createEvent("MouseEvent"); 53 eventSender.mouseMoveTo(sl.offsetLeft + borderPaddingLeft, sl.offsetTop + y );
54 event.initMouseEvent("mousedown", true, true, document.defaultView, 1, sl.of fsetLeft + borderPaddingLeft, sl.offsetTop + y, sl.offsetLeft + borderPaddingLe ft, sl.offsetTop + y, false, false, false, false, 0, document); 54 eventSender.mouseDown();
55 sl.dispatchEvent(event); 55 eventSender.mouseUp();
56 } 56 }
57 57
58 function selectionPattern(selectId) 58 function selectionPattern(selectId)
59 { 59 {
60 var select = document.getElementById(selectId); 60 var select = document.getElementById(selectId);
61 var result = ""; 61 var result = "";
62 for (var i = 0; i < select.options.length; i++) 62 for (var i = 0; i < select.options.length; i++)
63 result += select.options[i].selected ? '1' : '0'; 63 result += select.options[i].selected ? '1' : '0';
64 return result; 64 return result;
65 } 65 }
(...skipping 24 matching lines...) Expand all
90 shouldBe('selectionPattern("sl2")', '"010"'); 90 shouldBe('selectionPattern("sl2")', '"010"');
91 91
92 mouseDownOnSelect("sl2", 3); 92 mouseDownOnSelect("sl2", 3);
93 shouldBe('selectionPattern("sl2")', '"010"'); 93 shouldBe('selectionPattern("sl2")', '"010"');
94 94
95 mouseDownOnSelect("sl2", 2); 95 mouseDownOnSelect("sl2", 2);
96 shouldBe('selectionPattern("sl2")', '"001"'); 96 shouldBe('selectionPattern("sl2")', '"001"');
97 </script> 97 </script>
98 </body> 98 </body>
99 </html> 99 </html>
OLDNEW
« no previous file with comments | « LayoutTests/fast/forms/listbox-onchange.html ('k') | LayoutTests/fast/forms/option-mouseevents.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698