Bug 81496

Summary: [Tests][Forms] We should share code of mouseDownOnSelect
Product: WebKit Reporter: yosin
Component: Tools / TestsAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   

Description yosin 2012-03-18 23:32:58 PDT
JavaScript function mouseDownOnSelect resides in following files:
 1. LayoutTests/fast/forms/listbox-deselect-scroll.html
 2. LayoutTests/fast/forms/resources/select-live-pseudo-selectors.js
 3. LayoutTests/fast/forms/listbox-onchange.html
 4. LayoutTests/fast/forms/listbox-selection.html
 5. LayoutTests/fast/forms/listbox-selection-2.html
 6. LayoutTests/fast/forms/listbox-hit-test-zoomed.html
 7. LayoutTests/fast/forms/select/menulist-popup-crash.html

For ease of maintenance, we should share the code, e.g. move into common place.
 
Also, the function may do divide by zero in following line:
    var itemHeight = Math.floor(sl.offsetHeight / sl.size);

Test case authors must write non-zero "size" attribute for the "select" element.
I think it is better to throw exception if sl.size is zero.