Bug 1799580 - Remove display: -moz-popup. r=TYLin

We already rely on it applying only to XULPopupElement's. Make it
explicit and remove the CSS value.

Differential Revision: https://phabricator.services.mozilla.com/D161552
This commit is contained in:
Emilio Cobos Álvarez
2022-11-09 09:17:22 +00:00
parent 8394b73152
commit f496edbc02
28 changed files with 56 additions and 173 deletions

View File

@@ -2399,14 +2399,12 @@ nsIFrame* nsCSSFrameConstructor::ConstructDocElementFrame(
} else if (display->mDisplay == StyleDisplay::Flex ||
display->mDisplay == StyleDisplay::WebkitBox ||
display->mDisplay == StyleDisplay::Grid ||
display->mDisplay == StyleDisplay::MozBox ||
display->mDisplay == StyleDisplay::MozPopup) {
display->mDisplay == StyleDisplay::MozBox) {
auto func = [&] {
if (display->mDisplay == StyleDisplay::Grid) {
return NS_NewGridContainerFrame;
}
if ((display->mDisplay == StyleDisplay::MozBox ||
display->mDisplay == StyleDisplay::MozPopup) &&
if (display->mDisplay == StyleDisplay::MozBox &&
!computedStyle->StyleVisibility()->EmulateMozBoxWithFlex()) {
return NS_NewBoxFrame;
}
@@ -4022,6 +4020,8 @@ const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindXULTagData(const Element& aElement,
ComputedStyle& aStyle) {
MOZ_ASSERT(aElement.IsXULElement());
static constexpr FrameConstructionData kPopupData(
NS_NewMenuPopupFrame, FCDATA_IS_POPUP | FCDATA_SKIP_ABSPOS_PUSH);
static constexpr FrameConstructionDataByTag sXULTagData[] = {
SIMPLE_XUL_CREATE(image, NS_NewImageBoxFrame),
@@ -4047,7 +4047,11 @@ nsCSSFrameConstructor::FindXULTagData(const Element& aElement,
SIMPLE_XUL_CREATE(splitter, NS_NewSplitterFrame),
SIMPLE_XUL_CREATE(slider, NS_NewSliderFrame),
SIMPLE_XUL_CREATE(scrollbar, NS_NewScrollbarFrame),
SIMPLE_XUL_CREATE(scrollbarbutton, NS_NewScrollbarButtonFrame)};
SIMPLE_XUL_CREATE(scrollbarbutton, NS_NewScrollbarButtonFrame),
{nsGkAtoms::panel, kPopupData},
{nsGkAtoms::menupopup, kPopupData},
{nsGkAtoms::tooltip, kPopupData},
};
return FindDataByTag(aElement, aStyle, sXULTagData, ArrayLength(sXULTagData));
}
@@ -4457,11 +4461,6 @@ nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay& aDisplay,
FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRuby));
return &data;
}
case StyleDisplayInside::MozPopup: {
static constexpr FrameConstructionData data(
NS_NewMenuPopupFrame, FCDATA_IS_POPUP | FCDATA_SKIP_ABSPOS_PUSH);
return &data;
}
default:
MOZ_ASSERT_UNREACHABLE("unknown 'display' value");
return nullptr;
@@ -5465,15 +5464,6 @@ void nsCSSFrameConstructor::ConstructFramesFromItem(
nsContainerFrame* aParentFrame, nsFrameList& aFrameList) {
FrameConstructionItem& item = aIter.item();
ComputedStyle* computedStyle = item.mComputedStyle;
const auto* disp = computedStyle->StyleDisplay();
MOZ_ASSERT(!disp->IsAbsolutelyPositionedStyle() ||
disp->DisplayInside() != StyleDisplayInside::MozBox,
"This may be a frame that was previously blockified "
"but isn't any longer! It probably needs explicit "
"'display:block' to preserve behavior");
Unused << disp; // (unused in configs that define the assertion away)
if (item.mIsText) {
// If this is collapsible whitespace next to a line boundary,
// don't create a frame. item.IsWhitespace() also sets the
@@ -5843,10 +5833,6 @@ bool nsCSSFrameConstructor::IsValidSibling(nsIFrame* aSibling,
}
StyleDisplay display = aDisplay.value();
if (LayoutFrameType::Menu == parentType) {
return (StyleDisplay::MozPopup == display) ==
(StyleDisplay::MozPopup == siblingDisplay);
}
// To have decent performance we want to return false in cases in which
// reordering the two siblings has no effect on display. To ensure
// correctness, we MUST return false in cases where the two siblings have