зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1451239: Remove resolved namespace id and tag from FCItems. r=bz
Tag is unused. This changes how some mixes of MathML and html get wrapped in anonymous table boxes (in particular, it changes whether it uses a MathML or an HTML table frame). The main thing this affects is whether the frame responds to certain attributes. Responding to mathml attributes on its mContent when that mContent is not a MathML element is weird. So arguably this is also more correct. However, that seems acceptable to me, and you can already get that mixing manually. On a few (arguably simple) manual test-cases mixing MathML and HTML tables I couldn't manage to get the patched build to render differently. Plus, neither our reftests nor the WPT MathML test-suite upstreamed by Fred Wang for WebKit rely on this. MozReview-Commit-ID: 8IV3iF5xIs0
This commit is contained in:
Родитель
d8df648fc6
Коммит
92232a9bc4
|
@ -2067,7 +2067,7 @@ nsCSSFrameConstructor::ConstructTable(nsFrameConstructorState& aState,
|
|||
|
||||
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;
|
||||
|
@ -2077,7 +2077,7 @@ nsCSSFrameConstructor::ConstructTable(nsFrameConstructorState& aState,
|
|||
|
||||
// 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);
|
||||
|
@ -2091,7 +2091,7 @@ nsCSSFrameConstructor::ConstructTable(nsFrameConstructorState& aState,
|
|||
|
||||
// Create the inner table frame
|
||||
nsContainerFrame* innerFrame;
|
||||
if (kNameSpaceID_MathML == nameSpaceID)
|
||||
if (isMathMLContent)
|
||||
innerFrame = NS_NewMathMLmtableFrame(mPresShell, computedStyle);
|
||||
else
|
||||
innerFrame = NS_NewTableFrame(mPresShell, computedStyle);
|
||||
|
@ -2186,11 +2186,10 @@ nsCSSFrameConstructor::ConstructTableRowOrRowGroup(nsFrameConstructorState& aSta
|
|||
"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);
|
||||
|
@ -2267,7 +2266,7 @@ nsCSSFrameConstructor::ConstructTableCell(nsFrameConstructorState& aState,
|
|||
|
||||
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();
|
||||
|
@ -2279,7 +2278,7 @@ nsCSSFrameConstructor::ConstructTableCell(nsFrameConstructorState& aState,
|
|||
// 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
|
||||
|
@ -2301,7 +2300,7 @@ nsCSSFrameConstructor::ConstructTableCell(nsFrameConstructorState& aState,
|
|||
// 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 {
|
||||
|
@ -2544,9 +2543,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
|
|||
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*>(
|
||||
|
@ -2596,9 +2593,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
|
|||
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.
|
||||
|
@ -5528,11 +5523,8 @@ nsCSSFrameConstructor::AddPageBreakItem(nsIContent* aContent,
|
|||
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
|
||||
|
@ -5896,15 +5888,16 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
|
|||
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;
|
||||
|
@ -9541,9 +9534,6 @@ nsCSSFrameConstructor::CreateNeededAnonFlexOrGridItems(
|
|||
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,
|
||||
|
@ -10046,12 +10036,6 @@ nsCSSFrameConstructor::WrapItemsInPseudoParent(nsIContent* aParentContent,
|
|||
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,
|
||||
|
@ -10117,10 +10101,6 @@ nsCSSFrameConstructor::CreateNeededPseudoSiblings(
|
|||
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,
|
||||
|
|
|
@ -852,15 +852,13 @@ private:
|
|||
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);
|
||||
|
@ -874,15 +872,13 @@ private:
|
|||
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);
|
||||
|
@ -1129,15 +1125,12 @@ private:
|
|||
: 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),
|
||||
|
@ -1217,8 +1210,6 @@ private:
|
|||
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:
|
||||
|
@ -1230,8 +1221,6 @@ private:
|
|||
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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче