Changeset 174148 in webkit


Ignore:
Timestamp:
Oct 1, 2014 1:15:40 AM (9 years ago)
Author:
commit-queue@webkit.org
Message:

[iOS] <select> with <optgroup> may change initial selected option when assisted
https://bugs.webkit.org/show_bug.cgi?id=137261

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2014-10-01
Reviewed by Enrica Casucci.

The initial assignemnt of _singleSelectionIndex was calculating the
item index (ignoring groups) instead of the row index (affected by
groups!). Thus if there was N groups we would select the row N
before the real selection.

Also avoid this entirely if this is a multiple selection picker.
This logic is only needed for single selection with groups.

  • UIProcess/ios/forms/WKFormSelectPicker.mm:

(-[WKMultipleSelectPicker initWithView:]):

Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r174128 r174148  
     12014-10-01  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        [iOS] <select> with <optgroup> may change initial selected option when assisted
     4        https://bugs.webkit.org/show_bug.cgi?id=137261
     5
     6        Reviewed by Enrica Casucci.
     7
     8        The initial assignemnt of _singleSelectionIndex was calculating the
     9        item index (ignoring groups) instead of the row index (affected by
     10        groups!). Thus if there was N groups we would select the row N
     11        before the real selection.
     12
     13        Also avoid this entirely if this is a multiple selection picker.
     14        This logic is only needed for single selection with groups.
     15
     16        * UIProcess/ios/forms/WKFormSelectPicker.mm:
     17        (-[WKMultipleSelectPicker initWithView:]):
     18
    1192014-09-30  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
    220
  • trunk/Source/WebKit2/UIProcess/ios/forms/WKFormSelectPicker.mm

    r170554 r174148  
    167167    [self reloadAllComponents];
    168168
    169     const Vector<OptionItem>& selectOptions = [_view assistedNodeSelectOptions];
    170     int currentIndex = 0;
    171     for (size_t i = 0; i < selectOptions.size(); ++i) {
    172         const OptionItem& item = selectOptions[i];
    173         if (item.isGroup)
    174             continue;
    175 
    176         if (!_allowsMultipleSelection && item.isSelected)
    177             _singleSelectionIndex = currentIndex;
    178 
    179         currentIndex++;
    180     }
    181 
    182     if (_singleSelectionIndex != NSNotFound)
    183         [self selectRow:_singleSelectionIndex inComponent:0 animated:NO];
     169    if (!_allowsMultipleSelection) {
     170        const Vector<OptionItem>& selectOptions = [_view assistedNodeSelectOptions];
     171        for (size_t i = 0; i < selectOptions.size(); ++i) {
     172            const OptionItem& item = selectOptions[i];
     173            if (item.isGroup)
     174                continue;
     175
     176            if (item.isSelected) {
     177                _singleSelectionIndex = i;
     178                [self selectRow:_singleSelectionIndex inComponent:0 animated:NO];
     179                break;
     180            }
     181        }
     182    }
    184183
    185184    return self;
Note: See TracChangeset for help on using the changeset viewer.