зеркало из https://github.com/mozilla/gecko-dev.git
Bug 654989 part 2. Use the nsStyleContext handed back from CreateAnonymousContent. r=roc
This asserts the parts of AddFrameConstructionItems that should never matter for anonymous content and then just copies the one-line style context get if it's needed.
This commit is contained in:
Родитель
7d3e2c97ad
Коммит
24257a4235
|
@ -9538,16 +9538,39 @@ nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState& aState,
|
|||
nsAutoTArray<nsIAnonymousContentCreator::ContentInfo, 4> anonymousItems;
|
||||
GetAnonymousContent(aContent, aFrame, anonymousItems);
|
||||
for (PRUint32 i = 0; i < anonymousItems.Length(); ++i) {
|
||||
nsIContent* content = anonymousItems[i].mContent;
|
||||
#ifdef DEBUG
|
||||
nsIAnonymousContentCreator* creator = do_QueryFrame(aFrame);
|
||||
NS_ASSERTION(!creator ||
|
||||
!creator->CreateFrameFor(anonymousItems[i].mContent),
|
||||
NS_ASSERTION(!creator || !creator->CreateFrameFor(content),
|
||||
"If you need to use CreateFrameFor, you need to call "
|
||||
"CreateAnonymousFrames manually and not follow the standard "
|
||||
"ProcessChildren() codepath for this frame");
|
||||
#endif
|
||||
AddFrameConstructionItems(aState, anonymousItems[i].mContent, PR_TRUE,
|
||||
aFrame, itemsToConstruct);
|
||||
// Assert some things about this content
|
||||
NS_ABORT_IF_FALSE(!(content->GetFlags() &
|
||||
(NODE_DESCENDANTS_NEED_FRAMES | NODE_NEEDS_FRAME)),
|
||||
"Should not be marked as needing frames");
|
||||
NS_ABORT_IF_FALSE(!content->IsElement() ||
|
||||
!(content->GetFlags() & ELEMENT_ALL_RESTYLE_FLAGS),
|
||||
"Should have no pending restyle flags");
|
||||
NS_ABORT_IF_FALSE(!content->GetPrimaryFrame(),
|
||||
"Should have no existing frame");
|
||||
NS_ABORT_IF_FALSE(!content->IsNodeOfType(nsINode::eCOMMENT) &&
|
||||
!content->IsNodeOfType(nsINode::ePROCESSING_INSTRUCTION),
|
||||
"Why is someone creating garbage anonymous content");
|
||||
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
if (anonymousItems[i].mStyleContext) {
|
||||
styleContext = anonymousItems[i].mStyleContext.forget();
|
||||
} else {
|
||||
styleContext = ResolveStyleContext(aFrame, content, &aState);
|
||||
}
|
||||
|
||||
AddFrameConstructionItemsInternal(aState, content, aFrame,
|
||||
content->Tag(), content->GetNameSpaceID(),
|
||||
PR_TRUE, styleContext,
|
||||
ITEM_ALLOW_XBL_BASE | ITEM_ALLOW_PAGE_BREAK,
|
||||
itemsToConstruct);
|
||||
}
|
||||
|
||||
if (!aFrame->IsLeaf()) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче