From 0d216e928beca7f3d31cfc55d9be1ab3b947e8ed Mon Sep 17 00:00:00 2001 From: James Teh Date: Fri, 13 Sep 2019 03:59:51 +0000 Subject: [PATCH] Bug 1488828: For collapsed select controls in the content process, set the number of rows to the maximum instead of 1. r=dholbert The number of rows for the select dropdown can't be calculated in the content process because the dropdown has to be rendered in the parent process. Therefore, we previously set the number of rows to 1 in this case. That meant that the page up and page down keys only moved one item at a time for a collapsed select control, making them effectively useless. Instead, set the number of rows to the maximum in this case. Differential Revision: https://phabricator.services.mozilla.com/D45154 --HG-- extra : moz-landing-system : lando --- layout/forms/nsListControlFrame.cpp | 6 ++- layout/forms/test/mochitest.ini | 2 + .../test/test_select_collapsed_page_keys.html | 43 +++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 layout/forms/test/test_select_collapsed_page_keys.html diff --git a/layout/forms/nsListControlFrame.cpp b/layout/forms/nsListControlFrame.cpp index b0603d7945eb..7b4610d74eae 100644 --- a/layout/forms/nsListControlFrame.cpp +++ b/layout/forms/nsListControlFrame.cpp @@ -556,7 +556,11 @@ void nsListControlFrame::ReflowAsDropdown(nsPresContext* aPresContext, // Looks like we have no options. Just size us to a single row // block size. state.SetComputedBSize(blockSizeOfARow); - mNumDisplayRows = 1; + // mNumDisplayRows is used as the number of options to move for the page + // up/down keys. If we're in a content process, we can't calculate + // mNumDisplayRows properly, but the maximum number of rows is a lot more + // uesful for page up/down than 1. + mNumDisplayRows = XRE_IsContentProcess() ? kMaxDropDownRows : 1; } else { nsComboboxControlFrame* combobox = static_cast(mComboboxFrame); diff --git a/layout/forms/test/mochitest.ini b/layout/forms/test/mochitest.ini index 1ac780aef0d3..a09ca738924f 100644 --- a/layout/forms/test/mochitest.ini +++ b/layout/forms/test/mochitest.ini @@ -72,3 +72,5 @@ skip-if = toolkit == 'android' [test_bug1529036.html] [test_readonly.html] [test_select_key_navigation_bug1498769.html] +[test_select_collapsed_page_keys.html] +skip-if = os == 'mac' # select control keyboard behavior is different diff --git a/layout/forms/test/test_select_collapsed_page_keys.html b/layout/forms/test/test_select_collapsed_page_keys.html new file mode 100644 index 000000000000..08c161515221 --- /dev/null +++ b/layout/forms/test/test_select_collapsed_page_keys.html @@ -0,0 +1,43 @@ + + + + +Test for page up/down in collapsed select (bug 1488828) + + + + + + +
+ + +
+
+
+ +