Changeset 161558 in webkit


Ignore:
Timestamp:
Jan 9, 2014 9:23:48 AM (10 years ago)
Author:
commit-queue@webkit.org
Message:

Cannot select multiple non-adjacent items in a multiple select control with the keyboard only
https://bugs.webkit.org/show_bug.cgi?id=15816

Patch by Pascal Jacquemart <p.jacquemart@samsung.com> on 2014-01-09
Reviewed by Chris Fleizach.

Source/WebCore:

Test: fast/forms/listbox-non-contiguous-keyboard-selection.html

  • html/HTMLSelectElement.cpp:

(WebCore::HTMLSelectElement::HTMLSelectElement):
New member m_allowsNonContiguousSelection defaults to false
(WebCore::HTMLSelectElement::listBoxDefaultEventHandler):
Tracking CTRL modifier to start multiple non contiguous selection

  • html/HTMLSelectElement.h: New member m_allowsNonContiguousSelection

(WebCore::HTMLSelectElement::allowsNonContiguousSelection): New getter

  • rendering/RenderListBox.cpp:

(WebCore::RenderListBox::addFocusRingRects):
Following implementation made for spatial navigation

LayoutTests:

  • fast/forms/listbox-non-contiguous-keyboard-selection-expected.txt: Added.
  • fast/forms/listbox-non-contiguous-keyboard-selection.html: Added.
  • platform/mac/TestExpectations:

Multiple non contiguous selection with keyboard not enabled on Mac

Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r161556 r161558  
     12014-01-09  Pascal Jacquemart  <p.jacquemart@samsung.com>
     2
     3        Cannot select multiple non-adjacent items in a multiple select control with the keyboard only
     4        https://bugs.webkit.org/show_bug.cgi?id=15816
     5
     6        Reviewed by Chris Fleizach.
     7
     8        * fast/forms/listbox-non-contiguous-keyboard-selection-expected.txt: Added.
     9        * fast/forms/listbox-non-contiguous-keyboard-selection.html: Added.
     10        * platform/mac/TestExpectations:
     11        Multiple non contiguous selection with keyboard not enabled on Mac
     12
    1132014-01-09  Seokju Kwon  <seokju@webkit.org>
    214
  • trunk/LayoutTests/platform/mac/TestExpectations

    r161516 r161558  
    566566platform/mac/fast/forms/listbox-scrollbar-hit-test.html
    567567
     568# Multiple non contiguous selection with keyboard not enabled on mac
     569webkit.org/b/15816 fast/forms/listbox-non-contiguous-keyboard-selection.html [ Skip ]
     570
    568571# <rdar://problem/11224894> Several Japanese vertical text tests failing on Mountain Lion
    569572fast/dynamic/text-combine.html
  • trunk/Source/WebCore/ChangeLog

    r161556 r161558  
     12014-01-09  Pascal Jacquemart  <p.jacquemart@samsung.com>
     2
     3        Cannot select multiple non-adjacent items in a multiple select control with the keyboard only
     4        https://bugs.webkit.org/show_bug.cgi?id=15816
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Test: fast/forms/listbox-non-contiguous-keyboard-selection.html
     9
     10        * html/HTMLSelectElement.cpp:
     11        (WebCore::HTMLSelectElement::HTMLSelectElement):
     12        New member m_allowsNonContiguousSelection defaults to false
     13        (WebCore::HTMLSelectElement::listBoxDefaultEventHandler):
     14        Tracking CTRL modifier to start multiple non contiguous selection
     15        * html/HTMLSelectElement.h: New member m_allowsNonContiguousSelection
     16        (WebCore::HTMLSelectElement::allowsNonContiguousSelection): New getter
     17        * rendering/RenderListBox.cpp:
     18        (WebCore::RenderListBox::addFocusRingRects):
     19        Following implementation made for spatial navigation
     20
    1212014-01-09  Seokju Kwon  <seokju@webkit.org>
    222
  • trunk/Source/WebCore/html/HTMLSelectElement.cpp

    r161199 r161558  
    7575    , m_multiple(false)
    7676    , m_activeSelectionState(false)
     77    , m_allowsNonContiguousSelection(false)
    7778    , m_shouldRecalcListItems(false)
    7879{
     
    14581459            setActiveSelectionEndIndex(endIndex);
    14591460
    1460             bool selectNewItem = !m_multiple || static_cast<KeyboardEvent*>(event)->shiftKey() || !isSpatialNavigationEnabled(document().frame());
     1461#if PLATFORM(MAC)
     1462            m_allowsNonContiguousSelection = m_multiple && isSpatialNavigationEnabled(document().frame());
     1463#else
     1464            m_allowsNonContiguousSelection = m_multiple && (isSpatialNavigationEnabled(document().frame()) || static_cast<KeyboardEvent*>(event)->ctrlKey());
     1465#endif
     1466            bool selectNewItem = static_cast<KeyboardEvent*>(event)->shiftKey() || !m_allowsNonContiguousSelection;
     1467
    14611468            if (selectNewItem)
    14621469                m_activeSelectionState = true;
     
    14881495                form()->submitImplicitly(event, false);
    14891496            event->setDefaultHandled();
    1490         } else if (m_multiple && keyCode == ' ' && isSpatialNavigationEnabled(document().frame())) {
     1497        } else if (m_multiple && keyCode == ' ' && m_allowsNonContiguousSelection) {
    14911498            // Use space to toggle selection change.
    14921499            m_activeSelectionState = !m_activeSelectionState;
  • trunk/Source/WebCore/html/HTMLSelectElement.h

    r161181 r161558  
    112112    // For use in the implementation of HTMLOptionElement.
    113113    void optionSelectionStateChanged(HTMLOptionElement*, bool optionIsSelected);
     114    bool allowsNonContiguousSelection() const { return m_allowsNonContiguousSelection; };
    114115
    115116protected:
     
    209210    bool m_multiple;
    210211    bool m_activeSelectionState;
     212    bool m_allowsNonContiguousSelection;
    211213    mutable bool m_shouldRecalcListItems;
    212214};
  • trunk/Source/WebCore/rendering/RenderListBox.cpp

    r160599 r161558  
    320320void RenderListBox::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer)
    321321{
    322     if (!isSpatialNavigationEnabled(&frame()))
     322    if (!selectElement().allowsNonContiguousSelection())
    323323        return RenderBlockFlow::addFocusRingRects(rects, additionalOffset, paintContainer);
    324324
Note: See TracChangeset for help on using the changeset viewer.