RESOLVED FIXED 66282
When changing the size of a menulist from x (x>1) to 1, the first item should be selected.
https://bugs.webkit.org/show_bug.cgi?id=66282
Summary When changing the size of a menulist from x (x>1) to 1, the first item should...
Jing Zhao
Reported 2011-08-15 23:13:31 PDT
Should set default selection for single selects
Attachments
Patch (1.78 KB, patch)
2011-08-15 23:25 PDT, Jing Zhao
no flags
Patch (1.65 KB, patch)
2011-08-16 06:42 PDT, Jing Zhao
no flags
Patch (1.43 KB, patch)
2011-08-16 07:25 PDT, Jing Zhao
no flags
Patch (1.37 KB, patch)
2011-08-17 03:15 PDT, Jing Zhao
no flags
Patch (1.76 KB, patch)
2011-08-17 03:26 PDT, Jing Zhao
no flags
Jing Zhao
Comment 1 2011-08-15 23:25:38 PDT
Jing Zhao
Comment 2 2011-08-15 23:32:41 PDT
Now we only set default selection for a single select when its size is 1. We should change that condition to if it's presented as a menulist, because in Android we present a single select as a menulist no matter what its size is.
Jing Zhao
Comment 3 2011-08-16 06:42:17 PDT
Jing Zhao
Comment 4 2011-08-16 06:47:01 PDT
Xianzhu suggested not to select the first item when size > 1, because that's inconsistent with other platforms. If a developer assumes a select should be unselected because its size > 1, his/her page may have different behavior in Android browser. I changed this bug to fix another problem: when changing the size of a menulist from x (x>1) to 1, the first item should be selected. The current logic assumes a menulist must have its size <= 1, which is true in most WebKit platforms, but in Android browser, a select is always presented as a menulist no matter what size it is.
Johnny(Jianning) Ding
Comment 5 2011-08-16 07:17:19 PDT
Comment on attachment 104034 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=104034&action=review > Source/WebCore/html/HTMLSelectElement.cpp:266 > + if ((oldUsesMenuList != m_data.usesMenuList() || (!oldUsesMenuList && m_data.size() != oldSize)) && attached()) Current WebKit code assumes that menuList is always only used for select(size<=1 && !m_multiple), but looks like Android browser breaks this rule. So in the second condition, even the oldUsesMenuList is true (which means m_data.usesMenuList() is also true, but does not mean the size of select is 1), the Select's size still can be changed to value other than 1 and the change still requires to re-generate the renderer object (call method reattach) What do you think?
Jing Zhao
Comment 6 2011-08-16 07:25:11 PDT
Jing Zhao
Comment 7 2011-08-16 07:28:02 PDT
Comment on attachment 104034 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=104034&action=review >> Source/WebCore/html/HTMLSelectElement.cpp:266 >> + if ((oldUsesMenuList != m_data.usesMenuList() || (!oldUsesMenuList && m_data.size() != oldSize)) && attached()) > > Current WebKit code assumes that menuList is always only used for select(size<=1 && !m_multiple), but looks like Android browser breaks this rule. So in the second condition, even the oldUsesMenuList is true (which means m_data.usesMenuList() is also true, but does not mean the size of select is 1), the Select's size still can be changed to value other than 1 and the change still requires to re-generate the renderer object (call method reattach) > > What do you think? Totally agreed. Just updated a new patch. Thanks!
Jing Zhao
Comment 8 2011-08-17 03:15:15 PDT
Early Warning System Bot
Comment 9 2011-08-17 03:22:22 PDT
Jing Zhao
Comment 10 2011-08-17 03:26:35 PDT
Jing Zhao
Comment 11 2011-08-17 03:28:23 PDT
There are 3 different cases when (m_data.size() != oldSize): 1. (oldUsesMenuList != m_data.usesMenuList()): menu list changes to list box or list box changes to menu list 2. (!oldUsesMenuList && m_data.size() != oldSize): list box changes size 3. (oldUsesMenuList && m_data.size() != oldSize): menu list changes size The original condition excludes the third case because it doesn't exist in platforms other than Android browser. My change is to add back the third case.
Kent Tamura
Comment 12 2011-08-17 21:42:48 PDT
Comment on attachment 104165 [details] Patch The code change looks ok. I'm afraid the test coverage. Do you have a plan to create LayoutTests/platforms/android/ directory? If so, you should add a test for this change into LayouTests/platforms/android/fast/forms/.
Jing Zhao
Comment 13 2011-08-18 03:17:12 PDT
I already have a test for this, and will commit it later when Android DumpRenderTree is ready. Thanks!
Kent Tamura
Comment 14 2011-08-18 03:18:48 PDT
(In reply to comment #13) > I already have a test for this, and will commit it later when Android DumpRenderTree is ready. Ok, it's reasonable.
WebKit Review Bot
Comment 15 2011-08-18 04:06:06 PDT
Comment on attachment 104165 [details] Patch Clearing flags on attachment: 104165 Committed r93295: <http://trac.webkit.org/changeset/93295>
WebKit Review Bot
Comment 16 2011-08-18 04:06:11 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.