--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -2062,41 +2062,41 @@ nsCSSFrameConstructor::ConstructTable(ns
nsFrameItems& aFrameItems)
{
NS_PRECONDITION(aDisplay->mDisplay == StyleDisplay::Table ||
aDisplay->mDisplay == StyleDisplay::InlineTable,
"Unexpected call");
nsIContent* const content = aItem.mContent;
ComputedStyle* const computedStyle = aItem.mComputedStyle;
- const uint32_t nameSpaceID = aItem.mNameSpaceID;
+ const bool isMathMLContent = content->IsMathMLElement();
// create the pseudo SC for the table wrapper as a child of the inner SC
RefPtr<ComputedStyle> outerComputedStyle;
outerComputedStyle = mPresShell->StyleSet()->
ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::tableWrapper,
computedStyle);
// Create the table wrapper frame which holds the caption and inner table frame
nsContainerFrame* newFrame;
- if (kNameSpaceID_MathML == nameSpaceID)
+ if (isMathMLContent)
newFrame = NS_NewMathMLmtableOuterFrame(mPresShell, outerComputedStyle);
else
newFrame = NS_NewTableWrapperFrame(mPresShell, outerComputedStyle);
nsContainerFrame* geometricParent =
aState.GetGeometricParent(outerComputedStyle->StyleDisplay(),
aParentFrame);
// Init the table wrapper frame
InitAndRestoreFrame(aState, content, geometricParent, newFrame);
// Create the inner table frame
nsContainerFrame* innerFrame;
- if (kNameSpaceID_MathML == nameSpaceID)
+ if (isMathMLContent)
innerFrame = NS_NewMathMLmtableFrame(mPresShell, computedStyle);
else
innerFrame = NS_NewTableFrame(mPresShell, computedStyle);
InitAndRestoreFrame(aState, content, newFrame, innerFrame);
innerFrame->AddStateBits(NS_FRAME_OWNS_ANON_BOXES);
// Put the newly created frames into the right child list
@@ -2181,21 +2181,20 @@ nsCSSFrameConstructor::ConstructTableRow
aDisplay->mDisplay == StyleDisplay::TableRowGroup ||
aDisplay->mDisplay == StyleDisplay::TableFooterGroup ||
aDisplay->mDisplay == StyleDisplay::TableHeaderGroup,
"Not a row or row group");
MOZ_ASSERT(aItem.mComputedStyle->StyleDisplay() == aDisplay,
"Display style doesn't match style");
nsIContent* const content = aItem.mContent;
ComputedStyle* const computedStyle = aItem.mComputedStyle;
- const uint32_t nameSpaceID = aItem.mNameSpaceID;
nsContainerFrame* newFrame;
if (aDisplay->mDisplay == StyleDisplay::TableRow) {
- if (kNameSpaceID_MathML == nameSpaceID)
+ if (content->IsMathMLElement())
newFrame = NS_NewMathMLmtrFrame(mPresShell, computedStyle);
else
newFrame = NS_NewTableRowFrame(mPresShell, computedStyle);
} else {
newFrame = NS_NewTableRowGroupFrame(mPresShell, computedStyle);
}
InitAndRestoreFrame(aState, content, aParentFrame, newFrame);
@@ -2262,29 +2261,29 @@ nsCSSFrameConstructor::ConstructTableCel
const nsStyleDisplay* aDisplay,
nsFrameItems& aFrameItems)
{
MOZ_ASSERT(aDisplay->mDisplay == StyleDisplay::TableCell,
"Unexpected call");
nsIContent* const content = aItem.mContent;
ComputedStyle* const computedStyle = aItem.mComputedStyle;
- const uint32_t nameSpaceID = aItem.mNameSpaceID;
+ const bool isMathMLContent = content->IsMathMLElement();
nsTableFrame* tableFrame =
static_cast<nsTableRowFrame*>(aParentFrame)->GetTableFrame();
nsContainerFrame* newFrame;
// <mtable> is border separate in mathml.css and the MathML code doesn't implement
// border collapse. For those users who style <mtable> with border collapse,
// give them the default non-MathML table frames that understand border collapse.
// This won't break us because MathML table frames are all subclasses of the default
// table code, and so we can freely mix <mtable> with <mtr> or <tr>, <mtd> or <td>.
// What will happen is just that non-MathML frames won't understand MathML attributes
// and will therefore miss the special handling that the MathML code does.
- if (kNameSpaceID_MathML == nameSpaceID && !tableFrame->IsBorderCollapse()) {
+ if (isMathMLContent && !tableFrame->IsBorderCollapse()) {
newFrame = NS_NewMathMLmtdFrame(mPresShell, computedStyle, tableFrame);
} else {
// Warning: If you change this and add a wrapper frame around table cell
// frames, make sure Bug 368554 doesn't regress!
// See IsInAutoWidthTableCellForQuirk() in nsImageFrame.cpp.
newFrame = NS_NewTableCellFrame(mPresShell, computedStyle, tableFrame);
}
@@ -2296,17 +2295,17 @@ nsCSSFrameConstructor::ConstructTableCel
RefPtr<ComputedStyle> innerPseudoStyle;
innerPseudoStyle = mPresShell->StyleSet()->
ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::cellContent,
computedStyle);
// Create a block frame that will format the cell's content
bool isBlock;
nsContainerFrame* cellInnerFrame;
- if (kNameSpaceID_MathML == nameSpaceID) {
+ if (isMathMLContent) {
cellInnerFrame = NS_NewMathMLmtdInnerFrame(mPresShell, innerPseudoStyle);
isBlock = false;
} else {
cellInnerFrame = NS_NewBlockFormattingContext(mPresShell, innerPseudoStyle);
isBlock = true;
}
InitAndRestoreFrame(aState, content, newFrame, cellInnerFrame);
@@ -2539,19 +2538,17 @@ nsCSSFrameConstructor::ConstructDocEleme
// FrameConstructionData/Item, then we'd need the right function
// here... but would probably be able to get away with less code in this
// function in general.
// Use a null PendingBinding, since our binding is not in fact pending.
static const FrameConstructionData rootSVGData = FCDATA_DECL(0, nullptr);
already_AddRefed<ComputedStyle> extraRef =
RefPtr<ComputedStyle>(computedStyle).forget();
AutoFrameConstructionItem item(this, &rootSVGData, aDocElement,
- aDocElement->NodeInfo()->NameAtom(),
- kNameSpaceID_SVG, nullptr, extraRef, true,
- nullptr);
+ nullptr, extraRef, true, nullptr);
nsFrameItems frameItems;
contentFrame = static_cast<nsContainerFrame*>(
ConstructOuterSVG(state, item, mDocElementContainingBlock,
computedStyle->StyleDisplay(),
frameItems));
newFrame = frameItems.FirstChild();
NS_ASSERTION(frameItems.OnlyChild(), "multiple root element frames");
@@ -2591,19 +2588,17 @@ nsCSSFrameConstructor::ConstructDocEleme
// FrameConstructionData/Item, then we'd need the right function
// here... but would probably be able to get away with less code in this
// function in general.
// Use a null PendingBinding, since our binding is not in fact pending.
static const FrameConstructionData rootTableData = FCDATA_DECL(0, nullptr);
already_AddRefed<ComputedStyle> extraRef =
RefPtr<ComputedStyle>(computedStyle).forget();
AutoFrameConstructionItem item(this, &rootTableData, aDocElement,
- aDocElement->NodeInfo()->NameAtom(),
- kNameSpaceID_None, nullptr, extraRef, true,
- nullptr);
+ nullptr, extraRef, true, nullptr);
nsFrameItems frameItems;
// if the document is a table then just populate it.
contentFrame = static_cast<nsContainerFrame*>(
ConstructTable(state, item, mDocElementContainingBlock,
computedStyle->StyleDisplay(),
frameItems));
newFrame = frameItems.FirstChild();
@@ -5529,19 +5524,18 @@ nsCSSFrameConstructor::AddPageBreakItem(
MOZ_ASSERT(pseudoStyle->StyleDisplay()->mDisplay == StyleDisplay::Block,
"Unexpected display");
static const FrameConstructionData sPageBreakData =
FCDATA_DECL(FCDATA_SKIP_FRAMESET, NS_NewPageBreakFrame);
// Lie about the tag and namespace so we don't trigger anything
// interesting during frame construction.
- aItems.AppendItem(this, &sPageBreakData, aContent, nsCSSAnonBoxes::pageBreak,
- kNameSpaceID_None, nullptr, pseudoStyle.forget(),
- true, nullptr);
+ aItems.AppendItem(this, &sPageBreakData, aContent, nullptr,
+ pseudoStyle.forget(), true, nullptr);
}
bool
nsCSSFrameConstructor::ShouldCreateItemsForChild(nsFrameConstructorState& aState,
nsIContent* aContent,
nsContainerFrame* aParentFrame)
{
aContent->UnsetFlags(NODE_DESCENDANTS_NEED_FRAMES | NODE_NEEDS_FRAME);
@@ -5895,25 +5889,26 @@ nsCSSFrameConstructor::AddFrameConstruct
}
FrameConstructionItem* item = nullptr;
if (details && details->Open()) {
auto* summary = HTMLSummaryElement::FromNodeOrNull(aContent);
if (summary && summary->IsMainSummary()) {
// If details is open, the main summary needs to be rendered as if it is
// the first child, so add the item to the front of the item list.
- item = aItems.PrependItem(this, data, aContent, tag, namespaceId,
- pendingBinding, computedStyle.forget(),
- aSuppressWhiteSpaceOptimizations, aAnonChildren);
+ item = aItems.PrependItem(this, data, aContent, pendingBinding,
+ computedStyle.forget(),
+ aSuppressWhiteSpaceOptimizations,
+ aAnonChildren);
}
}
if (!item) {
- item = aItems.AppendItem(this, data, aContent, tag, namespaceId,
- pendingBinding, computedStyle.forget(),
+ item = aItems.AppendItem(this, data, aContent, pendingBinding,
+ computedStyle.forget(),
aSuppressWhiteSpaceOptimizations, aAnonChildren);
}
item->mIsText = isText;
item->mIsGeneratedContent = isGeneratedContent;
item->mIsAnonymousContentCreatorContent =
aFlags & ITEM_IS_ANONYMOUSCONTENTCREATOR_CONTENT;
if (isGeneratedContent) {
// We need to keep this alive until the frame takes ownership.
@@ -9540,19 +9535,16 @@ nsCSSFrameConstructor::CreateNeededAnonF
FCDATA_USE_CHILD_ITEMS |
FCDATA_IS_WRAPPER_ANON_BOX,
NS_NewBlockFormattingContext);
FrameConstructionItem* newItem =
new (this) FrameConstructionItem(&sBlockFormattingContextFCData,
// Use the content of our parent frame
parentContent,
- // Lie about the tag; it doesn't matter anyway
- pseudoType,
- iter.item().mNameSpaceID,
// no pending binding
nullptr,
wrapperStyle,
true, nullptr);
newItem->mIsAllInline = newItem->mHasInlineEnds =
newItem->mComputedStyle->StyleDisplay()->IsInlineOutsideStyle();
newItem->mIsBlock = !newItem->mIsAllInline;
@@ -10045,22 +10037,16 @@ nsCSSFrameConstructor::WrapItemsInPseudo
wrapperStyle =
mPresShell->StyleSet()->ResolveNonInheritingAnonymousBoxStyle(pseudoType);
}
FrameConstructionItem* newItem =
new (this) FrameConstructionItem(&pseudoData.mFCData,
// Use the content of our parent frame
aParentContent,
- // Lie about the tag; it doesn't matter anyway
- pseudoType,
- // The namespace does matter, however; it needs
- // to match that of our first child item to
- // match the old behavior
- aIter.item().mNameSpaceID,
// no pending binding
nullptr,
wrapperStyle,
true, nullptr);
const nsStyleDisplay* disp = newItem->mComputedStyle->StyleDisplay();
// Here we're cheating a tad... technically, table-internal items should be
// inline if aParentFrame is inline, but they'll get wrapped in an
@@ -10116,20 +10102,16 @@ nsCSSFrameConstructor::CreateNeededPseud
sPseudoParentData[eTypeRubyBaseContainer];
already_AddRefed<ComputedStyle> pseudoStyle = mPresShell->StyleSet()->
ResolveInheritingAnonymousBoxStyle(*pseudoData.mPseudoType,
aParentFrame->Style());
FrameConstructionItem* newItem =
new (this) FrameConstructionItem(&pseudoData.mFCData,
// Use the content of the parent frame
aParentFrame->GetContent(),
- // Tag type
- *pseudoData.mPseudoType,
- // Use the namespace of the rtc frame
- iter.item().mNameSpaceID,
// no pending binding
nullptr,
pseudoStyle,
true, nullptr);
newItem->mIsAllInline = true;
newItem->mChildItems.SetParentHasNoXBLChildren(true);
iter.InsertItem(newItem);
}
--- a/layout/base/nsCSSFrameConstructor.h
+++ b/layout/base/nsCSSFrameConstructor.h
@@ -849,47 +849,43 @@ private:
// aSuppressWhiteSpaceOptimizations is true if optimizations that
// skip constructing whitespace frames for this item or items
// around it cannot be performed.
// Also, the return value is always non-null, thanks to infallible 'new'.
FrameConstructionItem* AppendItem(nsCSSFrameConstructor* aFCtor,
const FrameConstructionData* aFCData,
nsIContent* aContent,
- nsAtom* aTag,
- int32_t aNameSpaceID,
PendingBinding* aPendingBinding,
already_AddRefed<ComputedStyle>&& aComputedStyle,
bool aSuppressWhiteSpaceOptimizations,
nsTArray<nsIAnonymousContentCreator::ContentInfo>* aAnonChildren)
{
FrameConstructionItem* item =
- new (aFCtor) FrameConstructionItem(aFCData, aContent, aTag, aNameSpaceID,
+ new (aFCtor) FrameConstructionItem(aFCData, aContent,
aPendingBinding, aComputedStyle,
aSuppressWhiteSpaceOptimizations,
aAnonChildren);
mItems.insertBack(item);
++mItemCount;
++mDesiredParentCounts[item->DesiredParentType()];
return item;
}
// Arguments are the same as AppendItem().
FrameConstructionItem* PrependItem(nsCSSFrameConstructor* aFCtor,
const FrameConstructionData* aFCData,
nsIContent* aContent,
- nsAtom* aTag,
- int32_t aNameSpaceID,
PendingBinding* aPendingBinding,
already_AddRefed<ComputedStyle>&& aComputedStyle,
bool aSuppressWhiteSpaceOptimizations,
nsTArray<nsIAnonymousContentCreator::ContentInfo>* aAnonChildren)
{
FrameConstructionItem* item =
- new (aFCtor) FrameConstructionItem(aFCData, aContent, aTag, aNameSpaceID,
+ new (aFCtor) FrameConstructionItem(aFCData, aContent,
aPendingBinding, aComputedStyle,
aSuppressWhiteSpaceOptimizations,
aAnonChildren);
mItems.insertFront(item);
++mItemCount;
++mDesiredParentCounts[item->DesiredParentType()];
return item;
}
@@ -1126,25 +1122,22 @@ private:
* constructed. This contains all the information needed to construct the
* frame other than the parent frame and whatever would be stored in the
* frame constructor state. You probably want to use
* AutoFrameConstructionItem instead of this struct. */
struct FrameConstructionItem final
: public mozilla::LinkedListElement<FrameConstructionItem> {
FrameConstructionItem(const FrameConstructionData* aFCData,
nsIContent* aContent,
- nsAtom* aTag,
- int32_t aNameSpaceID,
PendingBinding* aPendingBinding,
already_AddRefed<ComputedStyle>& aComputedStyle,
bool aSuppressWhiteSpaceOptimizations,
nsTArray<nsIAnonymousContentCreator::ContentInfo>* aAnonChildren) :
- mFCData(aFCData), mContent(aContent), mTag(aTag),
+ mFCData(aFCData), mContent(aContent),
mPendingBinding(aPendingBinding), mComputedStyle(aComputedStyle),
- mNameSpaceID(aNameSpaceID),
mSuppressWhiteSpaceOptimizations(aSuppressWhiteSpaceOptimizations),
mIsText(false), mIsGeneratedContent(false),
mIsAnonymousContentCreatorContent(false),
mIsRootPopupgroup(false), mIsAllInline(false), mIsBlock(false),
mHasInlineEnds(false), mIsPopup(false),
mIsLineParticipant(false), mIsForSVGAElement(false)
{
MOZ_COUNT_CTOR(FrameConstructionItem);
@@ -1214,31 +1207,27 @@ private:
// construction of the FrameConstructionItems for the grandchildren until
// a frame has been created for their parent item.
nsTArray<nsIAnonymousContentCreator::ContentInfo> mAnonChildren;
// The FrameConstructionData to use.
const FrameConstructionData* mFCData;
// The nsIContent node to use when initializing the new frame.
nsIContent* mContent;
- // The XBL-resolved tag name to use for frame construction.
- nsAtom* mTag;
// The PendingBinding for this frame construction item, if any. May be
// null. We maintain a list of PendingBindings in the frame construction
// state in the order in which AddToAttachedQueue should be called on them:
// depth-first, post-order traversal order. Since we actually traverse the
// DOM in a mix of breadth-first and depth-first, it is the responsibility
// of whoever constructs FrameConstructionItem kids of a given
// FrameConstructionItem to push its mPendingBinding as the current
// insertion point before doing so and pop it afterward.
PendingBinding* mPendingBinding;
// The style to use for creating the new frame.
RefPtr<ComputedStyle> mComputedStyle;
- // The XBL-resolved namespace to use for frame construction.
- int32_t mNameSpaceID;
// Whether optimizations to skip constructing textframes around
// this content need to be suppressed.
bool mSuppressWhiteSpaceOptimizations:1;
// Whether this is a text content item.
bool mIsText:1;
// Whether this is a generated content container.
// If it is, mContent is a strong pointer.
bool mIsGeneratedContent:1;