Bug 1805414 - Remove nsMenuFrame and nsMenuParent. r=smaug,Jamie,desktop-theme-reviewers,settings-reviewers,dao
Move most the event handling stuff to the DOM. I've left nsMenuBarFrame
for now, but I will be removing that in the future.
The basic set up is:
* nsMenuParent becomes XULMenuParentElement (menubar or popup, manages
the current active menu item)
* nsMenuFrame -> XULButtonElements that return true for IsMenu().
Can't use XULMenuElement because of <button type=menu>, which
behaves like a, well, menu.
This makes the a11y events for menus (DOMMenuItem{Active,Inactive}) make
sense (before that we were firing duplicate Inactive events etc, and the
event order was rather suspicious).
Differential Revision: https://phabricator.services.mozilla.com/D164210
This commit is contained in:
@@ -202,7 +202,6 @@ static FrameCtorDebugFlags gFlags[] = {
|
||||
# define NUM_DEBUG_FLAGS (sizeof(gFlags) / sizeof(gFlags[0]))
|
||||
#endif
|
||||
|
||||
#include "nsMenuFrame.h"
|
||||
#include "nsTreeColFrame.h"
|
||||
|
||||
//------------------------------------------------------------------
|
||||
@@ -4152,15 +4151,10 @@ nsCSSFrameConstructor::FindXULTagData(const Element& aElement,
|
||||
SIMPLE_XUL_CREATE(image, NS_NewImageBoxFrame),
|
||||
SIMPLE_XUL_CREATE(treechildren, NS_NewTreeBodyFrame),
|
||||
SIMPLE_XUL_CREATE(treecol, NS_NewTreeColFrame),
|
||||
SIMPLE_TAG_CHAIN(button, nsCSSFrameConstructor::FindXULButtonData),
|
||||
SIMPLE_TAG_CHAIN(toolbarbutton, nsCSSFrameConstructor::FindXULButtonData),
|
||||
SIMPLE_TAG_CHAIN(label,
|
||||
nsCSSFrameConstructor::FindXULLabelOrDescriptionData),
|
||||
SIMPLE_TAG_CHAIN(description,
|
||||
nsCSSFrameConstructor::FindXULLabelOrDescriptionData),
|
||||
SIMPLE_XUL_CREATE(menu, NS_NewMenuFrame),
|
||||
SIMPLE_XUL_CREATE(menulist, NS_NewMenuFrame),
|
||||
SIMPLE_XUL_CREATE(menuitem, NS_NewMenuItemFrame),
|
||||
#ifdef XP_MACOSX
|
||||
SIMPLE_TAG_CHAIN(menubar, nsCSSFrameConstructor::FindXULMenubarData),
|
||||
#else
|
||||
@@ -4181,19 +4175,6 @@ nsCSSFrameConstructor::FindXULTagData(const Element& aElement,
|
||||
return FindDataByTag(aElement, aStyle, sXULTagData, ArrayLength(sXULTagData));
|
||||
}
|
||||
|
||||
/* static */
|
||||
const nsCSSFrameConstructor::FrameConstructionData*
|
||||
nsCSSFrameConstructor::FindXULButtonData(const Element& aElement,
|
||||
ComputedStyle&) {
|
||||
static constexpr FrameConstructionData sXULMenuData =
|
||||
SIMPLE_XUL_FCDATA(NS_NewMenuFrame);
|
||||
if (aElement.AttrValueIs(kNameSpaceID_None, nsGkAtoms::type, nsGkAtoms::menu,
|
||||
eCaseMatters)) {
|
||||
return &sXULMenuData;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* static */
|
||||
const nsCSSFrameConstructor::FrameConstructionData*
|
||||
nsCSSFrameConstructor::FindXULLabelOrDescriptionData(const Element& aElement,
|
||||
@@ -5438,9 +5419,7 @@ void nsCSSFrameConstructor::AddFrameConstructionItemsInternal(
|
||||
return;
|
||||
}
|
||||
|
||||
const bool isPopup =
|
||||
(data->mBits & FCDATA_IS_POPUP) && (!aParentFrame || // Parent is inline
|
||||
!aParentFrame->IsMenuFrame());
|
||||
const bool isPopup = data->mBits & FCDATA_IS_POPUP;
|
||||
|
||||
const uint32_t bits = data->mBits;
|
||||
|
||||
@@ -5932,17 +5911,13 @@ void nsCSSFrameConstructor::AppendFramesToParent(
|
||||
bool nsCSSFrameConstructor::IsValidSibling(nsIFrame* aSibling,
|
||||
nsIContent* aContent,
|
||||
Maybe<StyleDisplay>& aDisplay) {
|
||||
nsIFrame* parentFrame = aSibling->GetParent();
|
||||
LayoutFrameType parentType = parentFrame->Type();
|
||||
|
||||
StyleDisplay siblingDisplay = aSibling->GetDisplay();
|
||||
if (StyleDisplay::TableColumnGroup == siblingDisplay ||
|
||||
StyleDisplay::TableColumn == siblingDisplay ||
|
||||
StyleDisplay::TableCaption == siblingDisplay ||
|
||||
StyleDisplay::TableHeaderGroup == siblingDisplay ||
|
||||
StyleDisplay::TableRowGroup == siblingDisplay ||
|
||||
StyleDisplay::TableFooterGroup == siblingDisplay ||
|
||||
LayoutFrameType::Menu == parentType) {
|
||||
StyleDisplay::TableFooterGroup == siblingDisplay) {
|
||||
// if we haven't already, resolve a style to find the display type of
|
||||
// aContent.
|
||||
if (aDisplay.isNothing()) {
|
||||
|
||||
Reference in New Issue
Block a user