Bug 1429690 - Debug mode for content-select to always show the dropdown frame
Add a pref to allow the dropdown frame to be always shown without any
click. It would be useful to develop/debug the dropdown menu and maybe
also useful for testing.
MozReview-Commit-ID: BuXwZL4bt7Z
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -43,16 +43,17 @@
#include "nsThemeConstants.h"
#include "mozilla/Likely.h"
#include <algorithm>
#include "nsTextNode.h"
#include "mozilla/AsyncEventDispatcher.h"
#include "mozilla/EventStates.h"
#include "mozilla/LookAndFeel.h"
#include "mozilla/MouseEvents.h"
+#include "mozilla/Preferences.h"
#include "mozilla/Unused.h"
#include "gfx2DGlue.h"
#include "mozilla/widget/nsAutoRollup.h"
#ifdef XP_WIN
#define COMBOBOX_ROLLUP_CONSUME_EVENT 0
#else
#define COMBOBOX_ROLLUP_CONSUME_EVENT 1
@@ -235,16 +236,23 @@ nsComboboxControlFrame::nsComboboxContro
, mDisplayedIndex(-1)
, mLastDropDownBeforeScreenBCoord(nscoord_MIN)
, mLastDropDownAfterScreenBCoord(nscoord_MIN)
, mDroppedDown(false)
, mInRedisplayText(false)
, mDelayedShowDropDown(false)
, mIsOpenInParentProcess(false)
{
+#ifdef DEBUG
+ if (nsLayoutUtils::IsContentSelectEnabled()) {
+ mAlwaysDroppedDown = Preferences::GetBool("layout.always_show_select_popup.enabled");
+ mDroppedDown |= mAlwaysDroppedDown;
+ }
+#endif
+
REFLOW_COUNTER_INIT()
}
//--------------------------------------------------------------
nsComboboxControlFrame::~nsComboboxControlFrame()
{
REFLOW_COUNTER_DUMP("nsCCF");
}
@@ -340,16 +348,19 @@ nsComboboxControlFrame::ShowList(bool aS
// TODO(kuoe0) Remove this function when content-select is enabled.
//
// This function is used to handle the widget/view stuff, so we just return
// when content-select is enabled. And the following callee, ShowPopup(), will
// also be ignored, it is only used to show and hide the widget.
if (nsLayoutUtils::IsContentSelectEnabled()) {
mDroppedDown = aShowList;
+#ifdef DEBUG
+ mDroppedDown |= mAlwaysDroppedDown;
+#endif
return true;
}
nsView* view = mDropdownFrame->GetView();
if (aShowList) {
NS_ASSERTION(!view->HasWidget(),
"We shouldn't have a widget before we need to display the popup");
--- a/layout/forms/nsComboboxControlFrame.h
+++ b/layout/forms/nsComboboxControlFrame.h
@@ -315,16 +315,21 @@ protected:
bool mDroppedDown;
// See comment in HandleRedisplayTextEvent().
bool mInRedisplayText;
// Acting on ShowDropDown(true) is delayed until we're focused.
bool mDelayedShowDropDown;
bool mIsOpenInParentProcess;
+#ifdef DEBUG
+ // Always show the dropdown frame
+ bool mAlwaysDroppedDown;
+#endif
+
// static class data member for Bug 32920
// only one control can be focused at a time
static nsComboboxControlFrame* sFocused;
#ifdef DO_REFLOW_COUNTER
int32_t mReflowId;
#endif
};
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -1334,16 +1334,21 @@ pref("dom.forms.selectSearch", false);
pref("dom.forms.select.customstyling", false);
#else
pref("dom.forms.select.customstyling", true);
#endif
pref("dom.select_popup_in_parent.enabled", false);
// Bug 1421229 - content-select
pref("dom.select_popup_in_content.enabled", false);
+#ifdef DEBUG
+// Always show the select popup
+pref("layout.always_show_select_popup.enabled", false);
+#endif
+
// Enable Directory API. By default, disabled.
pref("dom.input.dirpicker", false);
// Enable not moving the cursor to end when a text input or textarea has .value
// set to the value it already has. By default, enabled.
pref("dom.input.skip_cursor_move_for_same_value_set", true);
pref("dom.cycle_collector.incremental", true);