Diff
Modified: trunk/LayoutTests/ChangeLog (161557 => 161558)
--- trunk/LayoutTests/ChangeLog 2014-01-09 17:21:02 UTC (rev 161557)
+++ trunk/LayoutTests/ChangeLog 2014-01-09 17:23:48 UTC (rev 161558)
@@ -1,3 +1,15 @@
+2014-01-09 Pascal Jacquemart <[email protected]>
+
+ Cannot select multiple non-adjacent items in a multiple select control with the keyboard only
+ https://bugs.webkit.org/show_bug.cgi?id=15816
+
+ Reviewed by Chris Fleizach.
+
+ * 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
+
2014-01-09 Seokju Kwon <[email protected]>
Web Inspector: Remove unused overriding protocols.
Added: trunk/LayoutTests/fast/forms/listbox-non-contiguous-keyboard-selection-expected.txt (0 => 161558)
--- trunk/LayoutTests/fast/forms/listbox-non-contiguous-keyboard-selection-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/forms/listbox-non-contiguous-keyboard-selection-expected.txt 2014-01-09 17:23:48 UTC (rev 161558)
@@ -0,0 +1,11 @@
+<select> selection test for multiple but non contiguous selection with keyboard.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+1) Select multiple non-adjacent items with the keyboard
+PASS selectionPattern("sl1") is "01010"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/forms/listbox-non-contiguous-keyboard-selection.html (0 => 161558)
--- trunk/LayoutTests/fast/forms/listbox-non-contiguous-keyboard-selection.html (rev 0)
+++ trunk/LayoutTests/fast/forms/listbox-non-contiguous-keyboard-selection.html 2014-01-09 17:23:48 UTC (rev 161558)
@@ -0,0 +1,65 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description('<select> selection test for multiple but non contiguous selection with keyboard.');
+
+function keyDownOnSelect(selId, identifier, modifier) {
+ document.getElementById(selId).focus();
+ if (window.eventSender)
+ eventSender.keyDown(identifier, [modifier]);
+}
+
+function createSelect(idName, sz, mlt, selIndex) {
+ var sl = document.createElement("select");
+ var i = 0;
+ sl.size = sz;
+ while (i < sz) {
+ var opt = document.createElement("option");
+ if (i == selIndex)
+ opt.selected = true;
+ opt.textContent = "item " + i;
+ sl.appendChild(opt);
+ i++;
+ }
+ sl.multiple = mlt;
+ sl.id = idName;
+ var parent = document.getElementById("parent");
+ parent.appendChild(sl);
+}
+
+function selectionPattern(selId) {
+ var sl = document.getElementById(selId);
+ var result = '';
+ for (var i = 0; i < sl.options.length; i++)
+ result += sl.options[i].selected ? '1' : '0';
+ return result;
+}
+
+var parent = document.createElement('div');
+parent.id = "parent";
+document.body.appendChild(parent);
+
+createSelect("sl1", 5, true, -1);
+
+debug("1) Select multiple non-adjacent items with the keyboard");
+// Move to second item.
+keyDownOnSelect("sl1", "downArrow", "addSelectionKey");
+keyDownOnSelect("sl1", "downArrow", "addSelectionKey");
+// Select it.
+keyDownOnSelect("sl1", " ");
+// Move to fourth item.
+keyDownOnSelect("sl1", "downArrow", "addSelectionKey");
+keyDownOnSelect("sl1", "downArrow", "addSelectionKey");
+// Select it.
+keyDownOnSelect("sl1", " ");
+shouldBe('selectionPattern("sl1")', '"01010"');
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/platform/mac/TestExpectations (161557 => 161558)
--- trunk/LayoutTests/platform/mac/TestExpectations 2014-01-09 17:21:02 UTC (rev 161557)
+++ trunk/LayoutTests/platform/mac/TestExpectations 2014-01-09 17:23:48 UTC (rev 161558)
@@ -565,6 +565,9 @@
fast/events/show-modal-dialog-onblur-onfocus.html
platform/mac/fast/forms/listbox-scrollbar-hit-test.html
+# Multiple non contiguous selection with keyboard not enabled on mac
+webkit.org/b/15816 fast/forms/listbox-non-contiguous-keyboard-selection.html [ Skip ]
+
# <rdar://problem/11224894> Several Japanese vertical text tests failing on Mountain Lion
fast/dynamic/text-combine.html
fast/repaint/japanese-rl-selection-clear.html
Modified: trunk/Source/WebCore/ChangeLog (161557 => 161558)
--- trunk/Source/WebCore/ChangeLog 2014-01-09 17:21:02 UTC (rev 161557)
+++ trunk/Source/WebCore/ChangeLog 2014-01-09 17:23:48 UTC (rev 161558)
@@ -1,3 +1,23 @@
+2014-01-09 Pascal Jacquemart <[email protected]>
+
+ Cannot select multiple non-adjacent items in a multiple select control with the keyboard only
+ https://bugs.webkit.org/show_bug.cgi?id=15816
+
+ Reviewed by Chris Fleizach.
+
+ 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
+
2014-01-09 Seokju Kwon <[email protected]>
Web Inspector: Remove unused overriding protocols.
Modified: trunk/Source/WebCore/html/HTMLSelectElement.cpp (161557 => 161558)
--- trunk/Source/WebCore/html/HTMLSelectElement.cpp 2014-01-09 17:21:02 UTC (rev 161557)
+++ trunk/Source/WebCore/html/HTMLSelectElement.cpp 2014-01-09 17:23:48 UTC (rev 161558)
@@ -74,6 +74,7 @@
, m_isProcessingUserDrivenChange(false)
, m_multiple(false)
, m_activeSelectionState(false)
+ , m_allowsNonContiguousSelection(false)
, m_shouldRecalcListItems(false)
{
ASSERT(hasTagName(selectTag));
@@ -1457,7 +1458,13 @@
ASSERT_UNUSED(listItems, !listItems.size() || static_cast<size_t>(endIndex) < listItems.size());
setActiveSelectionEndIndex(endIndex);
- bool selectNewItem = !m_multiple || static_cast<KeyboardEvent*>(event)->shiftKey() || !isSpatialNavigationEnabled(document().frame());
+#if PLATFORM(MAC)
+ m_allowsNonContiguousSelection = m_multiple && isSpatialNavigationEnabled(document().frame());
+#else
+ m_allowsNonContiguousSelection = m_multiple && (isSpatialNavigationEnabled(document().frame()) || static_cast<KeyboardEvent*>(event)->ctrlKey());
+#endif
+ bool selectNewItem = static_cast<KeyboardEvent*>(event)->shiftKey() || !m_allowsNonContiguousSelection;
+
if (selectNewItem)
m_activeSelectionState = true;
// If the anchor is unitialized, or if we're going to deselect all
@@ -1487,7 +1494,7 @@
if (form())
form()->submitImplicitly(event, false);
event->setDefaultHandled();
- } else if (m_multiple && keyCode == ' ' && isSpatialNavigationEnabled(document().frame())) {
+ } else if (m_multiple && keyCode == ' ' && m_allowsNonContiguousSelection) {
// Use space to toggle selection change.
m_activeSelectionState = !m_activeSelectionState;
ASSERT(m_activeSelectionEndIndex >= 0
Modified: trunk/Source/WebCore/html/HTMLSelectElement.h (161557 => 161558)
--- trunk/Source/WebCore/html/HTMLSelectElement.h 2014-01-09 17:21:02 UTC (rev 161557)
+++ trunk/Source/WebCore/html/HTMLSelectElement.h 2014-01-09 17:23:48 UTC (rev 161558)
@@ -111,6 +111,7 @@
// For use in the implementation of HTMLOptionElement.
void optionSelectionStateChanged(HTMLOptionElement*, bool optionIsSelected);
+ bool allowsNonContiguousSelection() const { return m_allowsNonContiguousSelection; };
protected:
HTMLSelectElement(const QualifiedName&, Document&, HTMLFormElement*);
@@ -208,6 +209,7 @@
bool m_isProcessingUserDrivenChange;
bool m_multiple;
bool m_activeSelectionState;
+ bool m_allowsNonContiguousSelection;
mutable bool m_shouldRecalcListItems;
};
Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (161557 => 161558)
--- trunk/Source/WebCore/rendering/RenderListBox.cpp 2014-01-09 17:21:02 UTC (rev 161557)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp 2014-01-09 17:23:48 UTC (rev 161558)
@@ -319,7 +319,7 @@
void RenderListBox::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer)
{
- if (!isSpatialNavigationEnabled(&frame()))
+ if (!selectElement().allowsNonContiguousSelection())
return RenderBlockFlow::addFocusRingRects(rects, additionalOffset, paintContainer);
// Focus the last selected item.