--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -2189,28 +2189,37 @@ nsListControlFrame::KeyDown(nsIDOMEvent*
keyEvent->mKeyCode == NS_VK_HOME ||
keyEvent->mKeyCode == NS_VK_END)) {
// Don't go into multiple-select mode unless this list can handle it.
isControlOrMeta = mControlSelectMode = GetMultiple();
} else if (keyEvent->mKeyCode != NS_VK_SPACE) {
mControlSelectMode = false;
}
+ // We should not change the selection if the popup is "opened
+ // in the parent process" (even when we're in single-process mode).
+ bool shouldSelectByKey = !mComboboxFrame ||
+ !mComboboxFrame->IsOpenInParentProcess();
+
switch (keyEvent->mKeyCode) {
case NS_VK_UP:
case NS_VK_LEFT:
- AdjustIndexForDisabledOpt(mEndSelectionIndex, newIndex,
- static_cast<int32_t>(numOptions),
- -1, -1);
+ if (shouldSelectByKey) {
+ AdjustIndexForDisabledOpt(mEndSelectionIndex, newIndex,
+ static_cast<int32_t>(numOptions),
+ -1, -1);
+ }
break;
case NS_VK_DOWN:
case NS_VK_RIGHT:
- AdjustIndexForDisabledOpt(mEndSelectionIndex, newIndex,
- static_cast<int32_t>(numOptions),
- 1, 1);
+ if (shouldSelectByKey) {
+ AdjustIndexForDisabledOpt(mEndSelectionIndex, newIndex,
+ static_cast<int32_t>(numOptions),
+ 1, 1);
+ }
break;
case NS_VK_RETURN:
if (IsInDropDownMode()) {
if (mComboboxFrame->IsDroppedDown()) {
// If the select element is a dropdown style, Enter key should be
// consumed while the dropdown is open for security.
aKeyEvent->PreventDefault();
@@ -2240,40 +2249,48 @@ nsListControlFrame::KeyDown(nsIDOMEvent*
AboutToRollup();
// If the select element is a dropdown style, Enter key should be
// consumed everytime since Escape key may be pressed accidentally after
// the dropdown is closed by Escepe key.
aKeyEvent->PreventDefault();
return NS_OK;
}
case NS_VK_PAGE_UP: {
- int32_t itemsPerPage =
- std::max(1, static_cast<int32_t>(mNumDisplayRows - 1));
- AdjustIndexForDisabledOpt(mEndSelectionIndex, newIndex,
- static_cast<int32_t>(numOptions),
- -itemsPerPage, -1);
+ if (shouldSelectByKey) {
+ int32_t itemsPerPage =
+ std::max(1, static_cast<int32_t>(mNumDisplayRows - 1));
+ AdjustIndexForDisabledOpt(mEndSelectionIndex, newIndex,
+ static_cast<int32_t>(numOptions),
+ -itemsPerPage, -1);
+ }
break;
}
case NS_VK_PAGE_DOWN: {
- int32_t itemsPerPage =
- std::max(1, static_cast<int32_t>(mNumDisplayRows - 1));
- AdjustIndexForDisabledOpt(mEndSelectionIndex, newIndex,
- static_cast<int32_t>(numOptions),
- itemsPerPage, 1);
+ if (shouldSelectByKey) {
+ int32_t itemsPerPage =
+ std::max(1, static_cast<int32_t>(mNumDisplayRows - 1));
+ AdjustIndexForDisabledOpt(mEndSelectionIndex, newIndex,
+ static_cast<int32_t>(numOptions),
+ itemsPerPage, 1);
+ }
break;
}
case NS_VK_HOME:
- AdjustIndexForDisabledOpt(0, newIndex,
- static_cast<int32_t>(numOptions),
- 0, 1);
+ if (shouldSelectByKey) {
+ AdjustIndexForDisabledOpt(0, newIndex,
+ static_cast<int32_t>(numOptions),
+ 0, 1);
+ }
break;
case NS_VK_END:
- AdjustIndexForDisabledOpt(static_cast<int32_t>(numOptions) - 1, newIndex,
- static_cast<int32_t>(numOptions),
- 0, -1);
+ if (shouldSelectByKey) {
+ AdjustIndexForDisabledOpt(static_cast<int32_t>(numOptions) - 1, newIndex,
+ static_cast<int32_t>(numOptions),
+ 0, -1);
+ }
break;
#if defined(XP_WIN)
case NS_VK_F4:
if (!isControlOrMeta) {
DropDownToggleKey(aKeyEvent);
}
return NS_OK;