Bug 1478069: Remove ContentInfo::mChildren. r=bz

It's not needed anymore, since we tag the pseudo-elements at creation time for
styling.

Differential Revision: https://phabricator.services.mozilla.com/D2330

MozReview-Commit-ID: 7j4DVEHXYIC
This commit is contained in:
Emilio Cobos Álvarez 2018-07-24 20:11:55 +02:00
Родитель a9932d2836
Коммит e1af3b4e1c
5 изменённых файлов: 73 добавлений и 201 удалений

Просмотреть файл

@ -1924,7 +1924,6 @@ nsCSSFrameConstructor::CreateGeneratedContentItem(nsFrameConstructorState& aStat
true,
pseudoStyle,
ITEM_IS_GENERATED_CONTENT,
nullptr,
aItems);
}
@ -2137,10 +2136,6 @@ nsCSSFrameConstructor::ConstructTable(nsFrameConstructorState& aState,
if (display->IsAbsPosContainingBlock(newFrame)) {
aState.PushAbsoluteContainingBlock(newFrame, newFrame, absoluteSaveState);
}
NS_ASSERTION(aItem.mAnonChildren.IsEmpty(),
"nsIAnonymousContentCreator::CreateAnonymousContent "
"implementations for table frames are not currently expected "
"to output a list where the items have their own children");
if (aItem.mFCData->mBits & FCDATA_USE_CHILD_ITEMS) {
ConstructFramesFromItemList(aState, aItem.mChildItems,
innerFrame,
@ -2221,10 +2216,6 @@ nsCSSFrameConstructor::ConstructTableRowOrRowGroup(nsFrameConstructorState& aSta
newFrame);
nsFrameItems childItems;
NS_ASSERTION(aItem.mAnonChildren.IsEmpty(),
"nsIAnonymousContentCreator::CreateAnonymousContent "
"implementations for table frames are not currently expected "
"to output a list where the items have their own children");
if (aItem.mFCData->mBits & FCDATA_USE_CHILD_ITEMS) {
ConstructFramesFromItemList(aState, aItem.mChildItems, newFrame,
aItem.mFCData->mBits & FCDATA_IS_WRAPPER_ANON_BOX,
@ -2332,10 +2323,6 @@ nsCSSFrameConstructor::ConstructTableCell(nsFrameConstructorState& aState,
newFrame);
nsFrameItems childItems;
NS_ASSERTION(aItem.mAnonChildren.IsEmpty(),
"nsIAnonymousContentCreator::CreateAnonymousContent "
"implementations for table frames are not currently expected "
"to output a list where the items have their own children");
if (aItem.mFCData->mBits & FCDATA_USE_CHILD_ITEMS) {
// Need to push ourselves as a float containing block.
// XXXbz it might be nice to work on getting the parent
@ -2560,7 +2547,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
already_AddRefed<ComputedStyle> extraRef =
RefPtr<ComputedStyle>(computedStyle).forget();
AutoFrameConstructionItem item(this, &rootSVGData, aDocElement,
nullptr, extraRef, true, nullptr);
nullptr, extraRef, true);
nsFrameItems frameItems;
contentFrame = static_cast<nsContainerFrame*>(
@ -2610,7 +2597,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
already_AddRefed<ComputedStyle> extraRef =
RefPtr<ComputedStyle>(computedStyle).forget();
AutoFrameConstructionItem item(this, &rootTableData, aDocElement,
nullptr, extraRef, true, nullptr);
nullptr, extraRef, true);
nsFrameItems frameItems;
// if the document is a table then just populate it.
@ -4021,15 +4008,6 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt
}
}
if (!aItem.mAnonChildren.IsEmpty()) {
NS_ASSERTION(!(bits & FCDATA_USE_CHILD_ITEMS),
"We should not have both anonymous and non-anonymous "
"children in a given FrameConstructorItem");
AddFCItemsForAnonymousContent(aState, newFrameAsContainer, aItem.mAnonChildren,
aItem.mChildItems);
bits |= FCDATA_USE_CHILD_ITEMS;
}
if (bits & FCDATA_USE_CHILD_ITEMS) {
nsFrameConstructorSaveState floatSaveState;
@ -4131,31 +4109,6 @@ SetFlagsOnSubtree(nsIContent *aNode, uintptr_t aFlagsToSet)
}
}
/**
* This function takes a tree of nsIAnonymousContentCreator::ContentInfo
* objects where the nsIContent nodes have just been created, and appends the
* nsIContent children in the tree to their parent. The leaf nsIContent objects
* are appended first to minimize the number of notifications that are sent
* out (i.e. by appending as many descendants as posible while their parent is
* not yet in the document tree).
*
* This function is used simply as a convenience so that implementations of
* nsIAnonymousContentCreator::CreateAnonymousContent don't all have to have
* their own code to connect the elements that they create.
*/
static void
ConnectAnonymousTreeDescendants(nsIContent* aParent,
const nsTArray<nsIAnonymousContentCreator::ContentInfo>& aContent)
{
for (const auto& info : aContent) {
nsIContent* content = info.mContent;
MOZ_ASSERT(content, "null anonymous content?");
ConnectAnonymousTreeDescendants(content, info.mChildren);
aParent->AppendChildTo(content, false);
}
}
nsresult
nsCSSFrameConstructor::GetAnonymousContent(nsIContent* aParent,
nsIFrame* aParentFrame,
@ -4174,9 +4127,6 @@ nsCSSFrameConstructor::GetAnonymousContent(nsIContent* aParent,
for (const auto& info : aContent) {
// get our child's content and set its parent to our content
nsIContent* content = info.mContent;
MOZ_ASSERT(content, "null anonymous content?");
ConnectAnonymousTreeDescendants(content, info.mChildren);
content->SetIsNativeAnonymousRoot();
bool anonContentIsEditable = content->HasFlag(NODE_IS_EDITABLE);
@ -5125,10 +5075,6 @@ nsCSSFrameConstructor::ConstructFrameWithAnonymousChild(
nsFrameItems childItems;
// Process children
NS_ASSERTION(aItem.mAnonChildren.IsEmpty(),
"nsIAnonymousContentCreator::CreateAnonymousContent should not "
"be implemented for frames for which we explicitly create an "
"anonymous child to wrap its child frames");
if (aItem.mFCData->mBits & FCDATA_USE_CHILD_ITEMS) {
ConstructFramesFromItemList(aState, aItem.mChildItems,
innerFrame,
@ -5436,7 +5382,7 @@ nsCSSFrameConstructor::AddPageBreakItem(nsIContent* aContent,
FCDATA_DECL(FCDATA_SKIP_FRAMESET, NS_NewPageBreakFrame);
aItems.AppendItem(this, &sPageBreakData, aContent, nullptr,
pseudoStyle.forget(), true, nullptr);
pseudoStyle.forget(), true);
}
bool
@ -5475,7 +5421,6 @@ nsCSSFrameConstructor::DoAddFrameConstructionItems(nsFrameConstructorState& aSta
ComputedStyle* aComputedStyle,
bool aSuppressWhiteSpaceOptimizations,
nsContainerFrame* aParentFrame,
nsTArray<nsIAnonymousContentCreator::ContentInfo>* aAnonChildren,
FrameConstructionItemList& aItems)
{
uint32_t flags = ITEM_ALLOW_XBL_BASE | ITEM_ALLOW_PAGE_BREAK;
@ -5491,8 +5436,7 @@ nsCSSFrameConstructor::DoAddFrameConstructionItems(nsFrameConstructorState& aSta
AddFrameConstructionItemsInternal(aState, aContent, aParentFrame,
aSuppressWhiteSpaceOptimizations,
aComputedStyle,
flags, aAnonChildren,
aItems);
flags, aItems);
}
void
@ -5509,7 +5453,7 @@ nsCSSFrameConstructor::AddFrameConstructionItems(nsFrameConstructorState& aState
RefPtr<ComputedStyle> computedStyle = ResolveComputedStyle(aContent);
DoAddFrameConstructionItems(aState, aContent, computedStyle,
aSuppressWhiteSpaceOptimizations, parentFrame,
nullptr, aItems);
aItems);
}
// Whether we should suppress frames for a child under a <select> frame.
@ -5587,7 +5531,6 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
bool aSuppressWhiteSpaceOptimizations,
ComputedStyle* aComputedStyle,
uint32_t aFlags,
nsTArray<nsIAnonymousContentCreator::ContentInfo>* aAnonChildren,
FrameConstructionItemList& aItems)
{
MOZ_ASSERT(aContent->IsText() || aContent->IsElement(),
@ -5673,8 +5616,6 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
FlattenedChildIterator iter(aContent);
InsertionPoint insertion(aParentFrame, aContent);
MOZ_ASSERT(!aAnonChildren,
"display: contents can't generate NAC");
for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) {
AddFrameConstructionItems(aState,
child,
@ -5805,15 +5746,14 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
// the first child, so add the item to the front of the item list.
item = aItems.PrependItem(this, data, aContent, pendingBinding,
style.forget(),
aSuppressWhiteSpaceOptimizations,
aAnonChildren);
aSuppressWhiteSpaceOptimizations);
}
}
if (!item) {
item = aItems.AppendItem(this, data, aContent, pendingBinding,
style.forget(),
aSuppressWhiteSpaceOptimizations, aAnonChildren);
aSuppressWhiteSpaceOptimizations);
}
item->mIsText = isText;
item->mIsGeneratedContent = isGeneratedContent;
@ -8636,7 +8576,7 @@ nsCSSFrameConstructor::ReplicateFixedFrames(nsPageContentFrame* aParentFrame)
computedStyle,
ITEM_ALLOW_XBL_BASE |
ITEM_ALLOW_PAGE_BREAK,
nullptr, items);
items);
ConstructFramesFromItemList(state, items, canvasFrame,
/* aParentIsWrapperAnonBox = */ false,
fixedPlaceholders);
@ -9362,7 +9302,7 @@ nsCSSFrameConstructor::CreateNeededAnonFlexOrGridItems(
// no pending binding
nullptr,
wrapperStyle,
true, nullptr);
true);
newItem->mIsAllInline = newItem->mHasInlineEnds =
newItem->mComputedStyle->StyleDisplay()->IsInlineOutsideStyle();
@ -9864,7 +9804,7 @@ nsCSSFrameConstructor::WrapItemsInPseudoParent(nsIContent* aParentContent,
// no pending binding
nullptr,
wrapperStyle,
true, nullptr);
true);
const nsStyleDisplay* disp = newItem->mComputedStyle->StyleDisplay();
// Here we're cheating a tad... technically, table-internal items should be
@ -9929,7 +9869,7 @@ nsCSSFrameConstructor::CreateNeededPseudoSiblings(
// no pending binding
nullptr,
pseudoStyle,
true, nullptr);
true);
newItem->mIsAllInline = true;
newItem->mChildItems.SetParentHasNoXBLChildren(true);
iter.InsertItem(newItem);
@ -10032,12 +9972,12 @@ void
nsCSSFrameConstructor::AddFCItemsForAnonymousContent(
nsFrameConstructorState& aState,
nsContainerFrame* aFrame,
nsTArray<nsIAnonymousContentCreator::ContentInfo>& aAnonymousItems,
const nsTArray<nsIAnonymousContentCreator::ContentInfo>& aAnonymousItems,
FrameConstructionItemList& aItemsToConstruct,
uint32_t aExtraFlags)
{
for (uint32_t i = 0; i < aAnonymousItems.Length(); ++i) {
nsIContent* content = aAnonymousItems[i].mContent;
for (const auto& info : aAnonymousItems) {
nsIContent* content = info.mContent;
// Gecko-styled nodes should have no pending restyle flags.
// Assert some things about this content
MOZ_ASSERT(!(content->GetFlags() &
@ -10054,17 +9994,12 @@ nsCSSFrameConstructor::AddFCItemsForAnonymousContent(
RefPtr<ComputedStyle> computedStyle = ResolveComputedStyle(content);
nsTArray<nsIAnonymousContentCreator::ContentInfo>* anonChildren = nullptr;
if (!aAnonymousItems[i].mChildren.IsEmpty()) {
anonChildren = &aAnonymousItems[i].mChildren;
}
uint32_t flags = ITEM_ALLOW_XBL_BASE | ITEM_ALLOW_PAGE_BREAK |
ITEM_IS_ANONYMOUSCONTENTCREATOR_CONTENT | aExtraFlags;
AddFrameConstructionItemsInternal(aState, content, aFrame,
true, computedStyle, flags,
anonChildren, aItemsToConstruct);
aItemsToConstruct);
}
}
@ -11286,31 +11221,21 @@ nsCSSFrameConstructor::BuildInlineChildItems(nsFrameConstructorState& aState,
flags |= ITEM_ALLOWS_TEXT_PATH_CHILD;
}
if (!aParentItem.mAnonChildren.IsEmpty()) {
// Use the anon-children list instead of the content tree child list so that
// we use any special style that should be associated with the children, and
// so that we won't try to construct grandchildren frame constructor items
// before the frame is available for their parent.
AddFCItemsForAnonymousContent(aState, nullptr, aParentItem.mAnonChildren,
aParentItem.mChildItems, flags);
} else {
// Use the content tree child list:
FlattenedChildIterator iter(parentContent);
for (nsIContent* content = iter.GetNextChild(); content; content = iter.GetNextChild()) {
// Manually check for comments/PIs, since we don't have a frame to pass to
// AddFrameConstructionItems. We know our parent is a non-replaced inline,
// so there is no need to do the NeedFrameFor check.
content->UnsetFlags(NODE_DESCENDANTS_NEED_FRAMES | NODE_NEEDS_FRAME);
if (content->IsComment() || content->IsProcessingInstruction()) {
continue;
}
RefPtr<ComputedStyle> childContext = ResolveComputedStyle(content);
AddFrameConstructionItemsInternal(aState, content, nullptr,
iter.XBLInvolved(), childContext,
flags, nullptr,
aParentItem.mChildItems);
FlattenedChildIterator iter(parentContent);
for (nsIContent* content = iter.GetNextChild(); content; content = iter.GetNextChild()) {
// Manually check for comments/PIs, since we don't have a frame to pass to
// AddFrameConstructionItems. We know our parent is a non-replaced inline,
// so there is no need to do the NeedFrameFor check.
content->UnsetFlags(NODE_DESCENDANTS_NEED_FRAMES | NODE_NEEDS_FRAME);
if (content->IsComment() || content->IsProcessingInstruction()) {
continue;
}
RefPtr<ComputedStyle> childContext = ResolveComputedStyle(content);
AddFrameConstructionItemsInternal(aState, content, nullptr,
iter.XBLInvolved(), childContext,
flags,
aParentItem.mChildItems);
}
if (!aItemIsWithinSVGText) {

Просмотреть файл

@ -406,7 +406,6 @@ private:
ComputedStyle* aComputedStyle,
bool aSuppressWhiteSpaceOptimizations,
nsContainerFrame* aParentFrame,
nsTArray<nsIAnonymousContentCreator::ContentInfo>* aAnonChildren,
FrameConstructionItemList& aItems);
// Construct the frames for the document element. This can return null if the
@ -847,14 +846,12 @@ private:
nsIContent* aContent,
PendingBinding* aPendingBinding,
already_AddRefed<ComputedStyle>&& aComputedStyle,
bool aSuppressWhiteSpaceOptimizations,
nsTArray<nsIAnonymousContentCreator::ContentInfo>* aAnonChildren)
bool aSuppressWhiteSpaceOptimizations)
{
FrameConstructionItem* item =
new (aFCtor) FrameConstructionItem(aFCData, aContent,
aPendingBinding, aComputedStyle,
aSuppressWhiteSpaceOptimizations,
aAnonChildren);
aSuppressWhiteSpaceOptimizations);
mItems.insertBack(item);
++mItemCount;
++mDesiredParentCounts[item->DesiredParentType()];
@ -867,14 +864,12 @@ private:
nsIContent* aContent,
PendingBinding* aPendingBinding,
already_AddRefed<ComputedStyle>&& aComputedStyle,
bool aSuppressWhiteSpaceOptimizations,
nsTArray<nsIAnonymousContentCreator::ContentInfo>* aAnonChildren)
bool aSuppressWhiteSpaceOptimizations)
{
FrameConstructionItem* item =
new (aFCtor) FrameConstructionItem(aFCData, aContent,
aPendingBinding, aComputedStyle,
aSuppressWhiteSpaceOptimizations,
aAnonChildren);
aSuppressWhiteSpaceOptimizations);
mItems.insertFront(item);
++mItemCount;
++mDesiredParentCounts[item->DesiredParentType()];
@ -1096,14 +1091,14 @@ private:
* frame constructor state. You probably want to use
* AutoFrameConstructionItem instead of this struct. */
struct FrameConstructionItem final
: public mozilla::LinkedListElement<FrameConstructionItem> {
: public mozilla::LinkedListElement<FrameConstructionItem>
{
FrameConstructionItem(const FrameConstructionData* aFCData,
nsIContent* aContent,
PendingBinding* aPendingBinding,
already_AddRefed<ComputedStyle>& aComputedStyle,
bool aSuppressWhiteSpaceOptimizations,
nsTArray<nsIAnonymousContentCreator::ContentInfo>* aAnonChildren) :
mFCData(aFCData), mContent(aContent),
bool aSuppressWhiteSpaceOptimizations)
: mFCData(aFCData), mContent(aContent),
mPendingBinding(aPendingBinding), mComputedStyle(aComputedStyle),
mSuppressWhiteSpaceOptimizations(aSuppressWhiteSpaceOptimizations),
mIsText(false), mIsGeneratedContent(false),
@ -1113,17 +1108,6 @@ private:
mIsLineParticipant(false), mIsForSVGAElement(false)
{
MOZ_COUNT_CTOR(FrameConstructionItem);
if (aAnonChildren) {
NS_ASSERTION(!(mFCData->mBits & FCDATA_FUNC_IS_FULL_CTOR) ||
mFCData->mFullConstructor ==
&nsCSSFrameConstructor::ConstructInline,
"This is going to fail");
NS_ASSERTION(!(mFCData->mBits & FCDATA_USE_CHILD_ITEMS),
"nsIAnonymousContentCreator::CreateAnonymousContent "
"implementations should not output a list where the "
"items have children in this case");
mAnonChildren.SwapElements(*aAnonChildren);
}
}
void* operator new(size_t, nsCSSFrameConstructor* aFCtor)
@ -1164,22 +1148,6 @@ private:
// Child frame construction items.
FrameConstructionItemList mChildItems;
// ContentInfo list for children that have yet to have
// FrameConstructionItem objects created for them. This exists because
// AddFrameConstructionItemsInternal needs a valid frame, but in the case
// that nsIAnonymousContentCreator::CreateAnonymousContent returns items
// that have their own children (so we have a tree of ContentInfo objects
// rather than a flat list) we don't yet have a frame to provide to
// AddFrameConstructionItemsInternal in order to create the items for the
// grandchildren. That prevents FrameConstructionItems from being created
// for these grandchildren (and any descendants that they may have),
// otherwise they could have been added to the mChildItems member of their
// parent FrameConstructionItem. As it is, the grandchildren ContentInfo
// list has to be stored in this mAnonChildren member in order to delay
// 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.
@ -1497,7 +1465,6 @@ private:
bool aSuppressWhiteSpaceOptimizations,
ComputedStyle* aComputedStyle,
uint32_t aFlags,
nsTArray<nsIAnonymousContentCreator::ContentInfo>* aAnonChildren,
FrameConstructionItemList& aItems);
/**
@ -1659,7 +1626,7 @@ private:
void AddFCItemsForAnonymousContent(
nsFrameConstructorState& aState,
nsContainerFrame* aFrame,
nsTArray<nsIAnonymousContentCreator::ContentInfo>& aAnonymousItems,
const nsTArray<nsIAnonymousContentCreator::ContentInfo>& aAnonymousItems,
FrameConstructionItemList& aItemsToConstruct,
uint32_t aExtraFlags = 0);

Просмотреть файл

@ -320,37 +320,32 @@ private:
nsCOMPtr<nsIContent> mTextField;
};
nsresult
nsNumberControlFrame::MakeAnonymousElement(Element** aResult,
nsTArray<ContentInfo>& aElements,
already_AddRefed<Element>
nsNumberControlFrame::MakeAnonymousElement(Element* aParent,
nsAtom* aTagName,
CSSPseudoElementType aPseudoType)
{
// Get the NodeInfoManager and tag necessary to create the anonymous divs.
nsCOMPtr<nsIDocument> doc = mContent->GetComposedDoc();
nsIDocument* doc = mContent->GetComposedDoc();
RefPtr<Element> resultElement = doc->CreateHTMLElement(aTagName);
resultElement->SetPseudoElementType(aPseudoType);
// Associate the pseudo-element with the anonymous child
if (!aElements.AppendElement(resultElement)) {
return NS_ERROR_OUT_OF_MEMORY;
}
if (aPseudoType == CSSPseudoElementType::mozNumberSpinDown ||
aPseudoType == CSSPseudoElementType::mozNumberSpinUp) {
resultElement->SetAttr(kNameSpaceID_None, nsGkAtoms::role,
NS_LITERAL_STRING("button"), false);
}
resultElement.forget(aResult);
return NS_OK;
if (aParent) {
aParent->AppendChildTo(resultElement, false);
}
return resultElement.forget();
}
nsresult
nsNumberControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
{
nsresult rv;
// We create an anonymous tree for our input element that is structured as
// follows:
//
@ -366,23 +361,19 @@ nsNumberControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
// Create the anonymous outer wrapper:
rv = MakeAnonymousElement(getter_AddRefs(mOuterWrapper),
aElements,
nsGkAtoms::div,
CSSPseudoElementType::mozNumberWrapper);
NS_ENSURE_SUCCESS(rv, rv);
mOuterWrapper = MakeAnonymousElement(nullptr,
nsGkAtoms::div,
CSSPseudoElementType::mozNumberWrapper);
ContentInfo& outerWrapperCI = aElements.LastElement();
aElements.AppendElement(mOuterWrapper);
// Create the ::-moz-number-text pseudo-element:
rv = MakeAnonymousElement(getter_AddRefs(mTextField),
outerWrapperCI.mChildren,
nsGkAtoms::input,
CSSPseudoElementType::mozNumberText);
NS_ENSURE_SUCCESS(rv, rv);
mTextField = MakeAnonymousElement(mOuterWrapper,
nsGkAtoms::input,
CSSPseudoElementType::mozNumberText);
mTextField->SetAttr(kNameSpaceID_None, nsGkAtoms::type,
NS_LITERAL_STRING("text"), PR_FALSE);
NS_LITERAL_STRING("text"), false);
HTMLInputElement* content = HTMLInputElement::FromNode(mContent);
HTMLInputElement* textField = HTMLInputElement::FromNode(mTextField);
@ -418,34 +409,29 @@ nsNumberControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
if (StyleDisplay()->mAppearance == NS_THEME_TEXTFIELD) {
// The author has elected to hide the spinner by setting this
// -moz-appearance. We will reframe if it changes.
return rv;
return NS_OK;
}
// Create the ::-moz-number-spin-box pseudo-element:
rv = MakeAnonymousElement(getter_AddRefs(mSpinBox),
outerWrapperCI.mChildren,
nsGkAtoms::div,
CSSPseudoElementType::mozNumberSpinBox);
NS_ENSURE_SUCCESS(rv, rv);
ContentInfo& spinBoxCI = outerWrapperCI.mChildren.LastElement();
mSpinBox = MakeAnonymousElement(mOuterWrapper,
nsGkAtoms::div,
CSSPseudoElementType::mozNumberSpinBox);
// Create the ::-moz-number-spin-up pseudo-element:
rv = MakeAnonymousElement(getter_AddRefs(mSpinUp),
spinBoxCI.mChildren,
nsGkAtoms::div,
CSSPseudoElementType::mozNumberSpinUp);
NS_ENSURE_SUCCESS(rv, rv);
mSpinUp = MakeAnonymousElement(mSpinBox,
nsGkAtoms::div,
CSSPseudoElementType::mozNumberSpinUp);
// Create the ::-moz-number-spin-down pseudo-element:
rv = MakeAnonymousElement(getter_AddRefs(mSpinDown),
spinBoxCI.mChildren,
nsGkAtoms::div,
CSSPseudoElementType::mozNumberSpinDown);
mSpinDown = MakeAnonymousElement(mSpinBox,
nsGkAtoms::div,
CSSPseudoElementType::mozNumberSpinDown);
// FIXME(emilio): doesn't this need to be done in the appearance: textfield
// case as well?
SyncDisabledState();
return rv;
return NS_OK;
}
void

Просмотреть файл

@ -162,10 +162,9 @@ public:
private:
nsITextControlFrame* GetTextFieldFrame();
nsresult MakeAnonymousElement(Element** aResult,
nsTArray<ContentInfo>& aElements,
nsAtom* aTagName,
CSSPseudoElementType aPseudoType);
already_AddRefed<Element> MakeAnonymousElement(Element* aParent,
nsAtom* aTagName,
CSSPseudoElementType aPseudoType);
class SyncDisabledStateEvent;
friend class SyncDisabledStateEvent;

Просмотреть файл

@ -32,12 +32,11 @@ public:
NS_DECL_QUERYFRAME_TARGET(nsIAnonymousContentCreator)
struct ContentInfo {
explicit ContentInfo(nsIContent* aContent) :
mContent(aContent)
explicit ContentInfo(nsIContent* aContent)
: mContent(aContent)
{}
nsIContent* mContent;
nsTArray<ContentInfo> mChildren;
};
/**
@ -52,12 +51,8 @@ public:
* responsible for calling UnbindFromTree on the elements it returned
* from CreateAnonymousContent when appropriate (i.e. before releasing
* them).
*
* @note Implementations of this method that add items to mChildren must not
* hook them up to any parent since frame construction takes care of
* that.
*/
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements)=0;
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) = 0;
/**
* Appends "native" anonymous children created by CreateAnonymousContent()