--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -3239,32 +3239,34 @@ nsCSSFrameConstructor::ConstructSelectFr
if (!Preferences::GetBool(kPrefSelectPopupInContent)) {
// TODO(kuoe0) Remove this assertion when content-select is shipped.
NS_ASSERTION(!listFrame->IsAbsPosContainingBlock(),
"Ended up with positioned dropdown list somehow.");
}
NS_ASSERTION(!listFrame->IsFloating(),
"Ended up with floating dropdown list somehow.");
+ // child frames of combobox frame
+ nsFrameItems childItems;
+
// Initialize the scroll frame positioned. Note that it is NOT
// initialized as absolutely positioned.
nsContainerFrame* scrolledFrame =
NS_NewSelectsAreaFrame(mPresShell, styleContext, flags);
InitializeSelectFrame(aState, listFrame, scrolledFrame, content,
comboboxFrame, listStyle, true,
- aItem.mPendingBinding, aFrameItems);
+ aItem.mPendingBinding, childItems);
NS_ASSERTION(listFrame->GetView(), "ListFrame's view is nullptr");
// Create display and button frames from the combobox's anonymous content.
// The anonymous content is appended to existing anonymous content for this
// element (the scrollbars).
- nsFrameItems childItems;
-
+ //
// nsComboboxControlFrame needs special frame creation behavior for its first
// piece of anonymous content, which means that we can't take the normal
// ProcessChildren path.
AutoTArray<nsIAnonymousContentCreator::ContentInfo, 2> newAnonymousItems;
DebugOnly<nsresult> rv = GetAnonymousContent(content, comboboxFrame, newAnonymousItems);
MOZ_ASSERT(NS_SUCCEEDED(rv));
MOZ_ASSERT(newAnonymousItems.Length() == 2);
@@ -3281,22 +3283,24 @@ nsCSSFrameConstructor::ConstructSelectFr
AddFCItemsForAnonymousContent(aState, comboboxFrame, newAnonymousItems,
fcItems);
ConstructFramesFromItemList(aState, fcItems, comboboxFrame,
/* aParentIsWrapperAnonBox = */ false,
childItems);
comboboxFrame->SetInitialChildList(kPrincipalList, childItems);
- // Initialize the additional popup child list which contains the
- // dropdown list frame.
- nsFrameItems popupItems;
- popupItems.AddChild(listFrame);
- comboboxFrame->SetInitialChildList(nsIFrame::kSelectPopupList,
- popupItems);
+ if (!Preferences::GetBool(kPrefSelectPopupInContent)) {
+ // Initialize the additional popup child list which contains the
+ // dropdown list frame.
+ nsFrameItems popupItems;
+ popupItems.AddChild(listFrame);
+ comboboxFrame->SetInitialChildList(nsIFrame::kSelectPopupList,
+ popupItems);
+ }
aState.mFrameState = historyState;
if (aState.mFrameState) {
// Restore frame state for the entire subtree of |comboboxFrame|.
RestoreFrameState(comboboxFrame, aState.mFrameState);
}
return comboboxFrame;
}
@@ -3338,17 +3342,17 @@ nsCSSFrameConstructor::InitializeSelectF
aState.GetGeometricParent(aStyleContext->StyleDisplay(), aParentFrame);
// We don't call InitAndRestoreFrame for scrollFrame because we can only
// restore the frame state after its parts have been created (in particular,
// the scrollable view). So we have to split Init and Restore.
scrollFrame->Init(aContent, geometricParent, nullptr);
- if (!aBuildCombobox) {
+ if (!aBuildCombobox || Preferences::GetBool(kPrefSelectPopupInContent)) {
aState.AddChild(scrollFrame, aFrameItems, aContent, aParentFrame);
}
BuildScrollFrame(aState, aContent, aStyleContext, scrolledFrame,
geometricParent, scrollFrame);
if (aState.mFrameState) {
// Restore frame state for the scroll frame