|
|
|
Lines 606-645
FindFirstNonBlock(const nsFrameList& aLi
|
Link Here
|
|---|
|
| 606 |
inline void |
606 |
inline void |
| 607 |
SetInitialSingleChild(nsContainerFrame* aParent, nsIFrame* aFrame) |
607 |
SetInitialSingleChild(nsContainerFrame* aParent, nsIFrame* aFrame) |
| 608 |
{ |
608 |
{ |
| 609 |
NS_PRECONDITION(!aFrame->GetNextSibling(), "Should be using a frame list"); |
609 |
NS_PRECONDITION(!aFrame->GetNextSibling(), "Should be using a frame list"); |
| 610 |
nsFrameList temp(aFrame, aFrame); |
610 |
nsFrameList temp(aFrame, aFrame); |
| 611 |
aParent->SetInitialChildList(kPrincipalList, temp); |
611 |
aParent->SetInitialChildList(kPrincipalList, temp); |
| 612 |
} |
612 |
} |
| 613 |
|
613 |
|
| 614 |
static nsContainerFrame* |
|
|
| 615 |
GetContentInsertionFrameFor(nsIContent* aContent) |
| 616 |
{ |
| 617 |
// Get the primary frame associated with the content |
| 618 |
nsIFrame* frame = aContent->GetPrimaryFrame(); |
| 619 |
|
| 620 |
if (!frame) |
| 621 |
return nullptr; |
| 622 |
|
| 623 |
// If the content of the frame is not the desired content then this is not |
| 624 |
// really a frame for the desired content. |
| 625 |
// XXX This check is needed due to bug 135040. Remove it once that's fixed. |
| 626 |
if (frame->GetContent() != aContent) { |
| 627 |
return nullptr; |
| 628 |
} |
| 629 |
|
| 630 |
nsContainerFrame* insertionFrame = frame->GetContentInsertionFrame(); |
| 631 |
|
| 632 |
NS_ASSERTION(!insertionFrame || insertionFrame == frame || !frame->IsLeaf(), |
| 633 |
"The insertion frame is the primary frame or the primary frame isn't a leaf"); |
| 634 |
|
| 635 |
return insertionFrame; |
| 636 |
} |
| 637 |
|
| 638 |
// ----------------------------------------------------------- |
614 |
// ----------------------------------------------------------- |
| 639 |
|
615 |
|
| 640 |
// Structure used when constructing formatting object trees. |
616 |
// Structure used when constructing formatting object trees. |
| 641 |
struct nsFrameItems : public nsFrameList |
617 |
struct nsFrameItems : public nsFrameList |
| 642 |
{ |
618 |
{ |
| 643 |
// Appends the frame to the end of the list |
619 |
// Appends the frame to the end of the list |
| 644 |
void AddChild(nsIFrame* aChild); |
620 |
void AddChild(nsIFrame* aChild); |
| 645 |
}; |
621 |
}; |
|
Lines 2283-2300
NeedFrameFor(const nsFrameConstructorSta
|
Link Here
|
|---|
|
| 2283 |
// whitespace. |
2259 |
// whitespace. |
| 2284 |
|
2260 |
|
| 2285 |
// We could handle all this in CreateNeededPseudos or some other place |
2261 |
// We could handle all this in CreateNeededPseudos or some other place |
| 2286 |
// after we build our frame construction items, but that would involve |
2262 |
// after we build our frame construction items, but that would involve |
| 2287 |
// creating frame construction items for whitespace kids of |
2263 |
// creating frame construction items for whitespace kids of |
| 2288 |
// eExcludesIgnorableWhitespace frames, where we know we'll be dropping them |
2264 |
// eExcludesIgnorableWhitespace frames, where we know we'll be dropping them |
| 2289 |
// all anyway, and involve an extra walk down the frame construction item |
2265 |
// all anyway, and involve an extra walk down the frame construction item |
| 2290 |
// list. |
2266 |
// list. |
| 2291 |
if (!aParentFrame->IsFrameOfType(nsIFrame::eExcludesIgnorableWhitespace) || |
2267 |
if ((aParentFrame && |
| 2292 |
aParentFrame->IsGeneratedContentFrame() || |
2268 |
(!aParentFrame->IsFrameOfType(nsIFrame::eExcludesIgnorableWhitespace) || |
|
|
2269 |
aParentFrame->IsGeneratedContentFrame())) || |
| 2293 |
!aChildContent->IsNodeOfType(nsINode::eTEXT)) { |
2270 |
!aChildContent->IsNodeOfType(nsINode::eTEXT)) { |
| 2294 |
return true; |
2271 |
return true; |
| 2295 |
} |
2272 |
} |
| 2296 |
|
2273 |
|
| 2297 |
aChildContent->SetFlags(NS_CREATE_FRAME_IF_NON_WHITESPACE | |
2274 |
aChildContent->SetFlags(NS_CREATE_FRAME_IF_NON_WHITESPACE | |
| 2298 |
NS_REFRAME_IF_WHITESPACE); |
2275 |
NS_REFRAME_IF_WHITESPACE); |
| 2299 |
return !aChildContent->TextIsOnlyWhitespace(); |
2276 |
return !aChildContent->TextIsOnlyWhitespace(); |
| 2300 |
} |
2277 |
} |
|
Lines 2592-2608
nsCSSFrameConstructor::ConstructDocEleme
|
Link Here
|
|---|
|
| 2592 |
// if the document is a table then just populate it. |
2569 |
// if the document is a table then just populate it. |
| 2593 |
contentFrame = static_cast<nsContainerFrame*>( |
2570 |
contentFrame = static_cast<nsContainerFrame*>( |
| 2594 |
ConstructTable(state, item, mDocElementContainingBlock, |
2571 |
ConstructTable(state, item, mDocElementContainingBlock, |
| 2595 |
styleContext->StyleDisplay(), |
2572 |
styleContext->StyleDisplay(), |
| 2596 |
frameItems)); |
2573 |
frameItems)); |
| 2597 |
newFrame = frameItems.FirstChild(); |
2574 |
newFrame = frameItems.FirstChild(); |
| 2598 |
NS_ASSERTION(frameItems.OnlyChild(), "multiple root element frames"); |
2575 |
NS_ASSERTION(frameItems.OnlyChild(), "multiple root element frames"); |
| 2599 |
} else { |
2576 |
} else { |
| 2600 |
MOZ_ASSERT(display->mDisplay == NS_STYLE_DISPLAY_BLOCK, |
2577 |
MOZ_ASSERT(display->mDisplay == NS_STYLE_DISPLAY_BLOCK || |
|
|
2578 |
display->mDisplay == NS_STYLE_DISPLAY_CONTENTS, |
| 2601 |
"Unhandled display type for root element"); |
2579 |
"Unhandled display type for root element"); |
| 2602 |
contentFrame = NS_NewBlockFormattingContext(mPresShell, styleContext); |
2580 |
contentFrame = NS_NewBlockFormattingContext(mPresShell, styleContext); |
| 2603 |
nsFrameItems frameItems; |
2581 |
nsFrameItems frameItems; |
| 2604 |
// Use a null PendingBinding, since our binding is not in fact pending. |
2582 |
// Use a null PendingBinding, since our binding is not in fact pending. |
| 2605 |
ConstructBlock(state, display, aDocElement, |
2583 |
ConstructBlock(state, display, aDocElement, |
| 2606 |
state.GetGeometricParent(display, |
2584 |
state.GetGeometricParent(display, |
| 2607 |
mDocElementContainingBlock), |
2585 |
mDocElementContainingBlock), |
| 2608 |
mDocElementContainingBlock, styleContext, |
2586 |
mDocElementContainingBlock, styleContext, |
|
Lines 2619-2635
nsCSSFrameConstructor::ConstructDocEleme
|
Link Here
|
|---|
|
| 2619 |
NS_ASSERTION(processChildren ? !mRootElementFrame : |
2597 |
NS_ASSERTION(processChildren ? !mRootElementFrame : |
| 2620 |
mRootElementFrame == contentFrame, |
2598 |
mRootElementFrame == contentFrame, |
| 2621 |
"unexpected mRootElementFrame"); |
2599 |
"unexpected mRootElementFrame"); |
| 2622 |
mRootElementFrame = contentFrame; |
2600 |
mRootElementFrame = contentFrame; |
| 2623 |
|
2601 |
|
| 2624 |
// Figure out which frame has the main style for the document element, |
2602 |
// Figure out which frame has the main style for the document element, |
| 2625 |
// assigning it to mRootElementStyleFrame. |
2603 |
// assigning it to mRootElementStyleFrame. |
| 2626 |
// Backgrounds should be propagated from that frame to the viewport. |
2604 |
// Backgrounds should be propagated from that frame to the viewport. |
| 2627 |
mRootElementStyleFrame = contentFrame->GetParentStyleContextFrame(); |
2605 |
contentFrame->GetParentStyleContext(&mRootElementStyleFrame); |
| 2628 |
bool isChild = mRootElementStyleFrame && |
2606 |
bool isChild = mRootElementStyleFrame && |
| 2629 |
mRootElementStyleFrame->GetParent() == contentFrame; |
2607 |
mRootElementStyleFrame->GetParent() == contentFrame; |
| 2630 |
if (!isChild) { |
2608 |
if (!isChild) { |
| 2631 |
mRootElementStyleFrame = mRootElementFrame; |
2609 |
mRootElementStyleFrame = mRootElementFrame; |
| 2632 |
} |
2610 |
} |
| 2633 |
|
2611 |
|
| 2634 |
if (processChildren) { |
2612 |
if (processChildren) { |
| 2635 |
// Still need to process the child content |
2613 |
// Still need to process the child content |
|
Lines 3699-3727
nsCSSFrameConstructor::ConstructFrameFro
|
Link Here
|
|---|
|
| 3699 |
|
3677 |
|
| 3700 |
// Don't create a subdocument frame for iframes if we're creating extra frames |
3678 |
// Don't create a subdocument frame for iframes if we're creating extra frames |
| 3701 |
if (aState.mCreatingExtraFrames && aItem.mContent->IsHTML() && |
3679 |
if (aState.mCreatingExtraFrames && aItem.mContent->IsHTML() && |
| 3702 |
aItem.mContent->Tag() == nsGkAtoms::iframe) |
3680 |
aItem.mContent->Tag() == nsGkAtoms::iframe) |
| 3703 |
{ |
3681 |
{ |
| 3704 |
return; |
3682 |
return; |
| 3705 |
} |
3683 |
} |
| 3706 |
|
3684 |
|
| 3707 |
nsStyleContext* const styleContext = aItem.mStyleContext; |
|
|
| 3708 |
const nsStyleDisplay* display = styleContext->StyleDisplay(); |
| 3709 |
nsIContent* const content = aItem.mContent; |
3685 |
nsIContent* const content = aItem.mContent; |
|
|
3686 |
nsIContent* parent = content->GetParent(); |
| 3687 |
|
| 3688 |
// Push display:contents ancestors. |
| 3689 |
AutoDisplayContentsAncestorPusher adcp(aState.mTreeMatchContext, |
| 3690 |
aState.mPresContext, parent); |
| 3710 |
|
3691 |
|
| 3711 |
// Get the parent of the content and check if it is a XBL children element. |
3692 |
// Get the parent of the content and check if it is a XBL children element. |
| 3712 |
// Push the children element as an ancestor here because it does |
3693 |
// Push the children element as an ancestor here because it does |
| 3713 |
// not have a frame and would not otherwise be pushed as an ancestor. It is |
3694 |
// not have a frame and would not otherwise be pushed as an ancestor. It is |
| 3714 |
// necessary to do so in order to correctly handle style resolution on |
3695 |
// necessary to do so in order to correctly handle style resolution on |
| 3715 |
// descendants. |
3696 |
// descendants. (If !adcp.IsEmpty() then it was already pushed by |
| 3716 |
nsIContent* parent = content->GetParent(); |
3697 |
// AutoDisplayContentsAncestorPusher above.) |
| 3717 |
TreeMatchContext::AutoAncestorPusher |
3698 |
TreeMatchContext::AutoAncestorPusher |
| 3718 |
insertionPointPusher(aState.mTreeMatchContext); |
3699 |
insertionPointPusher(aState.mTreeMatchContext); |
| 3719 |
if (parent && nsContentUtils::IsContentInsertionPoint(parent)) { |
3700 |
if (adcp.IsEmpty() && parent && nsContentUtils::IsContentInsertionPoint(parent)) { |
| 3720 |
if (aState.mTreeMatchContext.mAncestorFilter.HasFilter()) { |
3701 |
if (aState.mTreeMatchContext.mAncestorFilter.HasFilter()) { |
| 3721 |
insertionPointPusher.PushAncestorAndStyleScope(parent); |
3702 |
insertionPointPusher.PushAncestorAndStyleScope(parent); |
| 3722 |
} else { |
3703 |
} else { |
| 3723 |
insertionPointPusher.PushStyleScope(parent); |
3704 |
insertionPointPusher.PushStyleScope(parent); |
| 3724 |
} |
3705 |
} |
| 3725 |
} |
3706 |
} |
| 3726 |
|
3707 |
|
| 3727 |
// Push the content as a style ancestor now, so we don't have to do |
3708 |
// Push the content as a style ancestor now, so we don't have to do |
|
Lines 3737-3752
nsCSSFrameConstructor::ConstructFrameFro
|
Link Here
|
|---|
|
| 3737 |
if (aState.mTreeMatchContext.mAncestorFilter.HasFilter()) { |
3718 |
if (aState.mTreeMatchContext.mAncestorFilter.HasFilter()) { |
| 3738 |
ancestorPusher.PushAncestorAndStyleScope(content); |
3719 |
ancestorPusher.PushAncestorAndStyleScope(content); |
| 3739 |
} else { |
3720 |
} else { |
| 3740 |
ancestorPusher.PushStyleScope(content); |
3721 |
ancestorPusher.PushStyleScope(content); |
| 3741 |
} |
3722 |
} |
| 3742 |
|
3723 |
|
| 3743 |
nsIFrame* newFrame; |
3724 |
nsIFrame* newFrame; |
| 3744 |
nsIFrame* primaryFrame; |
3725 |
nsIFrame* primaryFrame; |
|
|
3726 |
nsStyleContext* const styleContext = aItem.mStyleContext; |
| 3727 |
const nsStyleDisplay* display = styleContext->StyleDisplay(); |
| 3745 |
if (bits & FCDATA_FUNC_IS_FULL_CTOR) { |
3728 |
if (bits & FCDATA_FUNC_IS_FULL_CTOR) { |
| 3746 |
newFrame = |
3729 |
newFrame = |
| 3747 |
(this->*(data->mFullConstructor))(aState, aItem, aParentFrame, |
3730 |
(this->*(data->mFullConstructor))(aState, aItem, aParentFrame, |
| 3748 |
display, aFrameItems); |
3731 |
display, aFrameItems); |
| 3749 |
MOZ_ASSERT(newFrame, "Full constructor failed"); |
3732 |
MOZ_ASSERT(newFrame, "Full constructor failed"); |
| 3750 |
primaryFrame = newFrame; |
3733 |
primaryFrame = newFrame; |
| 3751 |
} else { |
3734 |
} else { |
| 3752 |
newFrame = |
3735 |
newFrame = |
|
Lines 3987-4002
nsCSSFrameConstructor::CreateAnonymousFr
|
Link Here
|
|---|
|
| 3987 |
} else { |
3970 |
} else { |
| 3988 |
ancestorPusher.PushStyleScope(aParent->AsElement()); |
3971 |
ancestorPusher.PushStyleScope(aParent->AsElement()); |
| 3989 |
} |
3972 |
} |
| 3990 |
|
3973 |
|
| 3991 |
nsIAnonymousContentCreator* creator = do_QueryFrame(aParentFrame); |
3974 |
nsIAnonymousContentCreator* creator = do_QueryFrame(aParentFrame); |
| 3992 |
NS_ASSERTION(creator, |
3975 |
NS_ASSERTION(creator, |
| 3993 |
"How can that happen if we have nodes to construct frames for?"); |
3976 |
"How can that happen if we have nodes to construct frames for?"); |
| 3994 |
|
3977 |
|
|
|
3978 |
InsertionPoint insertion(aParentFrame, aParent); |
| 3995 |
for (uint32_t i=0; i < count; i++) { |
3979 |
for (uint32_t i=0; i < count; i++) { |
| 3996 |
nsIContent* content = newAnonymousItems[i].mContent; |
3980 |
nsIContent* content = newAnonymousItems[i].mContent; |
| 3997 |
NS_ASSERTION(content, "null anonymous content?"); |
3981 |
NS_ASSERTION(content, "null anonymous content?"); |
| 3998 |
NS_ASSERTION(!newAnonymousItems[i].mStyleContext, "Unexpected style context"); |
3982 |
NS_ASSERTION(!newAnonymousItems[i].mStyleContext, "Unexpected style context"); |
| 3999 |
NS_ASSERTION(newAnonymousItems[i].mChildren.IsEmpty(), |
3983 |
NS_ASSERTION(newAnonymousItems[i].mChildren.IsEmpty(), |
| 4000 |
"This method is not currently used with frames that implement " |
3984 |
"This method is not currently used with frames that implement " |
| 4001 |
"nsIAnonymousContentCreator::CreateAnonymousContent to " |
3985 |
"nsIAnonymousContentCreator::CreateAnonymousContent to " |
| 4002 |
"output a list where the items have their own children"); |
3986 |
"output a list where the items have their own children"); |
|
Lines 4010-4026
nsCSSFrameConstructor::CreateAnonymousFr
|
Link Here
|
|---|
|
| 4010 |
} else { |
3994 |
} else { |
| 4011 |
FrameConstructionItemList items; |
3995 |
FrameConstructionItemList items; |
| 4012 |
{ |
3996 |
{ |
| 4013 |
// Skip parent display based style-fixup during our |
3997 |
// Skip parent display based style-fixup during our |
| 4014 |
// AddFrameConstructionItems() call: |
3998 |
// AddFrameConstructionItems() call: |
| 4015 |
TreeMatchContext::AutoParentDisplayBasedStyleFixupSkipper |
3999 |
TreeMatchContext::AutoParentDisplayBasedStyleFixupSkipper |
| 4016 |
parentDisplayBasedStyleFixupSkipper(aState.mTreeMatchContext); |
4000 |
parentDisplayBasedStyleFixupSkipper(aState.mTreeMatchContext); |
| 4017 |
|
4001 |
|
| 4018 |
AddFrameConstructionItems(aState, content, true, aParentFrame, items); |
4002 |
AddFrameConstructionItems(aState, content, true, insertion, items); |
| 4019 |
} |
4003 |
} |
| 4020 |
ConstructFramesFromItemList(aState, items, aParentFrame, aChildItems); |
4004 |
ConstructFramesFromItemList(aState, items, aParentFrame, aChildItems); |
| 4021 |
} |
4005 |
} |
| 4022 |
} |
4006 |
} |
| 4023 |
|
4007 |
|
| 4024 |
return NS_OK; |
4008 |
return NS_OK; |
| 4025 |
} |
4009 |
} |
| 4026 |
|
4010 |
|
|
Lines 4503-4519
nsCSSFrameConstructor::FindDisplayData(c
|
Link Here
|
|---|
|
| 4503 |
nsStyleContext* aStyleContext) |
4487 |
nsStyleContext* aStyleContext) |
| 4504 |
{ |
4488 |
{ |
| 4505 |
PR_STATIC_ASSERT(eParentTypeCount < (1 << (32 - FCDATA_PARENT_TYPE_OFFSET))); |
4489 |
PR_STATIC_ASSERT(eParentTypeCount < (1 << (32 - FCDATA_PARENT_TYPE_OFFSET))); |
| 4506 |
|
4490 |
|
| 4507 |
// The style system ensures that floated and positioned frames are |
4491 |
// The style system ensures that floated and positioned frames are |
| 4508 |
// block-level. |
4492 |
// block-level. |
| 4509 |
NS_ASSERTION(!(aDisplay->IsFloatingStyle() || |
4493 |
NS_ASSERTION(!(aDisplay->IsFloatingStyle() || |
| 4510 |
aDisplay->IsAbsolutelyPositionedStyle()) || |
4494 |
aDisplay->IsAbsolutelyPositionedStyle()) || |
| 4511 |
aDisplay->IsBlockOutsideStyle(), |
4495 |
aDisplay->IsBlockOutsideStyle() || |
|
|
4496 |
aDisplay->mDisplay == NS_STYLE_DISPLAY_CONTENTS, |
| 4512 |
"Style system did not apply CSS2.1 section 9.7 fixups"); |
4497 |
"Style system did not apply CSS2.1 section 9.7 fixups"); |
| 4513 |
|
4498 |
|
| 4514 |
// If this is "body", try propagating its scroll style to the viewport |
4499 |
// If this is "body", try propagating its scroll style to the viewport |
| 4515 |
// Note that we need to do this even if the body is NOT scrollable; |
4500 |
// Note that we need to do this even if the body is NOT scrollable; |
| 4516 |
// it might have dynamically changed from scrollable to not scrollable, |
4501 |
// it might have dynamically changed from scrollable to not scrollable, |
| 4517 |
// and that might need to be propagated. |
4502 |
// and that might need to be propagated. |
| 4518 |
// XXXbz is this the right place to do this? If this code moves, |
4503 |
// XXXbz is this the right place to do this? If this code moves, |
| 4519 |
// make this function static. |
4504 |
// make this function static. |
|
Lines 4644-4662
nsCSSFrameConstructor::FindDisplayData(c
|
Link Here
|
|---|
|
| 4644 |
&nsCSSFrameConstructor::ConstructTableCol) }, |
4629 |
&nsCSSFrameConstructor::ConstructTableCol) }, |
| 4645 |
{ NS_STYLE_DISPLAY_TABLE_ROW, |
4630 |
{ NS_STYLE_DISPLAY_TABLE_ROW, |
| 4646 |
FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | |
4631 |
FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | |
| 4647 |
FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRowGroup), |
4632 |
FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRowGroup), |
| 4648 |
&nsCSSFrameConstructor::ConstructTableRowOrRowGroup) }, |
4633 |
&nsCSSFrameConstructor::ConstructTableRowOrRowGroup) }, |
| 4649 |
{ NS_STYLE_DISPLAY_TABLE_CELL, |
4634 |
{ NS_STYLE_DISPLAY_TABLE_CELL, |
| 4650 |
FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | |
4635 |
FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | |
| 4651 |
FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRow), |
4636 |
FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRow), |
| 4652 |
&nsCSSFrameConstructor::ConstructTableCell) } |
4637 |
&nsCSSFrameConstructor::ConstructTableCell) }, |
|
|
4638 |
{ NS_STYLE_DISPLAY_CONTENTS, |
| 4639 |
FULL_CTOR_FCDATA(FCDATA_IS_CONTENTS, nullptr/*never called*/) } |
| 4653 |
}; |
4640 |
}; |
| 4654 |
|
4641 |
|
|
|
4642 |
// See the mDisplay fixup code in nsRuleNode::ComputeDisplayData. |
| 4643 |
MOZ_ASSERT(aDisplay->mDisplay != NS_STYLE_DISPLAY_CONTENTS || |
| 4644 |
!aElement->IsRootOfNativeAnonymousSubtree(), |
| 4645 |
"display:contents on anonymous content is unsupported"); |
| 4646 |
|
| 4655 |
return FindDataByInt(aDisplay->mDisplay, |
4647 |
return FindDataByInt(aDisplay->mDisplay, |
| 4656 |
aElement, aStyleContext, sDisplayData, |
4648 |
aElement, aStyleContext, sDisplayData, |
| 4657 |
ArrayLength(sDisplayData)); |
4649 |
ArrayLength(sDisplayData)); |
| 4658 |
} |
4650 |
} |
| 4659 |
|
4651 |
|
| 4660 |
nsIFrame* |
4652 |
nsIFrame* |
| 4661 |
nsCSSFrameConstructor::ConstructScrollableBlock(nsFrameConstructorState& aState, |
4653 |
nsCSSFrameConstructor::ConstructScrollableBlock(nsFrameConstructorState& aState, |
| 4662 |
FrameConstructionItem& aItem, |
4654 |
FrameConstructionItem& aItem, |
|
Lines 4760-4796
nsCSSFrameConstructor::InitAndRestoreFra
|
Link Here
|
|---|
|
| 4760 |
if (aAllowCounters && |
4752 |
if (aAllowCounters && |
| 4761 |
mCounterManager.AddCounterResetsAndIncrements(aNewFrame)) { |
4753 |
mCounterManager.AddCounterResetsAndIncrements(aNewFrame)) { |
| 4762 |
CountersDirty(); |
4754 |
CountersDirty(); |
| 4763 |
} |
4755 |
} |
| 4764 |
} |
4756 |
} |
| 4765 |
|
4757 |
|
| 4766 |
already_AddRefed<nsStyleContext> |
4758 |
already_AddRefed<nsStyleContext> |
| 4767 |
nsCSSFrameConstructor::ResolveStyleContext(nsIFrame* aParentFrame, |
4759 |
nsCSSFrameConstructor::ResolveStyleContext(nsIFrame* aParentFrame, |
| 4768 |
nsIContent* aContent, |
4760 |
nsIContent* aContainer, |
|
|
4761 |
nsIContent* aChild, |
| 4769 |
nsFrameConstructorState* aState) |
4762 |
nsFrameConstructorState* aState) |
| 4770 |
{ |
4763 |
{ |
| 4771 |
nsStyleContext* parentStyleContext = nullptr; |
4764 |
MOZ_ASSERT(aContainer, "Must have parent here"); |
| 4772 |
NS_ASSERTION(aContent->GetParent(), "Must have parent here"); |
4765 |
// XXX uncomment when bug 1089223 is fixed: |
| 4773 |
|
4766 |
// MOZ_ASSERT(aContainer == aChild->GetFlattenedTreeParent()); |
| 4774 |
aParentFrame = nsFrame::CorrectStyleParentFrame(aParentFrame, nullptr); |
4767 |
nsStyleContext* parentStyleContext = GetDisplayContentsStyleFor(aContainer); |
| 4775 |
|
4768 |
if (MOZ_LIKELY(!parentStyleContext)) { |
| 4776 |
if (aParentFrame) { |
4769 |
aParentFrame = nsFrame::CorrectStyleParentFrame(aParentFrame, nullptr); |
| 4777 |
// Resolve the style context based on the content object and the parent |
4770 |
if (aParentFrame) { |
| 4778 |
// style context |
4771 |
MOZ_ASSERT(aParentFrame->GetContent() == aContainer); |
| 4779 |
parentStyleContext = aParentFrame->StyleContext(); |
4772 |
// Resolve the style context based on the content object and the parent |
| 4780 |
} else { |
4773 |
// style context |
| 4781 |
// Perhaps aParentFrame is a canvasFrame and we're replicating |
4774 |
parentStyleContext = aParentFrame->StyleContext(); |
| 4782 |
// fixed-pos frames. |
4775 |
} else { |
| 4783 |
// XXX should we create a way to tell ConstructFrame which style |
4776 |
// Perhaps aParentFrame is a canvasFrame and we're replicating |
| 4784 |
// context to use, and pass it the style context for the |
4777 |
// fixed-pos frames. |
| 4785 |
// previous page's fixed-pos frame? |
4778 |
// XXX should we create a way to tell ConstructFrame which style |
| 4786 |
} |
4779 |
// context to use, and pass it the style context for the |
| 4787 |
|
4780 |
// previous page's fixed-pos frame? |
| 4788 |
return ResolveStyleContext(parentStyleContext, aContent, aState); |
4781 |
} |
|
|
4782 |
} |
| 4783 |
|
| 4784 |
return ResolveStyleContext(parentStyleContext, aChild, aState); |
| 4785 |
} |
| 4786 |
|
| 4787 |
already_AddRefed<nsStyleContext> |
| 4788 |
nsCSSFrameConstructor::ResolveStyleContext(nsIFrame* aParentFrame, |
| 4789 |
nsIContent* aChild, |
| 4790 |
nsFrameConstructorState* aState) |
| 4791 |
{ |
| 4792 |
return ResolveStyleContext(aParentFrame, aChild->GetFlattenedTreeParent(), aChild, aState); |
| 4793 |
} |
| 4794 |
|
| 4795 |
already_AddRefed<nsStyleContext> |
| 4796 |
nsCSSFrameConstructor::ResolveStyleContext(const InsertionPoint& aInsertion, |
| 4797 |
nsIContent* aChild, |
| 4798 |
nsFrameConstructorState* aState) |
| 4799 |
{ |
| 4800 |
return ResolveStyleContext(aInsertion.mParentFrame, aInsertion.mContainer, |
| 4801 |
aChild, aState); |
| 4789 |
} |
4802 |
} |
| 4790 |
|
4803 |
|
| 4791 |
already_AddRefed<nsStyleContext> |
4804 |
already_AddRefed<nsStyleContext> |
| 4792 |
nsCSSFrameConstructor::ResolveStyleContext(nsStyleContext* aParentStyleContext, |
4805 |
nsCSSFrameConstructor::ResolveStyleContext(nsStyleContext* aParentStyleContext, |
| 4793 |
nsIContent* aContent, |
4806 |
nsIContent* aContent, |
| 4794 |
nsFrameConstructorState* aState) |
4807 |
nsFrameConstructorState* aState) |
| 4795 |
{ |
4808 |
{ |
| 4796 |
nsStyleSet *styleSet = mPresShell->StyleSet(); |
4809 |
nsStyleSet *styleSet = mPresShell->StyleSet(); |
|
Lines 5298-5319
nsCSSFrameConstructor::AddPageBreakItem(
|
Link Here
|
|---|
|
| 5298 |
|
5311 |
|
| 5299 |
// Lie about the tag and namespace so we don't trigger anything |
5312 |
// Lie about the tag and namespace so we don't trigger anything |
| 5300 |
// interesting during frame construction. |
5313 |
// interesting during frame construction. |
| 5301 |
aItems.AppendItem(&sPageBreakData, aContent, nsCSSAnonBoxes::pageBreak, |
5314 |
aItems.AppendItem(&sPageBreakData, aContent, nsCSSAnonBoxes::pageBreak, |
| 5302 |
kNameSpaceID_None, nullptr, pseudoStyle.forget(), |
5315 |
kNameSpaceID_None, nullptr, pseudoStyle.forget(), |
| 5303 |
true, nullptr); |
5316 |
true, nullptr); |
| 5304 |
} |
5317 |
} |
| 5305 |
|
5318 |
|
| 5306 |
void |
5319 |
bool |
| 5307 |
nsCSSFrameConstructor::AddFrameConstructionItems(nsFrameConstructorState& aState, |
5320 |
nsCSSFrameConstructor::ShouldCreateItemsForChild(nsFrameConstructorState& aState, |
| 5308 |
nsIContent* aContent, |
5321 |
nsIContent* aContent, |
| 5309 |
bool aSuppressWhiteSpaceOptimizations, |
5322 |
nsContainerFrame* aParentFrame) |
| 5310 |
nsContainerFrame* aParentFrame, |
|
|
| 5311 |
FrameConstructionItemList& aItems) |
| 5312 |
{ |
5323 |
{ |
| 5313 |
aContent->UnsetFlags(NODE_DESCENDANTS_NEED_FRAMES | NODE_NEEDS_FRAME); |
5324 |
aContent->UnsetFlags(NODE_DESCENDANTS_NEED_FRAMES | NODE_NEEDS_FRAME); |
| 5314 |
if (aContent->IsElement()) { |
5325 |
if (aContent->IsElement()) { |
| 5315 |
// We can't just remove our pending restyle flags, since we may |
5326 |
// We can't just remove our pending restyle flags, since we may |
| 5316 |
// have restyle-later-siblings set on us. But we _can_ remove the |
5327 |
// have restyle-later-siblings set on us. But we _can_ remove the |
| 5317 |
// "is possible restyle root" flags, and need to. Otherwise we can |
5328 |
// "is possible restyle root" flags, and need to. Otherwise we can |
| 5318 |
// end up with stale such flags (e.g. if we used to have a |
5329 |
// end up with stale such flags (e.g. if we used to have a |
| 5319 |
// display:none parent when our last restyle was posted and |
5330 |
// display:none parent when our last restyle was posted and |
|
Lines 5324-5373
nsCSSFrameConstructor::AddFrameConstruct
|
Link Here
|
|---|
|
| 5324 |
|
5335 |
|
| 5325 |
// XXX the GetContent() != aContent check is needed due to bug 135040. |
5336 |
// XXX the GetContent() != aContent check is needed due to bug 135040. |
| 5326 |
// Remove it once that's fixed. |
5337 |
// Remove it once that's fixed. |
| 5327 |
if (aContent->GetPrimaryFrame() && |
5338 |
if (aContent->GetPrimaryFrame() && |
| 5328 |
aContent->GetPrimaryFrame()->GetContent() == aContent && |
5339 |
aContent->GetPrimaryFrame()->GetContent() == aContent && |
| 5329 |
!aState.mCreatingExtraFrames) { |
5340 |
!aState.mCreatingExtraFrames) { |
| 5330 |
NS_ERROR("asked to create frame construction item for a node that already " |
5341 |
NS_ERROR("asked to create frame construction item for a node that already " |
| 5331 |
"has a frame"); |
5342 |
"has a frame"); |
| 5332 |
return; |
5343 |
return false; |
| 5333 |
} |
5344 |
} |
| 5334 |
|
5345 |
|
| 5335 |
// don't create a whitespace frame if aParent doesn't want it |
5346 |
// don't create a whitespace frame if aParent doesn't want it |
| 5336 |
if (!NeedFrameFor(aState, aParentFrame, aContent)) { |
5347 |
if (!NeedFrameFor(aState, aParentFrame, aContent)) { |
| 5337 |
return; |
5348 |
return false; |
| 5338 |
} |
5349 |
} |
| 5339 |
|
5350 |
|
| 5340 |
// never create frames for comments or PIs |
5351 |
// never create frames for comments or PIs |
| 5341 |
if (aContent->IsNodeOfType(nsINode::eCOMMENT) || |
5352 |
if (aContent->IsNodeOfType(nsINode::eCOMMENT) || |
| 5342 |
aContent->IsNodeOfType(nsINode::ePROCESSING_INSTRUCTION)) |
5353 |
aContent->IsNodeOfType(nsINode::ePROCESSING_INSTRUCTION)) { |
| 5343 |
return; |
5354 |
return false; |
| 5344 |
|
5355 |
} |
| 5345 |
nsRefPtr<nsStyleContext> styleContext; |
5356 |
|
| 5346 |
styleContext = ResolveStyleContext(aParentFrame, aContent, &aState); |
5357 |
return true; |
| 5347 |
|
5358 |
} |
|
|
5359 |
|
| 5360 |
void |
| 5361 |
nsCSSFrameConstructor::DoAddFrameConstructionItems(nsFrameConstructorState& aState, |
| 5362 |
nsIContent* aContent, |
| 5363 |
nsStyleContext* aStyleContext, |
| 5364 |
bool aSuppressWhiteSpaceOptimizations, |
| 5365 |
nsContainerFrame* aParentFrame, |
| 5366 |
nsTArray<nsIAnonymousContentCreator::ContentInfo>* aAnonChildren, |
| 5367 |
FrameConstructionItemList& aItems) |
| 5368 |
{ |
| 5348 |
uint32_t flags = ITEM_ALLOW_XBL_BASE | ITEM_ALLOW_PAGE_BREAK; |
5369 |
uint32_t flags = ITEM_ALLOW_XBL_BASE | ITEM_ALLOW_PAGE_BREAK; |
| 5349 |
if (aParentFrame->IsSVGText()) { |
5370 |
if (aParentFrame) { |
| 5350 |
flags |= ITEM_IS_WITHIN_SVG_TEXT; |
5371 |
if (aParentFrame->IsSVGText()) { |
| 5351 |
} |
5372 |
flags |= ITEM_IS_WITHIN_SVG_TEXT; |
| 5352 |
if (aParentFrame->GetType() == nsGkAtoms::blockFrame && |
5373 |
} |
| 5353 |
aParentFrame->GetParent() && |
5374 |
if (aParentFrame->GetType() == nsGkAtoms::blockFrame && |
| 5354 |
aParentFrame->GetParent()->GetType() == nsGkAtoms::svgTextFrame) { |
5375 |
aParentFrame->GetParent() && |
| 5355 |
flags |= ITEM_ALLOWS_TEXT_PATH_CHILD; |
5376 |
aParentFrame->GetParent()->GetType() == nsGkAtoms::svgTextFrame) { |
|
|
5377 |
flags |= ITEM_ALLOWS_TEXT_PATH_CHILD; |
| 5378 |
} |
| 5356 |
} |
5379 |
} |
| 5357 |
AddFrameConstructionItemsInternal(aState, aContent, aParentFrame, |
5380 |
AddFrameConstructionItemsInternal(aState, aContent, aParentFrame, |
| 5358 |
aContent->Tag(), aContent->GetNameSpaceID(), |
5381 |
aContent->Tag(), aContent->GetNameSpaceID(), |
| 5359 |
aSuppressWhiteSpaceOptimizations, |
5382 |
aSuppressWhiteSpaceOptimizations, |
| 5360 |
styleContext, |
5383 |
aStyleContext, |
| 5361 |
flags, nullptr, |
5384 |
flags, aAnonChildren, |
| 5362 |
aItems); |
5385 |
aItems); |
| 5363 |
} |
5386 |
} |
| 5364 |
|
5387 |
|
| 5365 |
void |
5388 |
void |
|
|
5389 |
nsCSSFrameConstructor::AddFrameConstructionItems(nsFrameConstructorState& aState, |
| 5390 |
nsIContent* aContent, |
| 5391 |
bool aSuppressWhiteSpaceOptimizations, |
| 5392 |
const InsertionPoint& aInsertion, |
| 5393 |
FrameConstructionItemList& aItems) |
| 5394 |
{ |
| 5395 |
nsContainerFrame* parentFrame = aInsertion.mParentFrame; |
| 5396 |
if (!ShouldCreateItemsForChild(aState, aContent, parentFrame)) { |
| 5397 |
return; |
| 5398 |
} |
| 5399 |
nsRefPtr<nsStyleContext> styleContext = |
| 5400 |
ResolveStyleContext(aInsertion, aContent, &aState); |
| 5401 |
DoAddFrameConstructionItems(aState, aContent, styleContext, |
| 5402 |
aSuppressWhiteSpaceOptimizations, parentFrame, |
| 5403 |
nullptr, aItems); |
| 5404 |
} |
| 5405 |
|
| 5406 |
void |
| 5366 |
nsCSSFrameConstructor::SetAsUndisplayedContent(nsFrameConstructorState& aState, |
5407 |
nsCSSFrameConstructor::SetAsUndisplayedContent(nsFrameConstructorState& aState, |
| 5367 |
FrameConstructionItemList& aList, |
5408 |
FrameConstructionItemList& aList, |
| 5368 |
nsIContent* aContent, |
5409 |
nsIContent* aContent, |
| 5369 |
nsStyleContext* aStyleContext, |
5410 |
nsStyleContext* aStyleContext, |
| 5370 |
bool aIsGeneratedContent) |
5411 |
bool aIsGeneratedContent) |
| 5371 |
{ |
5412 |
{ |
| 5372 |
if (aStyleContext->GetPseudo()) { |
5413 |
if (aStyleContext->GetPseudo()) { |
| 5373 |
if (aIsGeneratedContent) { |
5414 |
if (aIsGeneratedContent) { |
|
Lines 5395-5410
nsCSSFrameConstructor::AddFrameConstruct
|
Link Here
|
|---|
|
| 5395 |
nsStyleContext* aStyleContext, |
5436 |
nsStyleContext* aStyleContext, |
| 5396 |
uint32_t aFlags, |
5437 |
uint32_t aFlags, |
| 5397 |
nsTArray<nsIAnonymousContentCreator::ContentInfo>* aAnonChildren, |
5438 |
nsTArray<nsIAnonymousContentCreator::ContentInfo>* aAnonChildren, |
| 5398 |
FrameConstructionItemList& aItems) |
5439 |
FrameConstructionItemList& aItems) |
| 5399 |
{ |
5440 |
{ |
| 5400 |
NS_PRECONDITION(aContent->IsNodeOfType(nsINode::eTEXT) || |
5441 |
NS_PRECONDITION(aContent->IsNodeOfType(nsINode::eTEXT) || |
| 5401 |
aContent->IsElement(), |
5442 |
aContent->IsElement(), |
| 5402 |
"Shouldn't get anything else here!"); |
5443 |
"Shouldn't get anything else here!"); |
|
|
5444 |
MOZ_ASSERT(!aContent->GetPrimaryFrame() || aState.mCreatingExtraFrames || |
| 5445 |
aContent->Tag() == nsGkAtoms::area); |
| 5403 |
|
5446 |
|
| 5404 |
// The following code allows the user to specify the base tag |
5447 |
// The following code allows the user to specify the base tag |
| 5405 |
// of an element using XBL. XUL and HTML objects (like boxes, menus, etc.) |
5448 |
// of an element using XBL. XUL and HTML objects (like boxes, menus, etc.) |
| 5406 |
// can then be extended arbitrarily. |
5449 |
// can then be extended arbitrarily. |
| 5407 |
const nsStyleDisplay* display = aStyleContext->StyleDisplay(); |
5450 |
const nsStyleDisplay* display = aStyleContext->StyleDisplay(); |
| 5408 |
nsRefPtr<nsStyleContext> styleContext(aStyleContext); |
5451 |
nsRefPtr<nsStyleContext> styleContext(aStyleContext); |
| 5409 |
PendingBinding* pendingBinding = nullptr; |
5452 |
PendingBinding* pendingBinding = nullptr; |
| 5410 |
if ((aFlags & ITEM_ALLOW_XBL_BASE) && display->mBinding) |
5453 |
if ((aFlags & ITEM_ALLOW_XBL_BASE) && display->mBinding) |
|
Lines 5566-5581
nsCSSFrameConstructor::AddFrameConstruct
|
Link Here
|
|---|
|
| 5566 |
!display->IsAbsolutelyPositionedStyle() && |
5609 |
!display->IsAbsolutelyPositionedStyle() && |
| 5567 |
!(bits & FCDATA_IS_TABLE_PART) && |
5610 |
!(bits & FCDATA_IS_TABLE_PART) && |
| 5568 |
!(bits & FCDATA_IS_SVG_TEXT); |
5611 |
!(bits & FCDATA_IS_SVG_TEXT); |
| 5569 |
|
5612 |
|
| 5570 |
if (canHavePageBreak && display->mBreakBefore) { |
5613 |
if (canHavePageBreak && display->mBreakBefore) { |
| 5571 |
AddPageBreakItem(aContent, aStyleContext, aItems); |
5614 |
AddPageBreakItem(aContent, aStyleContext, aItems); |
| 5572 |
} |
5615 |
} |
| 5573 |
|
5616 |
|
|
|
5617 |
if (MOZ_UNLIKELY(bits & FCDATA_IS_CONTENTS)) { |
| 5618 |
if (!GetDisplayContentsStyleFor(aContent)) { |
| 5619 |
MOZ_ASSERT(styleContext->GetPseudo() || !isGeneratedContent, |
| 5620 |
"Should have had pseudo type"); |
| 5621 |
aState.mFrameManager->SetDisplayContents(aContent, styleContext); |
| 5622 |
} else { |
| 5623 |
aState.mFrameManager->ChangeDisplayContents(aContent, styleContext); |
| 5624 |
} |
| 5625 |
|
| 5626 |
TreeMatchContext::AutoAncestorPusher ancestorPusher(aState.mTreeMatchContext); |
| 5627 |
if (aState.mTreeMatchContext.mAncestorFilter.HasFilter()) { |
| 5628 |
ancestorPusher.PushAncestorAndStyleScope(aContent->AsElement()); |
| 5629 |
} else { |
| 5630 |
ancestorPusher.PushStyleScope(aContent->AsElement()); |
| 5631 |
} |
| 5632 |
|
| 5633 |
if (aParentFrame) { |
| 5634 |
aParentFrame->AddStateBits(NS_FRAME_MAY_HAVE_GENERATED_CONTENT); |
| 5635 |
} |
| 5636 |
CreateGeneratedContentItem(aState, aParentFrame, aContent, styleContext, |
| 5637 |
nsCSSPseudoElements::ePseudo_before, aItems); |
| 5638 |
|
| 5639 |
FlattenedChildIterator iter(aContent); |
| 5640 |
for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) { |
| 5641 |
if (!ShouldCreateItemsForChild(aState, child, aParentFrame)) { |
| 5642 |
continue; |
| 5643 |
} |
| 5644 |
|
| 5645 |
// Get the parent of the content and check if it is a XBL children element |
| 5646 |
// (if the content is a children element then parent != aContent because the |
| 5647 |
// FlattenedChildIterator will transitively iterate through <xbl:children> |
| 5648 |
// for default content). Push the children element as an ancestor here because |
| 5649 |
// it does not have a frame and would not otherwise be pushed as an ancestor. |
| 5650 |
nsIContent* parent = child->GetParent(); |
| 5651 |
MOZ_ASSERT(parent, "Parent must be non-null because we are iterating children."); |
| 5652 |
TreeMatchContext::AutoAncestorPusher ancestorPusher(aState.mTreeMatchContext); |
| 5653 |
if (parent != aContent && parent->IsElement()) { |
| 5654 |
if (aState.mTreeMatchContext.mAncestorFilter.HasFilter()) { |
| 5655 |
ancestorPusher.PushAncestorAndStyleScope(parent->AsElement()); |
| 5656 |
} else { |
| 5657 |
ancestorPusher.PushStyleScope(parent->AsElement()); |
| 5658 |
} |
| 5659 |
} |
| 5660 |
|
| 5661 |
nsRefPtr<nsStyleContext> childContext = |
| 5662 |
ResolveStyleContext(styleContext, child, &aState); |
| 5663 |
DoAddFrameConstructionItems(aState, child, childContext, |
| 5664 |
aSuppressWhiteSpaceOptimizations, |
| 5665 |
aParentFrame, aAnonChildren, aItems); |
| 5666 |
} |
| 5667 |
aItems.SetParentHasNoXBLChildren(!iter.XBLInvolved()); |
| 5668 |
|
| 5669 |
CreateGeneratedContentItem(aState, aParentFrame, aContent, styleContext, |
| 5670 |
nsCSSPseudoElements::ePseudo_after, aItems); |
| 5671 |
if (canHavePageBreak && display->mBreakAfter) { |
| 5672 |
AddPageBreakItem(aContent, aStyleContext, aItems); |
| 5673 |
} |
| 5674 |
return; |
| 5675 |
} |
| 5676 |
|
| 5574 |
FrameConstructionItem* item = |
5677 |
FrameConstructionItem* item = |
| 5575 |
aItems.AppendItem(data, aContent, aTag, aNameSpaceID, |
5678 |
aItems.AppendItem(data, aContent, aTag, aNameSpaceID, |
| 5576 |
pendingBinding, styleContext.forget(), |
5679 |
pendingBinding, styleContext.forget(), |
| 5577 |
aSuppressWhiteSpaceOptimizations, aAnonChildren); |
5680 |
aSuppressWhiteSpaceOptimizations, aAnonChildren); |
| 5578 |
if (!item) { |
5681 |
if (!item) { |
| 5579 |
if (isGeneratedContent) { |
5682 |
if (isGeneratedContent) { |
| 5580 |
aContent->UnbindFromTree(); |
5683 |
aContent->UnbindFromTree(); |
| 5581 |
} |
5684 |
} |
|
Lines 5672-5705
nsCSSFrameConstructor::AddFrameConstruct
|
Link Here
|
|---|
|
| 5672 |
((bits & FCDATA_DISALLOW_OUT_OF_FLOW) || |
5775 |
((bits & FCDATA_DISALLOW_OUT_OF_FLOW) || |
| 5673 |
!aState.GetGeometricParent(display, nullptr))) { |
5776 |
!aState.GetGeometricParent(display, nullptr))) { |
| 5674 |
item->mIsLineParticipant = true; |
5777 |
item->mIsLineParticipant = true; |
| 5675 |
aItems.LineParticipantItemAdded(); |
5778 |
aItems.LineParticipantItemAdded(); |
| 5676 |
} |
5779 |
} |
| 5677 |
} |
5780 |
} |
| 5678 |
|
5781 |
|
| 5679 |
static void |
5782 |
static void |
| 5680 |
DestroyContent(void* aPropertyValue) |
5783 |
AddGenConPseudoToFrame(nsIFrame* aOwnerFrame, nsIContent* aContent) |
| 5681 |
{ |
5784 |
{ |
| 5682 |
nsIContent* content = static_cast<nsIContent*>(aPropertyValue); |
5785 |
typedef nsAutoTArray<nsIContent*, 2> T; |
| 5683 |
content->UnbindFromTree(); |
5786 |
const FramePropertyDescriptor* prop = nsIFrame::GenConProperty(); |
| 5684 |
NS_RELEASE(content); |
5787 |
FrameProperties props = aOwnerFrame->Properties(); |
| 5685 |
} |
5788 |
T* value = static_cast<T*>(props.Get(prop)); |
| 5686 |
|
5789 |
if (!value) { |
| 5687 |
NS_DECLARE_FRAME_PROPERTY(BeforeProperty, DestroyContent) |
5790 |
value = new T; |
| 5688 |
NS_DECLARE_FRAME_PROPERTY(AfterProperty, DestroyContent) |
5791 |
props.Set(prop, value); |
| 5689 |
|
5792 |
} |
| 5690 |
static const FramePropertyDescriptor* |
5793 |
value->AppendElement(aContent); |
| 5691 |
GenConPseudoToProperty(nsIAtom* aPseudo) |
|
|
| 5692 |
{ |
| 5693 |
NS_ASSERTION(aPseudo == nsCSSPseudoElements::before || |
| 5694 |
aPseudo == nsCSSPseudoElements::after, |
| 5695 |
"Bad gen-con pseudo"); |
| 5696 |
return aPseudo == nsCSSPseudoElements::before ? BeforeProperty() |
| 5697 |
: AfterProperty(); |
| 5698 |
} |
5794 |
} |
| 5699 |
|
5795 |
|
| 5700 |
/** |
5796 |
/** |
| 5701 |
* Return true if the frame construction item pointed to by aIter will |
5797 |
* Return true if the frame construction item pointed to by aIter will |
| 5702 |
* create a frame adjacent to a line boundary in the frame tree, and that |
5798 |
* create a frame adjacent to a line boundary in the frame tree, and that |
| 5703 |
* line boundary is induced by a content node adjacent to the frame's |
5799 |
* line boundary is induced by a content node adjacent to the frame's |
| 5704 |
* content node in the content tree. The latter condition is necessary so |
5800 |
* content node in the content tree. The latter condition is necessary so |
| 5705 |
* that ContentAppended/ContentInserted/ContentRemoved can easily find any |
5801 |
* that ContentAppended/ContentInserted/ContentRemoved can easily find any |
|
Lines 5793-5810
nsCSSFrameConstructor::ConstructFramesFr
|
Link Here
|
|---|
|
| 5793 |
// NS_FRAME_GENERATED_CONTENT. |
5889 |
// NS_FRAME_GENERATED_CONTENT. |
| 5794 |
aState.mAdditionalStateBits |= NS_FRAME_GENERATED_CONTENT; |
5890 |
aState.mAdditionalStateBits |= NS_FRAME_GENERATED_CONTENT; |
| 5795 |
|
5891 |
|
| 5796 |
// Note that we're not necessarily setting this property on the primary |
5892 |
// Note that we're not necessarily setting this property on the primary |
| 5797 |
// frame for the content for which this is generated content. We might be |
5893 |
// frame for the content for which this is generated content. We might be |
| 5798 |
// setting it on a table pseudo-frame inserted under that instead. That's |
5894 |
// setting it on a table pseudo-frame inserted under that instead. That's |
| 5799 |
// OK, though; we just need to do the property set so that the content will |
5895 |
// OK, though; we just need to do the property set so that the content will |
| 5800 |
// get cleaned up when the frame is destroyed. |
5896 |
// get cleaned up when the frame is destroyed. |
| 5801 |
aParentFrame->Properties().Set(GenConPseudoToProperty(styleContext->GetPseudo()), |
5897 |
::AddGenConPseudoToFrame(aParentFrame, item.mContent); |
| 5802 |
item.mContent); |
|
|
| 5803 |
|
5898 |
|
| 5804 |
// Now that we've passed ownership of item.mContent to the frame, unset |
5899 |
// Now that we've passed ownership of item.mContent to the frame, unset |
| 5805 |
// our generated content flag so we don't release or unbind it ourselves. |
5900 |
// our generated content flag so we don't release or unbind it ourselves. |
| 5806 |
item.mIsGeneratedContent = false; |
5901 |
item.mIsGeneratedContent = false; |
| 5807 |
} |
5902 |
} |
| 5808 |
|
5903 |
|
| 5809 |
// XXXbz maybe just inline ConstructFrameFromItemInternal here or something? |
5904 |
// XXXbz maybe just inline ConstructFrameFromItemInternal here or something? |
| 5810 |
ConstructFrameFromItemInternal(item, aState, adjParentFrame, aFrameItems); |
5905 |
ConstructFrameFromItemInternal(item, aState, adjParentFrame, aFrameItems); |
|
Lines 5929-5959
nsCSSFrameConstructor::GetFloatContainin
|
Link Here
|
|---|
|
| 5929 |
|
6024 |
|
| 5930 |
/** |
6025 |
/** |
| 5931 |
* This function will check whether aContainer has :after generated content. |
6026 |
* This function will check whether aContainer has :after generated content. |
| 5932 |
* If so, appending to it should actually insert. The return value is the |
6027 |
* If so, appending to it should actually insert. The return value is the |
| 5933 |
* parent to use for newly-appended content. *aAfterFrame points to the :after |
6028 |
* parent to use for newly-appended content. *aAfterFrame points to the :after |
| 5934 |
* frame before which appended content should go, if there is one. |
6029 |
* frame before which appended content should go, if there is one. |
| 5935 |
*/ |
6030 |
*/ |
| 5936 |
static nsContainerFrame* |
6031 |
static nsContainerFrame* |
| 5937 |
AdjustAppendParentForAfterContent(nsPresContext* aPresContext, |
6032 |
AdjustAppendParentForAfterContent(nsFrameManager* aFrameManager, |
| 5938 |
nsIContent* aContainer, |
6033 |
nsIContent* aContainer, |
| 5939 |
nsContainerFrame* aParentFrame, |
6034 |
nsContainerFrame* aParentFrame, |
|
|
6035 |
nsIContent* aChild, |
| 5940 |
nsIFrame** aAfterFrame) |
6036 |
nsIFrame** aAfterFrame) |
| 5941 |
{ |
6037 |
{ |
| 5942 |
// See if the parent has an :after pseudo-element. Check for the presence |
6038 |
// If the parent frame has any pseudo-elements or aContainer is a |
| 5943 |
// of style first, since nsLayoutUtils::GetAfterFrame is sorta expensive. |
6039 |
// display:contents node then we need to walk through the child |
| 5944 |
nsStyleContext* parentStyle = aParentFrame->StyleContext(); |
6040 |
// frames to find the first one that is either a ::after frame for an |
| 5945 |
if (nsLayoutUtils::HasPseudoStyle(aContainer, parentStyle, |
6041 |
// ancestor of aChild or a frame that is for a node later in the |
|
|
6042 |
// document than aChild and return that in aAfterFrame. |
| 6043 |
if (aParentFrame->GetGenConPseudos() || |
| 6044 |
nsLayoutUtils::HasPseudoStyle(aContainer, aParentFrame->StyleContext(), |
| 5946 |
nsCSSPseudoElements::ePseudo_after, |
6045 |
nsCSSPseudoElements::ePseudo_after, |
| 5947 |
aPresContext)) { |
6046 |
aParentFrame->PresContext()) || |
| 5948 |
// Ensure that the :after frame is on the principal child list. |
6047 |
aFrameManager->GetDisplayContentsStyleFor(aContainer)) { |
| 5949 |
aParentFrame->DrainSelfOverflowList(); |
6048 |
nsIFrame* afterFrame = nullptr; |
| 5950 |
|
6049 |
nsContainerFrame* parent = |
| 5951 |
nsIFrame* afterFrame = nsLayoutUtils::GetAfterFrame(aParentFrame); |
6050 |
static_cast<nsContainerFrame*>(aParentFrame->LastContinuation()); |
|
|
6051 |
bool done = false; |
| 6052 |
while (!done && parent) { |
| 6053 |
// Ensure that all normal flow children are on the principal child list. |
| 6054 |
parent->DrainSelfOverflowList(); |
| 6055 |
|
| 6056 |
nsIFrame* child = parent->GetLastChild(nsIFrame::kPrincipalList); |
| 6057 |
if (child && child->IsPseudoFrame(aContainer) && |
| 6058 |
!child->IsGeneratedContentFrame()) { |
| 6059 |
// Drill down into non-generated pseudo frames of aContainer. |
| 6060 |
parent = nsLayoutUtils::LastContinuationWithChild(do_QueryFrame(child)); |
| 6061 |
continue; |
| 6062 |
} |
| 6063 |
|
| 6064 |
for (; child; child = child->GetPrevSibling()) { |
| 6065 |
nsIContent* c = child->GetContent(); |
| 6066 |
if (child->IsGeneratedContentFrame()) { |
| 6067 |
nsIContent* p = c->GetParent(); |
| 6068 |
if (c->Tag() == nsGkAtoms::mozgeneratedcontentafter) { |
| 6069 |
if (!nsContentUtils::ContentIsDescendantOf(aChild, p) && |
| 6070 |
p != aContainer && |
| 6071 |
nsContentUtils::PositionIsBefore(p, aChild)) { |
| 6072 |
// ::after generated content for content earlier in the doc and not |
| 6073 |
// for an ancestor. "p != aContainer" may seem redundant but it |
| 6074 |
// checks if the ::after belongs to the XBL insertion point we're |
| 6075 |
// inserting aChild into (in which case ContentIsDescendantOf is |
| 6076 |
// false even though p == aContainer). |
| 6077 |
// See layout/reftests/bugs/482592-1a.xhtml for an example of that. |
| 6078 |
done = true; |
| 6079 |
break; |
| 6080 |
} |
| 6081 |
} else if (nsContentUtils::PositionIsBefore(p, aChild)) { |
| 6082 |
// Non-::after generated content for content earlier in the doc. |
| 6083 |
done = true; |
| 6084 |
break; |
| 6085 |
} |
| 6086 |
} else if (nsContentUtils::PositionIsBefore(c, aChild)) { |
| 6087 |
// Content is before aChild. |
| 6088 |
done = true; |
| 6089 |
break; |
| 6090 |
} |
| 6091 |
afterFrame = child; |
| 6092 |
} |
| 6093 |
|
| 6094 |
parent = static_cast<nsContainerFrame*>(parent->GetPrevContinuation()); |
| 6095 |
} |
| 5952 |
if (afterFrame) { |
6096 |
if (afterFrame) { |
| 5953 |
*aAfterFrame = afterFrame; |
6097 |
*aAfterFrame = afterFrame; |
| 5954 |
return afterFrame->GetParent(); |
6098 |
return afterFrame->GetParent(); |
| 5955 |
} |
6099 |
} |
| 5956 |
} |
6100 |
} |
| 5957 |
|
6101 |
|
| 5958 |
*aAfterFrame = nullptr; |
6102 |
*aAfterFrame = nullptr; |
| 5959 |
|
6103 |
|
|
Lines 6138-6162
nsCSSFrameConstructor::IsValidSibling(ns
|
Link Here
|
|---|
|
| 6138 |
(NS_STYLE_DISPLAY_TABLE_COLUMN == siblingDisplay) || |
6282 |
(NS_STYLE_DISPLAY_TABLE_COLUMN == siblingDisplay) || |
| 6139 |
(NS_STYLE_DISPLAY_TABLE_CAPTION == siblingDisplay) || |
6283 |
(NS_STYLE_DISPLAY_TABLE_CAPTION == siblingDisplay) || |
| 6140 |
(NS_STYLE_DISPLAY_TABLE_HEADER_GROUP == siblingDisplay) || |
6284 |
(NS_STYLE_DISPLAY_TABLE_HEADER_GROUP == siblingDisplay) || |
| 6141 |
(NS_STYLE_DISPLAY_TABLE_ROW_GROUP == siblingDisplay) || |
6285 |
(NS_STYLE_DISPLAY_TABLE_ROW_GROUP == siblingDisplay) || |
| 6142 |
(NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP == siblingDisplay) || |
6286 |
(NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP == siblingDisplay) || |
| 6143 |
nsGkAtoms::menuFrame == parentType) { |
6287 |
nsGkAtoms::menuFrame == parentType) { |
| 6144 |
// if we haven't already, construct a style context to find the display type of aContent |
6288 |
// if we haven't already, construct a style context to find the display type of aContent |
| 6145 |
if (UNSET_DISPLAY == aDisplay) { |
6289 |
if (UNSET_DISPLAY == aDisplay) { |
| 6146 |
nsRefPtr<nsStyleContext> styleContext; |
6290 |
nsIFrame* styleParent; |
| 6147 |
nsIFrame* styleParent = aSibling->GetParentStyleContextFrame(); |
6291 |
aSibling->GetParentStyleContext(&styleParent); |
|
|
6292 |
if (!styleParent) { |
| 6293 |
styleParent = aSibling->GetParent(); |
| 6294 |
} |
| 6148 |
if (!styleParent) { |
6295 |
if (!styleParent) { |
| 6149 |
NS_NOTREACHED("Shouldn't happen"); |
6296 |
NS_NOTREACHED("Shouldn't happen"); |
| 6150 |
return false; |
6297 |
return false; |
| 6151 |
} |
6298 |
} |
| 6152 |
// XXXbz when this code is killed, the state argument to |
6299 |
// XXXbz when this code is killed, the state argument to |
| 6153 |
// ResolveStyleContext can be made non-optional. |
6300 |
// ResolveStyleContext can be made non-optional. |
| 6154 |
styleContext = ResolveStyleContext(styleParent, aContent, nullptr); |
6301 |
nsRefPtr<nsStyleContext> styleContext = |
|
|
6302 |
ResolveStyleContext(styleParent, aContent, nullptr); |
| 6155 |
const nsStyleDisplay* display = styleContext->StyleDisplay(); |
6303 |
const nsStyleDisplay* display = styleContext->StyleDisplay(); |
| 6156 |
aDisplay = display->mDisplay; |
6304 |
aDisplay = display->mDisplay; |
| 6157 |
} |
6305 |
} |
| 6158 |
if (nsGkAtoms::menuFrame == parentType) { |
6306 |
if (nsGkAtoms::menuFrame == parentType) { |
| 6159 |
return |
6307 |
return |
| 6160 |
(NS_STYLE_DISPLAY_POPUP == aDisplay) == |
6308 |
(NS_STYLE_DISPLAY_POPUP == aDisplay) == |
| 6161 |
(NS_STYLE_DISPLAY_POPUP == siblingDisplay); |
6309 |
(NS_STYLE_DISPLAY_POPUP == siblingDisplay); |
| 6162 |
} |
6310 |
} |
|
Lines 6206-6225
nsCSSFrameConstructor::IsValidSibling(ns
|
Link Here
|
|---|
|
| 6206 |
|
6354 |
|
| 6207 |
return true; |
6355 |
return true; |
| 6208 |
} |
6356 |
} |
| 6209 |
|
6357 |
|
| 6210 |
nsIFrame* |
6358 |
nsIFrame* |
| 6211 |
nsCSSFrameConstructor::FindFrameForContentSibling(nsIContent* aContent, |
6359 |
nsCSSFrameConstructor::FindFrameForContentSibling(nsIContent* aContent, |
| 6212 |
nsIContent* aTargetContent, |
6360 |
nsIContent* aTargetContent, |
| 6213 |
uint8_t& aTargetContentDisplay, |
6361 |
uint8_t& aTargetContentDisplay, |
|
|
6362 |
nsContainerFrame* aParentFrame, |
| 6214 |
bool aPrevSibling) |
6363 |
bool aPrevSibling) |
| 6215 |
{ |
6364 |
{ |
| 6216 |
nsIFrame* sibling = aContent->GetPrimaryFrame(); |
6365 |
nsIFrame* sibling = aContent->GetPrimaryFrame(); |
| 6217 |
if (!sibling || sibling->GetContent() != aContent) { |
6366 |
if (!sibling && GetDisplayContentsStyleFor(aContent)) { |
|
|
6367 |
// A display:contents node - check if it has a ::before / ::after frame... |
| 6368 |
sibling = aPrevSibling ? |
| 6369 |
nsLayoutUtils::GetAfterFrameForContent(aParentFrame, aContent) : |
| 6370 |
nsLayoutUtils::GetBeforeFrameForContent(aParentFrame, aContent); |
| 6371 |
if (!sibling) { |
| 6372 |
// ... then recurse into children ... |
| 6373 |
const bool forward = !aPrevSibling; |
| 6374 |
FlattenedChildIterator iter(aContent, forward); |
| 6375 |
sibling = aPrevSibling ? |
| 6376 |
FindPreviousSibling(iter, aTargetContent, aTargetContentDisplay, aParentFrame) : |
| 6377 |
FindNextSibling(iter, aTargetContent, aTargetContentDisplay, aParentFrame); |
| 6378 |
} |
| 6379 |
if (!sibling) { |
| 6380 |
// ... then ::after / ::before on the opposite end. |
| 6381 |
sibling = aPrevSibling ? |
| 6382 |
nsLayoutUtils::GetBeforeFrameForContent(aParentFrame, aContent) : |
| 6383 |
nsLayoutUtils::GetAfterFrameForContent(aParentFrame, aContent); |
| 6384 |
} |
| 6385 |
if (!sibling) { |
| 6386 |
return nullptr; |
| 6387 |
} |
| 6388 |
} else if (!sibling || sibling->GetContent() != aContent) { |
| 6218 |
// XXX the GetContent() != aContent check is needed due to bug 135040. |
6389 |
// XXX the GetContent() != aContent check is needed due to bug 135040. |
| 6219 |
// Remove it once that's fixed. |
6390 |
// Remove it once that's fixed. |
| 6220 |
return nullptr; |
6391 |
return nullptr; |
| 6221 |
} |
6392 |
} |
| 6222 |
|
6393 |
|
| 6223 |
// If the frame is out-of-flow, GetPrimaryFrame() will have returned the |
6394 |
// If the frame is out-of-flow, GetPrimaryFrame() will have returned the |
| 6224 |
// out-of-flow frame; we want the placeholder. |
6395 |
// out-of-flow frame; we want the placeholder. |
| 6225 |
if (sibling->GetStateBits() & NS_FRAME_OUT_OF_FLOW) { |
6396 |
if (sibling->GetStateBits() & NS_FRAME_OUT_OF_FLOW) { |
|
Lines 6248-6291
nsCSSFrameConstructor::FindFrameForConte
|
Link Here
|
|---|
|
| 6248 |
sibling = nullptr; |
6419 |
sibling = nullptr; |
| 6249 |
} |
6420 |
} |
| 6250 |
|
6421 |
|
| 6251 |
return sibling; |
6422 |
return sibling; |
| 6252 |
} |
6423 |
} |
| 6253 |
|
6424 |
|
| 6254 |
nsIFrame* |
6425 |
nsIFrame* |
| 6255 |
nsCSSFrameConstructor::FindPreviousSibling(FlattenedChildIterator aIter, |
6426 |
nsCSSFrameConstructor::FindPreviousSibling(FlattenedChildIterator aIter, |
| 6256 |
uint8_t& aTargetContentDisplay) |
6427 |
nsIContent* aTargetContent, |
| 6257 |
{ |
6428 |
uint8_t& aTargetContentDisplay, |
| 6258 |
nsIContent* child = aIter.Get(); |
6429 |
nsContainerFrame* aParentFrame) |
| 6259 |
|
6430 |
{ |
| 6260 |
// Note: not all content objects are associated with a frame (e.g., if it's |
6431 |
// Note: not all content objects are associated with a frame (e.g., if it's |
| 6261 |
// `display: none') so keep looking until we find a previous frame |
6432 |
// `display: none') so keep looking until we find a previous frame. |
| 6262 |
while (nsIContent* sibling = aIter.GetPreviousChild()) { |
6433 |
while (nsIContent* sibling = aIter.GetPreviousChild()) { |
|
|
6434 |
MOZ_ASSERT(sibling != aTargetContent); |
| 6263 |
nsIFrame* prevSibling = |
6435 |
nsIFrame* prevSibling = |
| 6264 |
FindFrameForContentSibling(sibling, child, aTargetContentDisplay, true); |
6436 |
FindFrameForContentSibling(sibling, aTargetContent, aTargetContentDisplay, |
| 6265 |
|
6437 |
aParentFrame, true); |
| 6266 |
if (prevSibling) { |
6438 |
if (prevSibling) { |
| 6267 |
// Found a previous sibling, we're done! |
6439 |
// Found a previous sibling, we're done! |
| 6268 |
return prevSibling; |
6440 |
return prevSibling; |
| 6269 |
} |
6441 |
} |
| 6270 |
} |
6442 |
} |
| 6271 |
|
6443 |
|
| 6272 |
return nullptr; |
6444 |
return nullptr; |
| 6273 |
} |
6445 |
} |
| 6274 |
|
6446 |
|
| 6275 |
nsIFrame* |
6447 |
nsIFrame* |
| 6276 |
nsCSSFrameConstructor::FindNextSibling(FlattenedChildIterator aIter, |
6448 |
nsCSSFrameConstructor::FindNextSibling(FlattenedChildIterator aIter, |
| 6277 |
uint8_t& aTargetContentDisplay) |
6449 |
nsIContent* aTargetContent, |
| 6278 |
{ |
6450 |
uint8_t& aTargetContentDisplay, |
| 6279 |
nsIContent* child = aIter.Get(); |
6451 |
nsContainerFrame* aParentFrame) |
| 6280 |
|
6452 |
{ |
| 6281 |
while (nsIContent* sibling = aIter.GetNextChild()) { |
6453 |
while (nsIContent* sibling = aIter.GetNextChild()) { |
|
|
6454 |
MOZ_ASSERT(sibling != aTargetContent); |
| 6282 |
nsIFrame* nextSibling = |
6455 |
nsIFrame* nextSibling = |
| 6283 |
FindFrameForContentSibling(sibling, child, aTargetContentDisplay, false); |
6456 |
FindFrameForContentSibling(sibling, aTargetContent, aTargetContentDisplay, |
|
|
6457 |
aParentFrame, false); |
| 6284 |
|
6458 |
|
| 6285 |
if (nextSibling) { |
6459 |
if (nextSibling) { |
| 6286 |
// We found a next sibling, we're done! |
6460 |
// We found a next sibling, we're done! |
| 6287 |
return nextSibling; |
6461 |
return nextSibling; |
| 6288 |
} |
6462 |
} |
| 6289 |
} |
6463 |
} |
| 6290 |
|
6464 |
|
| 6291 |
return nullptr; |
6465 |
return nullptr; |
|
Lines 6308-6343
GetAdjustedParentFrame(nsContainerFrame*
|
Link Here
|
|---|
|
| 6308 |
if (!aChildContent->IsHTML(nsGkAtoms::legend)) { |
6482 |
if (!aChildContent->IsHTML(nsGkAtoms::legend)) { |
| 6309 |
newParent = GetFieldSetBlockFrame(aParentFrame); |
6483 |
newParent = GetFieldSetBlockFrame(aParentFrame); |
| 6310 |
} |
6484 |
} |
| 6311 |
} |
6485 |
} |
| 6312 |
return newParent ? newParent : aParentFrame; |
6486 |
return newParent ? newParent : aParentFrame; |
| 6313 |
} |
6487 |
} |
| 6314 |
|
6488 |
|
| 6315 |
nsIFrame* |
6489 |
nsIFrame* |
| 6316 |
nsCSSFrameConstructor::GetInsertionPrevSibling(nsContainerFrame*& aParentFrame, |
6490 |
nsCSSFrameConstructor::GetInsertionPrevSibling(InsertionPoint* aInsertion, |
| 6317 |
nsIContent* aContainer, |
|
|
| 6318 |
nsIContent* aChild, |
6491 |
nsIContent* aChild, |
| 6319 |
bool* aIsAppend, |
6492 |
bool* aIsAppend, |
| 6320 |
bool* aIsRangeInsertSafe, |
6493 |
bool* aIsRangeInsertSafe, |
| 6321 |
nsIContent* aStartSkipChild, |
6494 |
nsIContent* aStartSkipChild, |
| 6322 |
nsIContent* aEndSkipChild) |
6495 |
nsIContent* aEndSkipChild) |
| 6323 |
{ |
6496 |
{ |
|
|
6497 |
NS_PRECONDITION(aInsertion->mParentFrame, "Must have parent frame to start with"); |
| 6498 |
|
| 6324 |
*aIsAppend = false; |
6499 |
*aIsAppend = false; |
| 6325 |
|
6500 |
|
| 6326 |
// Find the frame that precedes the insertion point. Walk backwards |
6501 |
// Find the frame that precedes the insertion point. Walk backwards |
| 6327 |
// from the parent frame to get the parent content, because if an |
6502 |
// from the parent frame to get the parent content, because if an |
| 6328 |
// XBL insertion point is involved, we'll need to use _that_ to find |
6503 |
// XBL insertion point is involved, we'll need to use _that_ to find |
| 6329 |
// the preceding frame. |
6504 |
// the preceding frame. |
| 6330 |
|
6505 |
FlattenedChildIterator iter(aInsertion->mContainer); |
| 6331 |
NS_PRECONDITION(aParentFrame, "Must have parent frame to start with"); |
6506 |
bool xblCase = iter.XBLInvolved() || |
| 6332 |
nsIContent* container = aParentFrame->GetContent(); |
6507 |
aInsertion->mParentFrame->GetContent() != aInsertion->mContainer; |
| 6333 |
|
|
|
| 6334 |
FlattenedChildIterator iter(container); |
| 6335 |
bool xblCase = iter.XBLInvolved() || container != aContainer; |
| 6336 |
if (xblCase || !aChild->IsRootOfAnonymousSubtree()) { |
6508 |
if (xblCase || !aChild->IsRootOfAnonymousSubtree()) { |
| 6337 |
// The check for IsRootOfAnonymousSubtree() is because editor is |
6509 |
// The check for IsRootOfAnonymousSubtree() is because editor is |
| 6338 |
// severely broken and calls us directly for native anonymous |
6510 |
// severely broken and calls us directly for native anonymous |
| 6339 |
// nodes that it creates. |
6511 |
// nodes that it creates. |
| 6340 |
if (aStartSkipChild) { |
6512 |
if (aStartSkipChild) { |
| 6341 |
iter.Seek(aStartSkipChild); |
6513 |
iter.Seek(aStartSkipChild); |
| 6342 |
} else { |
6514 |
} else { |
| 6343 |
iter.Seek(aChild); |
6515 |
iter.Seek(aChild); |
|
Lines 6347-6410
nsCSSFrameConstructor::GetInsertionPrevS
|
Link Here
|
|---|
|
| 6347 |
iter.GetNextChild(); |
6519 |
iter.GetNextChild(); |
| 6348 |
NS_WARNING("Someone passed native anonymous content directly into frame " |
6520 |
NS_WARNING("Someone passed native anonymous content directly into frame " |
| 6349 |
"construction. Stop doing that!"); |
6521 |
"construction. Stop doing that!"); |
| 6350 |
} |
6522 |
} |
| 6351 |
|
6523 |
|
| 6352 |
// Note that FindPreviousSibling is passed the iterator by value, so that |
6524 |
// Note that FindPreviousSibling is passed the iterator by value, so that |
| 6353 |
// the later usage of the iterator starts from the same place. |
6525 |
// the later usage of the iterator starts from the same place. |
| 6354 |
uint8_t childDisplay = UNSET_DISPLAY; |
6526 |
uint8_t childDisplay = UNSET_DISPLAY; |
| 6355 |
nsIFrame* prevSibling = FindPreviousSibling(iter, childDisplay); |
6527 |
nsIFrame* prevSibling = |
|
|
6528 |
FindPreviousSibling(iter, iter.Get(), childDisplay, aInsertion->mParentFrame); |
| 6356 |
|
6529 |
|
| 6357 |
// Now, find the geometric parent so that we can handle |
6530 |
// Now, find the geometric parent so that we can handle |
| 6358 |
// continuations properly. Use the prev sibling if we have it; |
6531 |
// continuations properly. Use the prev sibling if we have it; |
| 6359 |
// otherwise use the next sibling. |
6532 |
// otherwise use the next sibling. |
| 6360 |
if (prevSibling) { |
6533 |
if (prevSibling) { |
| 6361 |
aParentFrame = prevSibling->GetParent()->GetContentInsertionFrame(); |
6534 |
aInsertion->mParentFrame = prevSibling->GetParent()->GetContentInsertionFrame(); |
| 6362 |
} |
6535 |
} else { |
| 6363 |
else { |
|
|
| 6364 |
// If there is no previous sibling, then find the frame that follows |
6536 |
// If there is no previous sibling, then find the frame that follows |
| 6365 |
if (aEndSkipChild) { |
6537 |
if (aEndSkipChild) { |
| 6366 |
iter.Seek(aEndSkipChild); |
6538 |
iter.Seek(aEndSkipChild); |
| 6367 |
iter.GetPreviousChild(); |
6539 |
iter.GetPreviousChild(); |
| 6368 |
} |
6540 |
} |
| 6369 |
nsIFrame* nextSibling = FindNextSibling(iter, childDisplay); |
6541 |
nsIFrame* nextSibling = |
|
|
6542 |
FindNextSibling(iter, iter.Get(), childDisplay, aInsertion->mParentFrame); |
| 6543 |
if (GetDisplayContentsStyleFor(aInsertion->mContainer)) { |
| 6544 |
if (!nextSibling) { |
| 6545 |
// Our siblings (if any) does not have a frame to guide us. |
| 6546 |
// The frame for aChild should be inserted whereever a frame for |
| 6547 |
// the container would be inserted. This is needed when inserting |
| 6548 |
// into nested display:contents nodes. |
| 6549 |
nsIContent* child = aInsertion->mContainer; |
| 6550 |
InsertionPoint fakeInsertion(aInsertion->mParentFrame, child->GetParent()); |
| 6551 |
nsIFrame* result = GetInsertionPrevSibling(&fakeInsertion, child, aIsAppend, |
| 6552 |
aIsRangeInsertSafe, nullptr, nullptr); |
| 6553 |
MOZ_ASSERT(aInsertion->mParentFrame == fakeInsertion.mParentFrame); |
| 6554 |
return result; |
| 6555 |
} |
| 6556 |
|
| 6557 |
prevSibling = nextSibling->GetPrevSibling(); |
| 6558 |
} |
| 6370 |
|
6559 |
|
| 6371 |
if (nextSibling) { |
6560 |
if (nextSibling) { |
| 6372 |
aParentFrame = nextSibling->GetParent()->GetContentInsertionFrame(); |
6561 |
aInsertion->mParentFrame = nextSibling->GetParent()->GetContentInsertionFrame(); |
| 6373 |
} |
6562 |
} else { |
| 6374 |
else { |
|
|
| 6375 |
// No previous or next sibling, so treat this like an appended frame. |
6563 |
// No previous or next sibling, so treat this like an appended frame. |
| 6376 |
*aIsAppend = true; |
6564 |
*aIsAppend = true; |
| 6377 |
if (IsFramePartOfIBSplit(aParentFrame)) { |
6565 |
if (IsFramePartOfIBSplit(aInsertion->mParentFrame)) { |
| 6378 |
// Since we're appending, we'll walk to the last anonymous frame |
6566 |
// Since we're appending, we'll walk to the last anonymous frame |
| 6379 |
// that was created for the broken inline frame. But don't walk |
6567 |
// that was created for the broken inline frame. But don't walk |
| 6380 |
// to the trailing inline if it's empty; stop at the block. |
6568 |
// to the trailing inline if it's empty; stop at the block. |
| 6381 |
aParentFrame = GetLastIBSplitSibling(aParentFrame, false); |
6569 |
aInsertion->mParentFrame = |
|
|
6570 |
GetLastIBSplitSibling(aInsertion->mParentFrame, false); |
| 6382 |
} |
6571 |
} |
| 6383 |
// Get continuation that parents the last child. This MUST be done |
6572 |
// Get continuation that parents the last child. This MUST be done |
| 6384 |
// before the AdjustAppendParentForAfterContent call. |
6573 |
// before the AdjustAppendParentForAfterContent call. |
| 6385 |
aParentFrame = nsLayoutUtils::LastContinuationWithChild(aParentFrame); |
6574 |
aInsertion->mParentFrame = |
|
|
6575 |
nsLayoutUtils::LastContinuationWithChild(aInsertion->mParentFrame); |
| 6386 |
// Deal with fieldsets |
6576 |
// Deal with fieldsets |
| 6387 |
aParentFrame = ::GetAdjustedParentFrame(aParentFrame, |
6577 |
aInsertion->mParentFrame = |
| 6388 |
aParentFrame->GetType(), |
6578 |
::GetAdjustedParentFrame(aInsertion->mParentFrame, |
| 6389 |
aChild); |
6579 |
aInsertion->mParentFrame->GetType(), |
|
|
6580 |
aChild); |
| 6390 |
nsIFrame* appendAfterFrame; |
6581 |
nsIFrame* appendAfterFrame; |
| 6391 |
aParentFrame = |
6582 |
aInsertion->mParentFrame = |
| 6392 |
::AdjustAppendParentForAfterContent(mPresShell->GetPresContext(), |
6583 |
::AdjustAppendParentForAfterContent(this, aInsertion->mContainer, |
| 6393 |
container, aParentFrame, |
6584 |
aInsertion->mParentFrame, |
| 6394 |
&appendAfterFrame); |
6585 |
aChild, &appendAfterFrame); |
| 6395 |
prevSibling = ::FindAppendPrevSibling(aParentFrame, appendAfterFrame); |
6586 |
prevSibling = ::FindAppendPrevSibling(aInsertion->mParentFrame, appendAfterFrame); |
| 6396 |
} |
6587 |
} |
| 6397 |
} |
6588 |
} |
| 6398 |
|
6589 |
|
| 6399 |
*aIsRangeInsertSafe = (childDisplay == UNSET_DISPLAY); |
6590 |
*aIsRangeInsertSafe = (childDisplay == UNSET_DISPLAY); |
| 6400 |
return prevSibling; |
6591 |
return prevSibling; |
| 6401 |
} |
6592 |
} |
| 6402 |
|
6593 |
|
|
|
6594 |
nsContainerFrame* |
| 6595 |
nsCSSFrameConstructor::GetContentInsertionFrameFor(nsIContent* aContent) |
| 6596 |
{ |
| 6597 |
// Get the primary frame associated with the content |
| 6598 |
nsIFrame* frame = aContent->GetPrimaryFrame(); |
| 6599 |
|
| 6600 |
if (!frame) { |
| 6601 |
if (GetDisplayContentsStyleFor(aContent)) { |
| 6602 |
nsIContent* parent = aContent->GetParent(); |
| 6603 |
if (parent && parent == aContent->GetContainingShadow()) { |
| 6604 |
parent = parent->GetBindingParent(); |
| 6605 |
} |
| 6606 |
frame = parent ? GetContentInsertionFrameFor(parent) : nullptr; |
| 6607 |
} |
| 6608 |
if (!frame) { |
| 6609 |
return nullptr; |
| 6610 |
} |
| 6611 |
} else { |
| 6612 |
// If the content of the frame is not the desired content then this is not |
| 6613 |
// really a frame for the desired content. |
| 6614 |
// XXX This check is needed due to bug 135040. Remove it once that's fixed. |
| 6615 |
if (frame->GetContent() != aContent) { |
| 6616 |
return nullptr; |
| 6617 |
} |
| 6618 |
} |
| 6619 |
|
| 6620 |
nsContainerFrame* insertionFrame = frame->GetContentInsertionFrame(); |
| 6621 |
|
| 6622 |
NS_ASSERTION(!insertionFrame || insertionFrame == frame || !frame->IsLeaf(), |
| 6623 |
"The insertion frame is the primary frame or the primary frame isn't a leaf"); |
| 6624 |
|
| 6625 |
return insertionFrame; |
| 6626 |
} |
| 6627 |
|
| 6403 |
static bool |
6628 |
static bool |
| 6404 |
IsSpecialFramesetChild(nsIContent* aContent) |
6629 |
IsSpecialFramesetChild(nsIContent* aContent) |
| 6405 |
{ |
6630 |
{ |
| 6406 |
// IMPORTANT: This must match the conditions in nsHTMLFramesetFrame::Init. |
6631 |
// IMPORTANT: This must match the conditions in nsHTMLFramesetFrame::Init. |
| 6407 |
return aContent->IsHTML() && |
6632 |
return aContent->IsHTML() && |
| 6408 |
(aContent->Tag() == nsGkAtoms::frameset || |
6633 |
(aContent->Tag() == nsGkAtoms::frameset || |
| 6409 |
aContent->Tag() == nsGkAtoms::frame); |
6634 |
aContent->Tag() == nsGkAtoms::frame); |
| 6410 |
} |
6635 |
} |
|
Lines 6440-6471
MaybeGetListBoxBodyFrame(nsIContent* aCo
|
Link Here
|
|---|
|
| 6440 |
} |
6665 |
} |
| 6441 |
|
6666 |
|
| 6442 |
return nullptr; |
6667 |
return nullptr; |
| 6443 |
} |
6668 |
} |
| 6444 |
#endif |
6669 |
#endif |
| 6445 |
|
6670 |
|
| 6446 |
void |
6671 |
void |
| 6447 |
nsCSSFrameConstructor::AddTextItemIfNeeded(nsFrameConstructorState& aState, |
6672 |
nsCSSFrameConstructor::AddTextItemIfNeeded(nsFrameConstructorState& aState, |
| 6448 |
nsContainerFrame* aParentFrame, |
6673 |
const InsertionPoint& aInsertion, |
| 6449 |
nsIContent* aPossibleTextContent, |
6674 |
nsIContent* aPossibleTextContent, |
| 6450 |
FrameConstructionItemList& aItems) |
6675 |
FrameConstructionItemList& aItems) |
| 6451 |
{ |
6676 |
{ |
| 6452 |
NS_PRECONDITION(aPossibleTextContent, "Must have node"); |
6677 |
NS_PRECONDITION(aPossibleTextContent, "Must have node"); |
| 6453 |
if (!aPossibleTextContent->IsNodeOfType(nsINode::eTEXT) || |
6678 |
if (!aPossibleTextContent->IsNodeOfType(nsINode::eTEXT) || |
| 6454 |
!aPossibleTextContent->HasFlag(NS_CREATE_FRAME_IF_NON_WHITESPACE)) { |
6679 |
!aPossibleTextContent->HasFlag(NS_CREATE_FRAME_IF_NON_WHITESPACE)) { |
| 6455 |
// Not text, or not suppressed due to being all-whitespace (if it |
6680 |
// Not text, or not suppressed due to being all-whitespace (if it |
| 6456 |
// were being suppressed, it would have the |
6681 |
// were being suppressed, it would have the |
| 6457 |
// NS_CREATE_FRAME_IF_NON_WHITESPACE flag) |
6682 |
// NS_CREATE_FRAME_IF_NON_WHITESPACE flag) |
| 6458 |
return; |
6683 |
return; |
| 6459 |
} |
6684 |
} |
| 6460 |
NS_ASSERTION(!aPossibleTextContent->GetPrimaryFrame(), |
6685 |
NS_ASSERTION(!aPossibleTextContent->GetPrimaryFrame(), |
| 6461 |
"Text node has a frame and NS_CREATE_FRAME_IF_NON_WHITESPACE"); |
6686 |
"Text node has a frame and NS_CREATE_FRAME_IF_NON_WHITESPACE"); |
| 6462 |
AddFrameConstructionItems(aState, aPossibleTextContent, false, |
6687 |
AddFrameConstructionItems(aState, aPossibleTextContent, false, |
| 6463 |
aParentFrame, aItems); |
6688 |
aInsertion, aItems); |
| 6464 |
} |
6689 |
} |
| 6465 |
|
6690 |
|
| 6466 |
void |
6691 |
void |
| 6467 |
nsCSSFrameConstructor::ReframeTextIfNeeded(nsIContent* aParentContent, |
6692 |
nsCSSFrameConstructor::ReframeTextIfNeeded(nsIContent* aParentContent, |
| 6468 |
nsIContent* aContent) |
6693 |
nsIContent* aContent) |
| 6469 |
{ |
6694 |
{ |
| 6470 |
if (!aContent->IsNodeOfType(nsINode::eTEXT) || |
6695 |
if (!aContent->IsNodeOfType(nsINode::eTEXT) || |
| 6471 |
!aContent->HasFlag(NS_CREATE_FRAME_IF_NON_WHITESPACE)) { |
6696 |
!aContent->HasFlag(NS_CREATE_FRAME_IF_NON_WHITESPACE)) { |
|
Lines 6532-6547
nsCSSFrameConstructor::MaybeConstructLaz
|
Link Here
|
|---|
|
| 6532 |
} |
6757 |
} |
| 6533 |
if (!noPrimaryFrame && !content->GetPrimaryFrame()) { |
6758 |
if (!noPrimaryFrame && !content->GetPrimaryFrame()) { |
| 6534 |
noPrimaryFrame = true; |
6759 |
noPrimaryFrame = true; |
| 6535 |
} |
6760 |
} |
| 6536 |
if (!needsFrameBitSet && content->HasFlag(NODE_NEEDS_FRAME)) { |
6761 |
if (!needsFrameBitSet && content->HasFlag(NODE_NEEDS_FRAME)) { |
| 6537 |
needsFrameBitSet = true; |
6762 |
needsFrameBitSet = true; |
| 6538 |
} |
6763 |
} |
| 6539 |
#endif |
6764 |
#endif |
|
|
6765 |
// XXXmats no lazy frames for display:contents descendants yet (bug 979782). |
| 6766 |
if (GetDisplayContentsStyleFor(content)) { |
| 6767 |
return false; |
| 6768 |
} |
| 6540 |
content->SetFlags(NODE_DESCENDANTS_NEED_FRAMES); |
6769 |
content->SetFlags(NODE_DESCENDANTS_NEED_FRAMES); |
| 6541 |
content = content->GetFlattenedTreeParent(); |
6770 |
content = content->GetFlattenedTreeParent(); |
| 6542 |
} |
6771 |
} |
| 6543 |
#ifdef DEBUG |
6772 |
#ifdef DEBUG |
| 6544 |
if (content && content->GetPrimaryFrame() && |
6773 |
if (content && content->GetPrimaryFrame() && |
| 6545 |
content->GetPrimaryFrame()->IsLeaf()) { |
6774 |
content->GetPrimaryFrame()->IsLeaf()) { |
| 6546 |
noPrimaryFrame = needsFrameBitSet = false; |
6775 |
noPrimaryFrame = needsFrameBitSet = false; |
| 6547 |
} |
6776 |
} |
|
|
| 6654 |
nsCSSFrameConstructor::IssueSingleInsertNofications(nsIContent* aContainer, |
6883 |
nsCSSFrameConstructor::IssueSingleInsertNofications(nsIContent* aContainer, |
| 6655 |
nsIContent* aStartChild, |
6884 |
nsIContent* aStartChild, |
| 6656 |
nsIContent* aEndChild, |
6885 |
nsIContent* aEndChild, |
| 6657 |
bool aAllowLazyConstruction) |
6886 |
bool aAllowLazyConstruction) |
| 6658 |
{ |
6887 |
{ |
| 6659 |
for (nsIContent* child = aStartChild; |
6888 |
for (nsIContent* child = aStartChild; |
| 6660 |
child != aEndChild; |
6889 |
child != aEndChild; |
| 6661 |
child = child->GetNextSibling()) { |
6890 |
child = child->GetNextSibling()) { |
| 6662 |
if ((child->GetPrimaryFrame() || |
6891 |
if ((child->GetPrimaryFrame() || GetUndisplayedContent(child) || |
| 6663 |
GetUndisplayedContent(child)) |
6892 |
GetDisplayContentsStyleFor(child)) |
| 6664 |
#ifdef MOZ_XUL |
6893 |
#ifdef MOZ_XUL |
| 6665 |
// Except listboxes suck, so do NOT skip anything here if |
6894 |
// Except listboxes suck, so do NOT skip anything here if |
| 6666 |
// we plan to notify a listbox. |
6895 |
// we plan to notify a listbox. |
| 6667 |
&& !MaybeGetListBoxBodyFrame(aContainer, child) |
6896 |
&& !MaybeGetListBoxBodyFrame(aContainer, child) |
| 6668 |
#endif |
6897 |
#endif |
| 6669 |
) { |
6898 |
) { |
| 6670 |
// Already have a frame or undisplayed entry for this content; a |
6899 |
// Already have a frame or undisplayed entry for this content; a |
| 6671 |
// previous ContentInserted in this loop must have reconstructed |
6900 |
// previous ContentInserted in this loop must have reconstructed |
|
Lines 6673-6743
nsCSSFrameConstructor::IssueSingleInsert
|
Link Here
|
|---|
|
| 6673 |
continue; |
6902 |
continue; |
| 6674 |
} |
6903 |
} |
| 6675 |
// Call ContentInserted with this node. |
6904 |
// Call ContentInserted with this node. |
| 6676 |
ContentInserted(aContainer, child, mTempFrameTreeState, |
6905 |
ContentInserted(aContainer, child, mTempFrameTreeState, |
| 6677 |
aAllowLazyConstruction); |
6906 |
aAllowLazyConstruction); |
| 6678 |
} |
6907 |
} |
| 6679 |
} |
6908 |
} |
| 6680 |
|
6909 |
|
| 6681 |
nsContainerFrame* |
6910 |
nsCSSFrameConstructor::InsertionPoint |
| 6682 |
nsCSSFrameConstructor::GetRangeInsertionPoint(nsIContent* aContainer, |
6911 |
nsCSSFrameConstructor::GetRangeInsertionPoint(nsIContent* aContainer, |
| 6683 |
nsIContent* aStartChild, |
6912 |
nsIContent* aStartChild, |
| 6684 |
nsIContent* aEndChild, |
6913 |
nsIContent* aEndChild, |
| 6685 |
bool aAllowLazyConstruction) |
6914 |
bool aAllowLazyConstruction) |
| 6686 |
{ |
6915 |
{ |
| 6687 |
// See if we have an XBL insertion point. If so, then that's our |
6916 |
// See if we have an XBL insertion point. If so, then that's our |
| 6688 |
// real parent frame; if not, then the frame hasn't been built yet |
6917 |
// real parent frame; if not, then the frame hasn't been built yet |
| 6689 |
// and we just bail. |
6918 |
// and we just bail. |
| 6690 |
bool multiple = false; |
6919 |
InsertionPoint insertionPoint = GetInsertionPoint(aContainer, nullptr); |
| 6691 |
nsContainerFrame* insertionPoint = GetInsertionPoint(aContainer, nullptr, &multiple); |
6920 |
if (!insertionPoint.mParentFrame && !insertionPoint.mMultiple) { |
| 6692 |
if (!insertionPoint && !multiple) |
6921 |
return insertionPoint; // Don't build the frames. |
| 6693 |
return nullptr; // Don't build the frames. |
6922 |
} |
| 6694 |
|
6923 |
|
| 6695 |
bool hasInsertion = false; |
6924 |
bool hasInsertion = false; |
| 6696 |
if (!multiple) { |
6925 |
if (!insertionPoint.mMultiple) { |
| 6697 |
// XXXbz XBL2/sXBL issue |
6926 |
// XXXbz XBL2/sXBL issue |
| 6698 |
nsIDocument* document = aStartChild->GetComposedDoc(); |
6927 |
nsIDocument* document = aStartChild->GetComposedDoc(); |
| 6699 |
// XXXbz how would |document| be null here? |
6928 |
// XXXbz how would |document| be null here? |
| 6700 |
if (document && aStartChild->GetXBLInsertionParent()) { |
6929 |
if (document && aStartChild->GetXBLInsertionParent()) { |
| 6701 |
hasInsertion = true; |
6930 |
hasInsertion = true; |
| 6702 |
} |
6931 |
} |
| 6703 |
} |
6932 |
} |
| 6704 |
|
6933 |
|
| 6705 |
if (multiple || hasInsertion) { |
6934 |
if (insertionPoint.mMultiple || hasInsertion) { |
| 6706 |
// We have an insertion point. There are some additional tests we need to do |
6935 |
// We have an insertion point. There are some additional tests we need to do |
| 6707 |
// in order to ensure that an append is a safe operation. |
6936 |
// in order to ensure that an append is a safe operation. |
| 6708 |
uint32_t childCount = 0; |
6937 |
uint32_t childCount = 0; |
| 6709 |
|
6938 |
|
| 6710 |
if (!multiple) { |
6939 |
if (!insertionPoint.mMultiple) { |
| 6711 |
// We may need to make multiple ContentInserted calls instead. A |
6940 |
// We may need to make multiple ContentInserted calls instead. A |
| 6712 |
// reasonable heuristic to employ (in order to maintain good performance) |
6941 |
// reasonable heuristic to employ (in order to maintain good performance) |
| 6713 |
// is to find out if the insertion point's content node contains any |
6942 |
// is to find out if the insertion point's content node contains any |
| 6714 |
// explicit children. If it does not, then it is highly likely that |
6943 |
// explicit children. If it does not, then it is highly likely that |
| 6715 |
// an append is occurring. (Note it is not definite, and there are insane |
6944 |
// an append is occurring. (Note it is not definite, and there are insane |
| 6716 |
// cases we will not deal with by employing this heuristic, but it beats |
6945 |
// cases we will not deal with by employing this heuristic, but it beats |
| 6717 |
// always falling back to multiple ContentInserted calls). |
6946 |
// always falling back to multiple ContentInserted calls). |
| 6718 |
// |
6947 |
// |
| 6719 |
// In the multiple insertion point case, we know we're going to need to do |
6948 |
// In the multiple insertion point case, we know we're going to need to do |
| 6720 |
// multiple ContentInserted calls anyway. |
6949 |
// multiple ContentInserted calls anyway. |
| 6721 |
// XXXndeakin This test doesn't work in the new world. Or rather, it works, but |
6950 |
// XXXndeakin This test doesn't work in the new world. Or rather, it works, but |
| 6722 |
// it's slow |
6951 |
// it's slow |
| 6723 |
childCount = insertionPoint->GetContent()->GetChildCount(); |
6952 |
childCount = insertionPoint.mParentFrame->GetContent()->GetChildCount(); |
| 6724 |
} |
6953 |
} |
| 6725 |
|
6954 |
|
| 6726 |
// If we have multiple insertion points or if we have an insertion point |
6955 |
// If we have multiple insertion points or if we have an insertion point |
| 6727 |
// and the operation is not a true append or if the insertion point already |
6956 |
// and the operation is not a true append or if the insertion point already |
| 6728 |
// has explicit children, then we must fall back. |
6957 |
// has explicit children, then we must fall back. |
| 6729 |
if (multiple || aEndChild != nullptr || childCount > 0) { |
6958 |
if (insertionPoint.mMultiple || aEndChild != nullptr || childCount > 0) { |
| 6730 |
// Now comes the fun part. For each inserted child, make a |
6959 |
// Now comes the fun part. For each inserted child, make a |
| 6731 |
// ContentInserted call as if it had just gotten inserted and |
6960 |
// ContentInserted call as if it had just gotten inserted and |
| 6732 |
// let ContentInserted handle the mess. |
6961 |
// let ContentInserted handle the mess. |
| 6733 |
IssueSingleInsertNofications(aContainer, aStartChild, aEndChild, |
6962 |
IssueSingleInsertNofications(aContainer, aStartChild, aEndChild, |
| 6734 |
aAllowLazyConstruction); |
6963 |
aAllowLazyConstruction); |
| 6735 |
return nullptr; |
6964 |
insertionPoint.mParentFrame = nullptr; |
| 6736 |
} |
6965 |
} |
| 6737 |
} |
6966 |
} |
| 6738 |
|
6967 |
|
| 6739 |
return insertionPoint; |
6968 |
return insertionPoint; |
| 6740 |
} |
6969 |
} |
| 6741 |
|
6970 |
|
| 6742 |
bool |
6971 |
bool |
| 6743 |
nsCSSFrameConstructor::MaybeRecreateForFrameset(nsIFrame* aParentFrame, |
6972 |
nsCSSFrameConstructor::MaybeRecreateForFrameset(nsIFrame* aParentFrame, |
|
Lines 6818-6850
nsCSSFrameConstructor::ContentAppended(n
|
Link Here
|
|---|
|
| 6818 |
nsIContent* bindingParent = aContainer->GetBindingParent(); |
7047 |
nsIContent* bindingParent = aContainer->GetBindingParent(); |
| 6819 |
LAYOUT_PHASE_TEMP_EXIT(); |
7048 |
LAYOUT_PHASE_TEMP_EXIT(); |
| 6820 |
nsresult rv = RecreateFramesForContent(bindingParent, false, |
7049 |
nsresult rv = RecreateFramesForContent(bindingParent, false, |
| 6821 |
REMOVE_FOR_RECONSTRUCTION, nullptr); |
7050 |
REMOVE_FOR_RECONSTRUCTION, nullptr); |
| 6822 |
LAYOUT_PHASE_TEMP_REENTER(); |
7051 |
LAYOUT_PHASE_TEMP_REENTER(); |
| 6823 |
return rv; |
7052 |
return rv; |
| 6824 |
} |
7053 |
} |
| 6825 |
|
7054 |
|
| 6826 |
// Get the frame associated with the content |
|
|
| 6827 |
nsContainerFrame* parentFrame = ::GetContentInsertionFrameFor(aContainer); |
| 6828 |
|
| 6829 |
// See comment in ContentRangeInserted for why this is necessary. |
7055 |
// See comment in ContentRangeInserted for why this is necessary. |
| 6830 |
if (!parentFrame && !aContainer->IsActiveChildrenElement()) { |
7056 |
if (!GetContentInsertionFrameFor(aContainer) && |
|
|
7057 |
!aContainer->IsActiveChildrenElement()) { |
| 6831 |
return NS_OK; |
7058 |
return NS_OK; |
| 6832 |
} |
7059 |
} |
| 6833 |
|
7060 |
|
| 6834 |
if (aAllowLazyConstruction && |
7061 |
if (aAllowLazyConstruction && |
| 6835 |
MaybeConstructLazily(CONTENTAPPEND, aContainer, aFirstNewContent)) { |
7062 |
MaybeConstructLazily(CONTENTAPPEND, aContainer, aFirstNewContent)) { |
| 6836 |
return NS_OK; |
7063 |
return NS_OK; |
| 6837 |
} |
7064 |
} |
| 6838 |
|
7065 |
|
| 6839 |
LAYOUT_PHASE_TEMP_EXIT(); |
7066 |
LAYOUT_PHASE_TEMP_EXIT(); |
| 6840 |
parentFrame = GetRangeInsertionPoint(aContainer, |
7067 |
InsertionPoint insertion = |
| 6841 |
aFirstNewContent, nullptr, |
7068 |
GetRangeInsertionPoint(aContainer, aFirstNewContent, nullptr, |
| 6842 |
aAllowLazyConstruction); |
7069 |
aAllowLazyConstruction); |
|
|
7070 |
nsContainerFrame*& parentFrame = insertion.mParentFrame; |
| 6843 |
LAYOUT_PHASE_TEMP_REENTER(); |
7071 |
LAYOUT_PHASE_TEMP_REENTER(); |
| 6844 |
if (!parentFrame) { |
7072 |
if (!parentFrame) { |
| 6845 |
return NS_OK; |
7073 |
return NS_OK; |
| 6846 |
} |
7074 |
} |
| 6847 |
|
7075 |
|
| 6848 |
LAYOUT_PHASE_TEMP_EXIT(); |
7076 |
LAYOUT_PHASE_TEMP_EXIT(); |
| 6849 |
if (MaybeRecreateForFrameset(parentFrame, aFirstNewContent, nullptr)) { |
7077 |
if (MaybeRecreateForFrameset(parentFrame, aFirstNewContent, nullptr)) { |
| 6850 |
LAYOUT_PHASE_TEMP_REENTER(); |
7078 |
LAYOUT_PHASE_TEMP_REENTER(); |
|
Lines 6893-6911
nsCSSFrameConstructor::ContentAppended(n
|
Link Here
|
|---|
|
| 6893 |
// We should never get here with fieldsets, since they have multiple |
7121 |
// We should never get here with fieldsets, since they have multiple |
| 6894 |
// insertion points. |
7122 |
// insertion points. |
| 6895 |
NS_ASSERTION(parentFrame->GetType() != nsGkAtoms::fieldSetFrame, |
7123 |
NS_ASSERTION(parentFrame->GetType() != nsGkAtoms::fieldSetFrame, |
| 6896 |
"Unexpected parent"); |
7124 |
"Unexpected parent"); |
| 6897 |
|
7125 |
|
| 6898 |
// Deal with possible :after generated content on the parent |
7126 |
// Deal with possible :after generated content on the parent |
| 6899 |
nsIFrame* parentAfterFrame; |
7127 |
nsIFrame* parentAfterFrame; |
| 6900 |
parentFrame = |
7128 |
parentFrame = |
| 6901 |
::AdjustAppendParentForAfterContent(mPresShell->GetPresContext(), |
7129 |
::AdjustAppendParentForAfterContent(this, insertion.mContainer, parentFrame, |
| 6902 |
aContainer, parentFrame, |
7130 |
aFirstNewContent, &parentAfterFrame); |
| 6903 |
&parentAfterFrame); |
|
|
| 6904 |
|
7131 |
|
| 6905 |
// Create some new frames |
7132 |
// Create some new frames |
| 6906 |
nsFrameConstructorState state(mPresShell, |
7133 |
nsFrameConstructorState state(mPresShell, |
| 6907 |
GetAbsoluteContainingBlock(parentFrame, FIXED_POS), |
7134 |
GetAbsoluteContainingBlock(parentFrame, FIXED_POS), |
| 6908 |
GetAbsoluteContainingBlock(parentFrame, ABS_POS), |
7135 |
GetAbsoluteContainingBlock(parentFrame, ABS_POS), |
| 6909 |
GetFloatContainingBlock(parentFrame)); |
7136 |
GetFloatContainingBlock(parentFrame)); |
| 6910 |
state.mTreeMatchContext.InitAncestors(aContainer->AsElement()); |
7137 |
state.mTreeMatchContext.InitAncestors(aContainer->AsElement()); |
| 6911 |
|
7138 |
|
|
Lines 6939-6961
nsCSSFrameConstructor::ContentAppended(n
|
Link Here
|
|---|
|
| 6939 |
// one. No need to do all this if our parent type is not block, though, |
7166 |
// one. No need to do all this if our parent type is not block, though, |
| 6940 |
// since WipeContainingBlock already handles that situation. |
7167 |
// since WipeContainingBlock already handles that situation. |
| 6941 |
// |
7168 |
// |
| 6942 |
// Because we're appending, we don't need to worry about any text |
7169 |
// Because we're appending, we don't need to worry about any text |
| 6943 |
// after the appended content; there can only be XBL anonymous content |
7170 |
// after the appended content; there can only be XBL anonymous content |
| 6944 |
// (text in an XBL binding is not suppressed) or generated content |
7171 |
// (text in an XBL binding is not suppressed) or generated content |
| 6945 |
// (and bare text nodes are not generated). Native anonymous content |
7172 |
// (and bare text nodes are not generated). Native anonymous content |
| 6946 |
// generated by frames never participates in inline layout. |
7173 |
// generated by frames never participates in inline layout. |
| 6947 |
AddTextItemIfNeeded(state, parentFrame, |
7174 |
AddTextItemIfNeeded(state, insertion, |
| 6948 |
aFirstNewContent->GetPreviousSibling(), items); |
7175 |
aFirstNewContent->GetPreviousSibling(), items); |
| 6949 |
} |
7176 |
} |
| 6950 |
for (nsIContent* child = aFirstNewContent; |
7177 |
for (nsIContent* child = aFirstNewContent; |
| 6951 |
child; |
7178 |
child; |
| 6952 |
child = child->GetNextSibling()) { |
7179 |
child = child->GetNextSibling()) { |
| 6953 |
AddFrameConstructionItems(state, child, false, parentFrame, items); |
7180 |
AddFrameConstructionItems(state, child, false, insertion, items); |
| 6954 |
} |
7181 |
} |
| 6955 |
|
7182 |
|
| 6956 |
nsIFrame* prevSibling = ::FindAppendPrevSibling(parentFrame, parentAfterFrame); |
7183 |
nsIFrame* prevSibling = ::FindAppendPrevSibling(parentFrame, parentAfterFrame); |
| 6957 |
|
7184 |
|
| 6958 |
// Perform special check for diddling around with the frames in |
7185 |
// Perform special check for diddling around with the frames in |
| 6959 |
// a ib-split inline frame. |
7186 |
// a ib-split inline frame. |
| 6960 |
// If we're appending before :after content, then we're not really |
7187 |
// If we're appending before :after content, then we're not really |
| 6961 |
// appending, so let WipeContainingBlock know that. |
7188 |
// appending, so let WipeContainingBlock know that. |
|
Lines 7258-7370
nsCSSFrameConstructor::ContentRangeInser
|
Link Here
|
|---|
|
| 7258 |
nsIContent* bindingParent = aContainer->GetBindingParent(); |
7485 |
nsIContent* bindingParent = aContainer->GetBindingParent(); |
| 7259 |
LAYOUT_PHASE_TEMP_EXIT(); |
7486 |
LAYOUT_PHASE_TEMP_EXIT(); |
| 7260 |
nsresult rv = RecreateFramesForContent(bindingParent, false, |
7487 |
nsresult rv = RecreateFramesForContent(bindingParent, false, |
| 7261 |
REMOVE_FOR_RECONSTRUCTION, nullptr); |
7488 |
REMOVE_FOR_RECONSTRUCTION, nullptr); |
| 7262 |
LAYOUT_PHASE_TEMP_REENTER(); |
7489 |
LAYOUT_PHASE_TEMP_REENTER(); |
| 7263 |
return rv; |
7490 |
return rv; |
| 7264 |
} |
7491 |
} |
| 7265 |
|
7492 |
|
| 7266 |
nsContainerFrame* parentFrame = ::GetContentInsertionFrameFor(aContainer); |
7493 |
// Put 'parentFrame' inside a scope so we don't confuse it with |
| 7267 |
// The xbl:children element won't have a frame, but default content can have the children as |
7494 |
// 'insertion.mParentFrame' later. |
| 7268 |
// a parent. While its uncommon to change the structure of the default content itself, a label, |
7495 |
{ |
| 7269 |
// for example, can be reframed by having its value attribute set or removed. |
7496 |
nsContainerFrame* parentFrame = GetContentInsertionFrameFor(aContainer); |
| 7270 |
if (!parentFrame && !aContainer->IsActiveChildrenElement()) { |
7497 |
// The xbl:children element won't have a frame, but default content can have the children as |
| 7271 |
return NS_OK; |
7498 |
// a parent. While its uncommon to change the structure of the default content itself, a label, |
| 7272 |
} |
7499 |
// for example, can be reframed by having its value attribute set or removed. |
| 7273 |
|
7500 |
if (!parentFrame && !aContainer->IsActiveChildrenElement()) { |
| 7274 |
// Otherwise, we've got parent content. Find its frame. |
7501 |
return NS_OK; |
| 7275 |
NS_ASSERTION(!parentFrame || parentFrame->GetContent() == aContainer, "New XBL code is possibly wrong!"); |
7502 |
} |
| 7276 |
|
7503 |
|
| 7277 |
if (aAllowLazyConstruction && |
7504 |
// Otherwise, we've got parent content. Find its frame. |
| 7278 |
MaybeConstructLazily(CONTENTINSERT, aContainer, aStartChild)) { |
7505 |
NS_ASSERTION(!parentFrame || parentFrame->GetContent() == aContainer || |
| 7279 |
return NS_OK; |
7506 |
GetDisplayContentsStyleFor(aContainer), "New XBL code is possibly wrong!"); |
| 7280 |
} |
7507 |
|
| 7281 |
|
7508 |
if (aAllowLazyConstruction && |
|
|
7509 |
MaybeConstructLazily(CONTENTINSERT, aContainer, aStartChild)) { |
| 7510 |
return NS_OK; |
| 7511 |
} |
| 7512 |
} |
| 7513 |
|
| 7514 |
InsertionPoint insertion; |
| 7282 |
if (isSingleInsert) { |
7515 |
if (isSingleInsert) { |
| 7283 |
// See if we have an XBL insertion point. If so, then that's our |
7516 |
// See if we have an XBL insertion point. If so, then that's our |
| 7284 |
// real parent frame; if not, then the frame hasn't been built yet |
7517 |
// real parent frame; if not, then the frame hasn't been built yet |
| 7285 |
// and we just bail. |
7518 |
// and we just bail. |
| 7286 |
parentFrame = GetInsertionPoint(aContainer, aStartChild); |
7519 |
insertion = GetInsertionPoint(aContainer, aStartChild); |
| 7287 |
} else { |
7520 |
} else { |
| 7288 |
// Get our insertion point. If we need to issue single ContentInserted's |
7521 |
// Get our insertion point. If we need to issue single ContentInserted's |
| 7289 |
// GetRangeInsertionPoint will take care of that for us. |
7522 |
// GetRangeInsertionPoint will take care of that for us. |
| 7290 |
LAYOUT_PHASE_TEMP_EXIT(); |
7523 |
LAYOUT_PHASE_TEMP_EXIT(); |
| 7291 |
parentFrame = GetRangeInsertionPoint(aContainer, aStartChild, aEndChild, |
7524 |
insertion = GetRangeInsertionPoint(aContainer, aStartChild, aEndChild, |
| 7292 |
aAllowLazyConstruction); |
7525 |
aAllowLazyConstruction); |
| 7293 |
LAYOUT_PHASE_TEMP_REENTER(); |
7526 |
LAYOUT_PHASE_TEMP_REENTER(); |
| 7294 |
} |
7527 |
} |
| 7295 |
|
7528 |
|
| 7296 |
if (!parentFrame) { |
7529 |
if (!insertion.mParentFrame) { |
| 7297 |
return NS_OK; |
7530 |
return NS_OK; |
| 7298 |
} |
7531 |
} |
| 7299 |
|
7532 |
|
| 7300 |
bool isAppend, isRangeInsertSafe; |
7533 |
bool isAppend, isRangeInsertSafe; |
| 7301 |
nsIFrame* prevSibling = |
7534 |
nsIFrame* prevSibling = GetInsertionPrevSibling(&insertion, aStartChild, |
| 7302 |
GetInsertionPrevSibling(parentFrame, aContainer, aStartChild, |
7535 |
&isAppend, &isRangeInsertSafe); |
| 7303 |
&isAppend, &isRangeInsertSafe); |
|
|
| 7304 |
|
7536 |
|
| 7305 |
// check if range insert is safe |
7537 |
// check if range insert is safe |
| 7306 |
if (!isSingleInsert && !isRangeInsertSafe) { |
7538 |
if (!isSingleInsert && !isRangeInsertSafe) { |
| 7307 |
// must fall back to a single ContertInserted for each child in the range |
7539 |
// must fall back to a single ContertInserted for each child in the range |
| 7308 |
LAYOUT_PHASE_TEMP_EXIT(); |
7540 |
LAYOUT_PHASE_TEMP_EXIT(); |
| 7309 |
IssueSingleInsertNofications(aContainer, aStartChild, aEndChild, |
7541 |
IssueSingleInsertNofications(aContainer, aStartChild, aEndChild, |
| 7310 |
aAllowLazyConstruction); |
7542 |
aAllowLazyConstruction); |
| 7311 |
LAYOUT_PHASE_TEMP_REENTER(); |
7543 |
LAYOUT_PHASE_TEMP_REENTER(); |
| 7312 |
return NS_OK; |
7544 |
return NS_OK; |
| 7313 |
} |
7545 |
} |
| 7314 |
|
7546 |
|
| 7315 |
nsIContent* container = parentFrame->GetContent(); |
7547 |
nsIContent* container = insertion.mParentFrame->GetContent(); |
| 7316 |
|
7548 |
|
| 7317 |
nsIAtom* frameType = parentFrame->GetType(); |
7549 |
nsIAtom* frameType = insertion.mParentFrame->GetType(); |
| 7318 |
LAYOUT_PHASE_TEMP_EXIT(); |
7550 |
LAYOUT_PHASE_TEMP_EXIT(); |
| 7319 |
if (MaybeRecreateForFrameset(parentFrame, aStartChild, aEndChild)) { |
7551 |
if (MaybeRecreateForFrameset(insertion.mParentFrame, aStartChild, aEndChild)) { |
| 7320 |
LAYOUT_PHASE_TEMP_REENTER(); |
7552 |
LAYOUT_PHASE_TEMP_REENTER(); |
| 7321 |
return NS_OK; |
7553 |
return NS_OK; |
| 7322 |
} |
7554 |
} |
| 7323 |
LAYOUT_PHASE_TEMP_REENTER(); |
7555 |
LAYOUT_PHASE_TEMP_REENTER(); |
| 7324 |
|
7556 |
|
| 7325 |
// We should only get here with fieldsets when doing a single insert, because |
7557 |
// We should only get here with fieldsets when doing a single insert, because |
| 7326 |
// fieldsets have multiple insertion points. |
7558 |
// fieldsets have multiple insertion points. |
| 7327 |
NS_ASSERTION(isSingleInsert || frameType != nsGkAtoms::fieldSetFrame, |
7559 |
NS_ASSERTION(isSingleInsert || frameType != nsGkAtoms::fieldSetFrame, |
| 7328 |
"Unexpected parent"); |
7560 |
"Unexpected parent"); |
| 7329 |
if (IsFrameForFieldSet(parentFrame, frameType) && |
7561 |
if (IsFrameForFieldSet(insertion.mParentFrame, frameType) && |
| 7330 |
aStartChild->Tag() == nsGkAtoms::legend) { |
7562 |
aStartChild->Tag() == nsGkAtoms::legend) { |
| 7331 |
// Just reframe the parent, since figuring out whether this |
7563 |
// Just reframe the parent, since figuring out whether this |
| 7332 |
// should be the new legend and then handling it is too complex. |
7564 |
// should be the new legend and then handling it is too complex. |
| 7333 |
// We could do a little better here --- check if the fieldset already |
7565 |
// We could do a little better here --- check if the fieldset already |
| 7334 |
// has a legend which occurs earlier in its child list than this node, |
7566 |
// has a legend which occurs earlier in its child list than this node, |
| 7335 |
// and if so, proceed. But we'd have to extend nsFieldSetFrame |
7567 |
// and if so, proceed. But we'd have to extend nsFieldSetFrame |
| 7336 |
// to locate this legend in the inserted frames and extract it. |
7568 |
// to locate this legend in the inserted frames and extract it. |
| 7337 |
LAYOUT_PHASE_TEMP_EXIT(); |
7569 |
LAYOUT_PHASE_TEMP_EXIT(); |
| 7338 |
nsresult rv = RecreateFramesForContent(parentFrame->GetContent(), false, |
7570 |
nsresult rv = RecreateFramesForContent(insertion.mParentFrame->GetContent(), false, |
| 7339 |
REMOVE_FOR_RECONSTRUCTION, nullptr); |
7571 |
REMOVE_FOR_RECONSTRUCTION, nullptr); |
| 7340 |
LAYOUT_PHASE_TEMP_REENTER(); |
7572 |
LAYOUT_PHASE_TEMP_REENTER(); |
| 7341 |
return rv; |
7573 |
return rv; |
| 7342 |
} |
7574 |
} |
| 7343 |
|
7575 |
|
| 7344 |
// Don't construct kids of leaves |
7576 |
// Don't construct kids of leaves |
| 7345 |
if (parentFrame->IsLeaf()) { |
7577 |
if (insertion.mParentFrame->IsLeaf()) { |
| 7346 |
// Clear lazy bits so we don't try to construct again. |
7578 |
// Clear lazy bits so we don't try to construct again. |
| 7347 |
ClearLazyBits(aStartChild, aEndChild); |
7579 |
ClearLazyBits(aStartChild, aEndChild); |
| 7348 |
return NS_OK; |
7580 |
return NS_OK; |
| 7349 |
} |
7581 |
} |
| 7350 |
|
7582 |
|
| 7351 |
if (parentFrame->IsFrameOfType(nsIFrame::eMathML)) { |
7583 |
if (insertion.mParentFrame->IsFrameOfType(nsIFrame::eMathML)) { |
| 7352 |
LAYOUT_PHASE_TEMP_EXIT(); |
7584 |
LAYOUT_PHASE_TEMP_EXIT(); |
| 7353 |
nsresult rv = RecreateFramesForContent(parentFrame->GetContent(), false, |
7585 |
nsresult rv = RecreateFramesForContent(insertion.mParentFrame->GetContent(), false, |
| 7354 |
REMOVE_FOR_RECONSTRUCTION, nullptr); |
7586 |
REMOVE_FOR_RECONSTRUCTION, nullptr); |
| 7355 |
LAYOUT_PHASE_TEMP_REENTER(); |
7587 |
LAYOUT_PHASE_TEMP_REENTER(); |
| 7356 |
return rv; |
7588 |
return rv; |
| 7357 |
} |
7589 |
} |
| 7358 |
|
7590 |
|
| 7359 |
nsFrameConstructorState state(mPresShell, |
7591 |
nsFrameConstructorState state(mPresShell, |
| 7360 |
GetAbsoluteContainingBlock(parentFrame, FIXED_POS), |
7592 |
GetAbsoluteContainingBlock(insertion.mParentFrame, FIXED_POS), |
| 7361 |
GetAbsoluteContainingBlock(parentFrame, ABS_POS), |
7593 |
GetAbsoluteContainingBlock(insertion.mParentFrame, ABS_POS), |
| 7362 |
GetFloatContainingBlock(parentFrame), |
7594 |
GetFloatContainingBlock(insertion.mParentFrame), |
| 7363 |
aFrameState); |
7595 |
aFrameState); |
| 7364 |
state.mTreeMatchContext.InitAncestors(aContainer ? |
7596 |
state.mTreeMatchContext.InitAncestors(aContainer ? |
| 7365 |
aContainer->AsElement() : |
7597 |
aContainer->AsElement() : |
| 7366 |
nullptr); |
7598 |
nullptr); |
| 7367 |
|
7599 |
|
| 7368 |
// Recover state for the containing block - we need to know if |
7600 |
// Recover state for the containing block - we need to know if |
| 7369 |
// it has :first-letter or :first-line style applied to it. The |
7601 |
// it has :first-letter or :first-line style applied to it. The |
| 7370 |
// reason we care is that the internal structure in these cases |
7602 |
// reason we care is that the internal structure in these cases |
|
Lines 7373-7520
nsCSSFrameConstructor::ContentRangeInser
|
Link Here
|
|---|
|
| 7373 |
nsContainerFrame* containingBlock = state.mFloatedItems.containingBlock; |
7605 |
nsContainerFrame* containingBlock = state.mFloatedItems.containingBlock; |
| 7374 |
bool haveFirstLetterStyle = false; |
7606 |
bool haveFirstLetterStyle = false; |
| 7375 |
bool haveFirstLineStyle = false; |
7607 |
bool haveFirstLineStyle = false; |
| 7376 |
|
7608 |
|
| 7377 |
// In order to shave off some cycles, we only dig up the |
7609 |
// In order to shave off some cycles, we only dig up the |
| 7378 |
// containing block haveFirst* flags if the parent frame where |
7610 |
// containing block haveFirst* flags if the parent frame where |
| 7379 |
// the insertion/append is occurring is an inline or block |
7611 |
// the insertion/append is occurring is an inline or block |
| 7380 |
// container. For other types of containers this isn't relevant. |
7612 |
// container. For other types of containers this isn't relevant. |
| 7381 |
uint8_t parentDisplay = parentFrame->GetDisplay(); |
7613 |
uint8_t parentDisplay = insertion.mParentFrame->GetDisplay(); |
| 7382 |
|
7614 |
|
| 7383 |
// Examine the parentFrame where the insertion is taking |
7615 |
// Examine the insertion.mParentFrame where the insertion is taking |
| 7384 |
// place. If it's a certain kind of container then some special |
7616 |
// place. If it's a certain kind of container then some special |
| 7385 |
// processing is done. |
7617 |
// processing is done. |
| 7386 |
if ((NS_STYLE_DISPLAY_BLOCK == parentDisplay) || |
7618 |
if ((NS_STYLE_DISPLAY_BLOCK == parentDisplay) || |
| 7387 |
(NS_STYLE_DISPLAY_LIST_ITEM == parentDisplay) || |
7619 |
(NS_STYLE_DISPLAY_LIST_ITEM == parentDisplay) || |
| 7388 |
(NS_STYLE_DISPLAY_INLINE == parentDisplay) || |
7620 |
(NS_STYLE_DISPLAY_INLINE == parentDisplay) || |
| 7389 |
(NS_STYLE_DISPLAY_INLINE_BLOCK == parentDisplay)) { |
7621 |
(NS_STYLE_DISPLAY_INLINE_BLOCK == parentDisplay)) { |
| 7390 |
// Recover the special style flags for the containing block |
7622 |
// Recover the special style flags for the containing block |
| 7391 |
if (containingBlock) { |
7623 |
if (containingBlock) { |
| 7392 |
haveFirstLetterStyle = HasFirstLetterStyle(containingBlock); |
7624 |
haveFirstLetterStyle = HasFirstLetterStyle(containingBlock); |
| 7393 |
haveFirstLineStyle = |
7625 |
haveFirstLineStyle = |
| 7394 |
ShouldHaveFirstLineStyle(containingBlock->GetContent(), |
7626 |
ShouldHaveFirstLineStyle(containingBlock->GetContent(), |
| 7395 |
containingBlock->StyleContext()); |
7627 |
containingBlock->StyleContext()); |
| 7396 |
} |
7628 |
} |
| 7397 |
|
7629 |
|
| 7398 |
if (haveFirstLetterStyle) { |
7630 |
if (haveFirstLetterStyle) { |
| 7399 |
// If our current parentFrame is a Letter frame, use its parent as our |
7631 |
// If our current insertion.mParentFrame is a Letter frame, use its parent as our |
| 7400 |
// new parent hint |
7632 |
// new parent hint |
| 7401 |
if (parentFrame->GetType() == nsGkAtoms::letterFrame) { |
7633 |
if (insertion.mParentFrame->GetType() == nsGkAtoms::letterFrame) { |
| 7402 |
// If parentFrame is out of flow, then we actually want the parent of |
7634 |
// If insertion.mParentFrame is out of flow, then we actually want the parent of |
| 7403 |
// the placeholder frame. |
7635 |
// the placeholder frame. |
| 7404 |
if (parentFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) { |
7636 |
if (insertion.mParentFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) { |
| 7405 |
nsPlaceholderFrame* placeholderFrame = |
7637 |
nsPlaceholderFrame* placeholderFrame = |
| 7406 |
GetPlaceholderFrameFor(parentFrame); |
7638 |
GetPlaceholderFrameFor(insertion.mParentFrame); |
| 7407 |
NS_ASSERTION(placeholderFrame, "No placeholder for out-of-flow?"); |
7639 |
NS_ASSERTION(placeholderFrame, "No placeholder for out-of-flow?"); |
| 7408 |
parentFrame = placeholderFrame->GetParent(); |
7640 |
insertion.mParentFrame = placeholderFrame->GetParent(); |
| 7409 |
} else { |
7641 |
} else { |
| 7410 |
parentFrame = parentFrame->GetParent(); |
7642 |
insertion.mParentFrame = insertion.mParentFrame->GetParent(); |
| 7411 |
} |
7643 |
} |
| 7412 |
} |
7644 |
} |
| 7413 |
|
7645 |
|
| 7414 |
// Remove the old letter frames before doing the insertion |
7646 |
// Remove the old letter frames before doing the insertion |
| 7415 |
RemoveLetterFrames(state.mPresContext, mPresShell, |
7647 |
RemoveLetterFrames(state.mPresContext, mPresShell, |
| 7416 |
state.mFloatedItems.containingBlock); |
7648 |
state.mFloatedItems.containingBlock); |
| 7417 |
|
7649 |
|
| 7418 |
// Removing the letterframes messes around with the frame tree, removing |
7650 |
// Removing the letterframes messes around with the frame tree, removing |
| 7419 |
// and creating frames. We need to reget our prevsibling, parent frame, |
7651 |
// and creating frames. We need to reget our prevsibling, parent frame, |
| 7420 |
// etc. |
7652 |
// etc. |
| 7421 |
prevSibling = GetInsertionPrevSibling(parentFrame, aContainer, |
7653 |
prevSibling = GetInsertionPrevSibling(&insertion, aStartChild, &isAppend, |
| 7422 |
aStartChild, &isAppend, |
|
|
| 7423 |
&isRangeInsertSafe); |
7654 |
&isRangeInsertSafe); |
| 7424 |
|
7655 |
|
| 7425 |
// Need check whether a range insert is still safe. |
7656 |
// Need check whether a range insert is still safe. |
| 7426 |
if (!isSingleInsert && !isRangeInsertSafe) { |
7657 |
if (!isSingleInsert && !isRangeInsertSafe) { |
| 7427 |
// Need to recover the letter frames first. |
7658 |
// Need to recover the letter frames first. |
| 7428 |
RecoverLetterFrames(state.mFloatedItems.containingBlock); |
7659 |
RecoverLetterFrames(state.mFloatedItems.containingBlock); |
| 7429 |
|
7660 |
|
| 7430 |
// must fall back to a single ContertInserted for each child in the range |
7661 |
// must fall back to a single ContertInserted for each child in the range |
| 7431 |
LAYOUT_PHASE_TEMP_EXIT(); |
7662 |
LAYOUT_PHASE_TEMP_EXIT(); |
| 7432 |
IssueSingleInsertNofications(aContainer, aStartChild, aEndChild, |
7663 |
IssueSingleInsertNofications(aContainer, aStartChild, aEndChild, |
| 7433 |
aAllowLazyConstruction); |
7664 |
aAllowLazyConstruction); |
| 7434 |
LAYOUT_PHASE_TEMP_REENTER(); |
7665 |
LAYOUT_PHASE_TEMP_REENTER(); |
| 7435 |
return NS_OK; |
7666 |
return NS_OK; |
| 7436 |
} |
7667 |
} |
| 7437 |
|
7668 |
|
| 7438 |
container = parentFrame->GetContent(); |
7669 |
container = insertion.mParentFrame->GetContent(); |
| 7439 |
frameType = parentFrame->GetType(); |
7670 |
frameType = insertion.mParentFrame->GetType(); |
| 7440 |
} |
7671 |
} |
| 7441 |
} |
7672 |
} |
| 7442 |
|
7673 |
|
| 7443 |
if (!prevSibling) { |
7674 |
if (!prevSibling) { |
| 7444 |
// We're inserting the new frames as the first child. See if the |
7675 |
// We're inserting the new frames as the first child. See if the |
| 7445 |
// parent has a :before pseudo-element |
7676 |
// parent has a :before pseudo-element |
| 7446 |
nsIFrame* firstChild = parentFrame->GetFirstPrincipalChild(); |
7677 |
nsIFrame* firstChild = insertion.mParentFrame->GetFirstPrincipalChild(); |
| 7447 |
|
7678 |
|
| 7448 |
if (firstChild && |
7679 |
if (firstChild && |
| 7449 |
nsLayoutUtils::IsGeneratedContentFor(container, firstChild, |
7680 |
nsLayoutUtils::IsGeneratedContentFor(container, firstChild, |
| 7450 |
nsCSSPseudoElements::before)) { |
7681 |
nsCSSPseudoElements::before)) { |
| 7451 |
// Insert the new frames after the last continuation of the :before |
7682 |
// Insert the new frames after the last continuation of the :before |
| 7452 |
prevSibling = firstChild->GetTailContinuation(); |
7683 |
prevSibling = firstChild->GetTailContinuation(); |
| 7453 |
parentFrame = prevSibling->GetParent()->GetContentInsertionFrame(); |
7684 |
insertion.mParentFrame = prevSibling->GetParent()->GetContentInsertionFrame(); |
| 7454 |
// Don't change isAppend here; we'll can call AppendFrames as needed, and |
7685 |
// Don't change isAppend here; we'll can call AppendFrames as needed, and |
| 7455 |
// the change to our prevSibling doesn't affect that. |
7686 |
// the change to our prevSibling doesn't affect that. |
| 7456 |
} |
7687 |
} |
| 7457 |
} |
7688 |
} |
| 7458 |
|
7689 |
|
| 7459 |
FrameConstructionItemList items; |
7690 |
FrameConstructionItemList items; |
| 7460 |
ParentType parentType = GetParentType(frameType); |
7691 |
ParentType parentType = GetParentType(frameType); |
| 7461 |
FlattenedChildIterator iter(aContainer); |
7692 |
FlattenedChildIterator iter(aContainer); |
| 7462 |
bool haveNoXBLChildren = (!iter.XBLInvolved() || !iter.GetNextChild()); |
7693 |
bool haveNoXBLChildren = (!iter.XBLInvolved() || !iter.GetNextChild()); |
| 7463 |
if (aStartChild->GetPreviousSibling() && |
7694 |
if (aStartChild->GetPreviousSibling() && |
| 7464 |
parentType == eTypeBlock && haveNoXBLChildren) { |
7695 |
parentType == eTypeBlock && haveNoXBLChildren) { |
| 7465 |
// If there's a text node in the normal content list just before the |
7696 |
// If there's a text node in the normal content list just before the |
| 7466 |
// new nodes, and it has no frame, make a frame construction item for |
7697 |
// new nodes, and it has no frame, make a frame construction item for |
| 7467 |
// it, because it might need a frame now. No need to do this if our |
7698 |
// it, because it might need a frame now. No need to do this if our |
| 7468 |
// parent type is not block, though, since WipeContainingBlock |
7699 |
// parent type is not block, though, since WipeContainingBlock |
| 7469 |
// already handles that sitation. |
7700 |
// already handles that sitation. |
| 7470 |
AddTextItemIfNeeded(state, parentFrame, aStartChild->GetPreviousSibling(), |
7701 |
AddTextItemIfNeeded(state, insertion, aStartChild->GetPreviousSibling(), |
| 7471 |
items); |
7702 |
items); |
| 7472 |
} |
7703 |
} |
| 7473 |
|
7704 |
|
| 7474 |
if (isSingleInsert) { |
7705 |
if (isSingleInsert) { |
| 7475 |
AddFrameConstructionItems(state, aStartChild, |
7706 |
AddFrameConstructionItems(state, aStartChild, |
| 7476 |
aStartChild->IsRootOfAnonymousSubtree(), |
7707 |
aStartChild->IsRootOfAnonymousSubtree(), |
| 7477 |
parentFrame, items); |
7708 |
insertion, items); |
| 7478 |
} else { |
7709 |
} else { |
| 7479 |
for (nsIContent* child = aStartChild; |
7710 |
for (nsIContent* child = aStartChild; |
| 7480 |
child != aEndChild; |
7711 |
child != aEndChild; |
| 7481 |
child = child->GetNextSibling()){ |
7712 |
child = child->GetNextSibling()){ |
| 7482 |
AddFrameConstructionItems(state, child, false, parentFrame, items); |
7713 |
AddFrameConstructionItems(state, child, false, insertion, items); |
| 7483 |
} |
7714 |
} |
| 7484 |
} |
7715 |
} |
| 7485 |
|
7716 |
|
| 7486 |
if (aEndChild && parentType == eTypeBlock && haveNoXBLChildren) { |
7717 |
if (aEndChild && parentType == eTypeBlock && haveNoXBLChildren) { |
| 7487 |
// If there's a text node in the normal content list just after the |
7718 |
// If there's a text node in the normal content list just after the |
| 7488 |
// new nodes, and it has no frame, make a frame construction item for |
7719 |
// new nodes, and it has no frame, make a frame construction item for |
| 7489 |
// it, because it might need a frame now. No need to do this if our |
7720 |
// it, because it might need a frame now. No need to do this if our |
| 7490 |
// parent type is not block, though, since WipeContainingBlock |
7721 |
// parent type is not block, though, since WipeContainingBlock |
| 7491 |
// already handles that sitation. |
7722 |
// already handles that sitation. |
| 7492 |
AddTextItemIfNeeded(state, parentFrame, aEndChild, items); |
7723 |
AddTextItemIfNeeded(state, insertion, aEndChild, items); |
| 7493 |
} |
7724 |
} |
| 7494 |
|
7725 |
|
| 7495 |
// Perform special check for diddling around with the frames in |
7726 |
// Perform special check for diddling around with the frames in |
| 7496 |
// a special inline frame. |
7727 |
// a special inline frame. |
| 7497 |
// If we're appending before :after content, then we're not really |
7728 |
// If we're appending before :after content, then we're not really |
| 7498 |
// appending, so let WipeContainingBlock know that. |
7729 |
// appending, so let WipeContainingBlock know that. |
| 7499 |
LAYOUT_PHASE_TEMP_EXIT(); |
7730 |
LAYOUT_PHASE_TEMP_EXIT(); |
| 7500 |
if (WipeContainingBlock(state, containingBlock, parentFrame, items, |
7731 |
if (WipeContainingBlock(state, containingBlock, insertion.mParentFrame, items, |
| 7501 |
isAppend, prevSibling)) { |
7732 |
isAppend, prevSibling)) { |
| 7502 |
LAYOUT_PHASE_TEMP_REENTER(); |
7733 |
LAYOUT_PHASE_TEMP_REENTER(); |
| 7503 |
return NS_OK; |
7734 |
return NS_OK; |
| 7504 |
} |
7735 |
} |
| 7505 |
LAYOUT_PHASE_TEMP_REENTER(); |
7736 |
LAYOUT_PHASE_TEMP_REENTER(); |
| 7506 |
|
7737 |
|
| 7507 |
// If the container is a table and a caption will be appended, it needs to be |
7738 |
// If the container is a table and a caption will be appended, it needs to be |
| 7508 |
// put in the outer table frame's additional child list. |
7739 |
// put in the outer table frame's additional child list. |
| 7509 |
// We make no attempt here to set flags to indicate whether the list |
7740 |
// We make no attempt here to set flags to indicate whether the list |
| 7510 |
// will be at the start or end of a block. It doesn't seem worthwhile. |
7741 |
// will be at the start or end of a block. It doesn't seem worthwhile. |
| 7511 |
nsFrameItems frameItems, captionItems; |
7742 |
nsFrameItems frameItems, captionItems; |
| 7512 |
ConstructFramesFromItemList(state, items, parentFrame, frameItems); |
7743 |
ConstructFramesFromItemList(state, items, insertion.mParentFrame, frameItems); |
| 7513 |
|
7744 |
|
| 7514 |
if (frameItems.NotEmpty()) { |
7745 |
if (frameItems.NotEmpty()) { |
| 7515 |
for (nsIContent* child = aStartChild; |
7746 |
for (nsIContent* child = aStartChild; |
| 7516 |
child != aEndChild; |
7747 |
child != aEndChild; |
| 7517 |
child = child->GetNextSibling()){ |
7748 |
child = child->GetNextSibling()){ |
| 7518 |
InvalidateCanvasIfNeeded(mPresShell, child); |
7749 |
InvalidateCanvasIfNeeded(mPresShell, child); |
| 7519 |
} |
7750 |
} |
| 7520 |
|
7751 |
|
|
Lines 7555-7628
nsCSSFrameConstructor::ContentRangeInser
|
Link Here
|
|---|
|
| 7555 |
frame2->GetType() == nsGkAtoms::tableFrame) || |
7786 |
frame2->GetType() == nsGkAtoms::tableFrame) || |
| 7556 |
frame1->GetType() == nsGkAtoms::fieldSetFrame || |
7787 |
frame1->GetType() == nsGkAtoms::fieldSetFrame || |
| 7557 |
(frame1->GetParent() && |
7788 |
(frame1->GetParent() && |
| 7558 |
frame1->GetParent()->GetType() == nsGkAtoms::fieldSetFrame), |
7789 |
frame1->GetParent()->GetType() == nsGkAtoms::fieldSetFrame), |
| 7559 |
"Unexpected frame types"); |
7790 |
"Unexpected frame types"); |
| 7560 |
#endif |
7791 |
#endif |
| 7561 |
isAppend = true; |
7792 |
isAppend = true; |
| 7562 |
nsIFrame* appendAfterFrame; |
7793 |
nsIFrame* appendAfterFrame; |
| 7563 |
parentFrame = |
7794 |
insertion.mParentFrame = |
| 7564 |
::AdjustAppendParentForAfterContent(mPresShell->GetPresContext(), |
7795 |
::AdjustAppendParentForAfterContent(this, container, |
| 7565 |
container, |
|
|
| 7566 |
frameItems.FirstChild()->GetParent(), |
7796 |
frameItems.FirstChild()->GetParent(), |
| 7567 |
&appendAfterFrame); |
7797 |
aStartChild, &appendAfterFrame); |
| 7568 |
prevSibling = ::FindAppendPrevSibling(parentFrame, appendAfterFrame); |
7798 |
prevSibling = ::FindAppendPrevSibling(insertion.mParentFrame, appendAfterFrame); |
| 7569 |
} |
7799 |
} |
| 7570 |
|
7800 |
|
| 7571 |
if (haveFirstLineStyle && parentFrame == containingBlock) { |
7801 |
if (haveFirstLineStyle && insertion.mParentFrame == containingBlock) { |
| 7572 |
// It's possible that the new frame goes into a first-line |
7802 |
// It's possible that the new frame goes into a first-line |
| 7573 |
// frame. Look at it and see... |
7803 |
// frame. Look at it and see... |
| 7574 |
if (isAppend) { |
7804 |
if (isAppend) { |
| 7575 |
// Use append logic when appending |
7805 |
// Use append logic when appending |
| 7576 |
AppendFirstLineFrames(state, containingBlock->GetContent(), |
7806 |
AppendFirstLineFrames(state, containingBlock->GetContent(), |
| 7577 |
containingBlock, frameItems); |
7807 |
containingBlock, frameItems); |
| 7578 |
} |
7808 |
} |
| 7579 |
else { |
7809 |
else { |
| 7580 |
// Use more complicated insert logic when inserting |
7810 |
// Use more complicated insert logic when inserting |
| 7581 |
// XXXbz this method is a no-op, so it's easy for the args being passed |
7811 |
// XXXbz this method is a no-op, so it's easy for the args being passed |
| 7582 |
// here to make no sense without anyone noticing... If it ever stops |
7812 |
// here to make no sense without anyone noticing... If it ever stops |
| 7583 |
// being a no-op, vet them carefully! |
7813 |
// being a no-op, vet them carefully! |
| 7584 |
InsertFirstLineFrames(state, container, containingBlock, &parentFrame, |
7814 |
InsertFirstLineFrames(state, container, containingBlock, &insertion.mParentFrame, |
| 7585 |
prevSibling, frameItems); |
7815 |
prevSibling, frameItems); |
| 7586 |
} |
7816 |
} |
| 7587 |
} |
7817 |
} |
| 7588 |
|
7818 |
|
| 7589 |
// We might have captions; put them into the caption list of the |
7819 |
// We might have captions; put them into the caption list of the |
| 7590 |
// outer table frame. |
7820 |
// outer table frame. |
| 7591 |
if (captionItems.NotEmpty()) { |
7821 |
if (captionItems.NotEmpty()) { |
| 7592 |
NS_ASSERTION(nsGkAtoms::tableFrame == frameType || |
7822 |
NS_ASSERTION(nsGkAtoms::tableFrame == frameType || |
| 7593 |
nsGkAtoms::tableOuterFrame == frameType, |
7823 |
nsGkAtoms::tableOuterFrame == frameType, |
| 7594 |
"parent for caption is not table?"); |
7824 |
"parent for caption is not table?"); |
| 7595 |
// We need to determine where to put the caption items; start with the |
7825 |
// We need to determine where to put the caption items; start with the |
| 7596 |
// the parent frame that has already been determined and get the insertion |
7826 |
// the parent frame that has already been determined and get the insertion |
| 7597 |
// prevsibling of the first caption item. |
7827 |
// prevsibling of the first caption item. |
| 7598 |
nsContainerFrame* captionParent = parentFrame; |
|
|
| 7599 |
bool captionIsAppend; |
7828 |
bool captionIsAppend; |
| 7600 |
nsIFrame* captionPrevSibling = nullptr; |
7829 |
nsIFrame* captionPrevSibling = nullptr; |
| 7601 |
|
7830 |
|
| 7602 |
// aIsRangeInsertSafe is ignored on purpose because it is irrelevant here. |
7831 |
// aIsRangeInsertSafe is ignored on purpose because it is irrelevant here. |
| 7603 |
bool ignored; |
7832 |
bool ignored; |
|
|
7833 |
InsertionPoint captionInsertion(insertion.mParentFrame, insertion.mContainer); |
| 7604 |
if (isSingleInsert) { |
7834 |
if (isSingleInsert) { |
| 7605 |
captionPrevSibling = |
7835 |
captionPrevSibling = |
| 7606 |
GetInsertionPrevSibling(captionParent, aContainer, aStartChild, |
7836 |
GetInsertionPrevSibling(&captionInsertion, aStartChild, |
| 7607 |
&captionIsAppend, &ignored); |
7837 |
&captionIsAppend, &ignored); |
| 7608 |
} else { |
7838 |
} else { |
| 7609 |
nsIContent* firstCaption = captionItems.FirstChild()->GetContent(); |
7839 |
nsIContent* firstCaption = captionItems.FirstChild()->GetContent(); |
| 7610 |
// It is very important here that we skip the children in |
7840 |
// It is very important here that we skip the children in |
| 7611 |
// [aStartChild,aEndChild) when looking for a |
7841 |
// [aStartChild,aEndChild) when looking for a |
| 7612 |
// prevsibling. |
7842 |
// prevsibling. |
| 7613 |
captionPrevSibling = |
7843 |
captionPrevSibling = |
| 7614 |
GetInsertionPrevSibling(captionParent, aContainer, firstCaption, |
7844 |
GetInsertionPrevSibling(&captionInsertion, firstCaption, |
| 7615 |
&captionIsAppend, &ignored, |
7845 |
&captionIsAppend, &ignored, |
| 7616 |
aStartChild, aEndChild); |
7846 |
aStartChild, aEndChild); |
| 7617 |
} |
7847 |
} |
| 7618 |
|
7848 |
|
| 7619 |
nsContainerFrame* outerTable = nullptr; |
7849 |
nsContainerFrame* outerTable = nullptr; |
| 7620 |
if (GetCaptionAdjustedParent(captionParent, captionItems.FirstChild(), |
7850 |
if (GetCaptionAdjustedParent(captionInsertion.mParentFrame, |
|
|
7851 |
captionItems.FirstChild(), |
| 7621 |
&outerTable)) { |
7852 |
&outerTable)) { |
| 7622 |
// If the parent is not an outer table frame we will try to add frames |
7853 |
// If the parent is not an outer table frame we will try to add frames |
| 7623 |
// to a named child list that the parent does not honour and the frames |
7854 |
// to a named child list that the parent does not honour and the frames |
| 7624 |
// will get lost |
7855 |
// will get lost |
| 7625 |
NS_ASSERTION(nsGkAtoms::tableOuterFrame == outerTable->GetType(), |
7856 |
NS_ASSERTION(nsGkAtoms::tableOuterFrame == outerTable->GetType(), |
| 7626 |
"Pseudo frame construction failure; " |
7857 |
"Pseudo frame construction failure; " |
| 7627 |
"a caption can be only a child of an outer table frame"); |
7858 |
"a caption can be only a child of an outer table frame"); |
| 7628 |
|
7859 |
|
|
Lines 7640-7671
nsCSSFrameConstructor::ContentRangeInser
|
Link Here
|
|---|
|
| 7640 |
captionPrevSibling, captionItems); |
7871 |
captionPrevSibling, captionItems); |
| 7641 |
} |
7872 |
} |
| 7642 |
} |
7873 |
} |
| 7643 |
} |
7874 |
} |
| 7644 |
|
7875 |
|
| 7645 |
if (frameItems.NotEmpty()) { |
7876 |
if (frameItems.NotEmpty()) { |
| 7646 |
// Notify the parent frame |
7877 |
// Notify the parent frame |
| 7647 |
if (isAppend) { |
7878 |
if (isAppend) { |
| 7648 |
AppendFramesToParent(state, parentFrame, frameItems, prevSibling); |
7879 |
AppendFramesToParent(state, insertion.mParentFrame, frameItems, prevSibling); |
| 7649 |
} else { |
7880 |
} else { |
| 7650 |
InsertFrames(parentFrame, kPrincipalList, prevSibling, frameItems); |
7881 |
InsertFrames(insertion.mParentFrame, kPrincipalList, prevSibling, frameItems); |
| 7651 |
} |
7882 |
} |
| 7652 |
} |
7883 |
} |
| 7653 |
|
7884 |
|
| 7654 |
if (haveFirstLetterStyle) { |
7885 |
if (haveFirstLetterStyle) { |
| 7655 |
// Recover the letter frames for the containing block when |
7886 |
// Recover the letter frames for the containing block when |
| 7656 |
// it has first-letter style. |
7887 |
// it has first-letter style. |
| 7657 |
RecoverLetterFrames(state.mFloatedItems.containingBlock); |
7888 |
RecoverLetterFrames(state.mFloatedItems.containingBlock); |
| 7658 |
} |
7889 |
} |
| 7659 |
|
7890 |
|
| 7660 |
#ifdef DEBUG |
7891 |
#ifdef DEBUG |
| 7661 |
if (gReallyNoisyContentUpdates && parentFrame) { |
7892 |
if (gReallyNoisyContentUpdates && insertion.mParentFrame) { |
| 7662 |
printf("nsCSSFrameConstructor::ContentRangeInserted: resulting frame model:\n"); |
7893 |
printf("nsCSSFrameConstructor::ContentRangeInserted: resulting frame model:\n"); |
| 7663 |
parentFrame->List(stdout, 0); |
7894 |
insertion.mParentFrame->List(stdout, 0); |
| 7664 |
} |
7895 |
} |
| 7665 |
#endif |
7896 |
#endif |
| 7666 |
|
7897 |
|
| 7667 |
#ifdef ACCESSIBILITY |
7898 |
#ifdef ACCESSIBILITY |
| 7668 |
nsAccessibilityService* accService = nsIPresShell::AccService(); |
7899 |
nsAccessibilityService* accService = nsIPresShell::AccService(); |
| 7669 |
if (accService) { |
7900 |
if (accService) { |
| 7670 |
accService->ContentRangeInserted(mPresShell, aContainer, |
7901 |
accService->ContentRangeInserted(mPresShell, aContainer, |
| 7671 |
aStartChild, aEndChild); |
7902 |
aStartChild, aEndChild); |
|
Lines 7703-7730
nsCSSFrameConstructor::ContentRemoved(ns
|
Link Here
|
|---|
|
| 7703 |
static_cast<void*>(aChild), |
7934 |
static_cast<void*>(aChild), |
| 7704 |
static_cast<void*>(aOldNextSibling)); |
7935 |
static_cast<void*>(aOldNextSibling)); |
| 7705 |
if (gReallyNoisyContentUpdates) { |
7936 |
if (gReallyNoisyContentUpdates) { |
| 7706 |
aContainer->List(stdout, 0); |
7937 |
aContainer->List(stdout, 0); |
| 7707 |
} |
7938 |
} |
| 7708 |
} |
7939 |
} |
| 7709 |
#endif |
7940 |
#endif |
| 7710 |
|
7941 |
|
| 7711 |
nsPresContext *presContext = mPresShell->GetPresContext(); |
7942 |
nsresult rv = NS_OK; |
| 7712 |
nsresult rv = NS_OK; |
|
|
| 7713 |
|
| 7714 |
// Find the child frame that maps the content |
| 7715 |
nsIFrame* childFrame = aChild->GetPrimaryFrame(); |
7943 |
nsIFrame* childFrame = aChild->GetPrimaryFrame(); |
| 7716 |
|
|
|
| 7717 |
if (!childFrame || childFrame->GetContent() != aChild) { |
7944 |
if (!childFrame || childFrame->GetContent() != aChild) { |
| 7718 |
// XXXbz the GetContent() != aChild check is needed due to bug 135040. |
7945 |
// XXXbz the GetContent() != aChild check is needed due to bug 135040. |
| 7719 |
// Remove it once that's fixed. |
7946 |
// Remove it once that's fixed. |
| 7720 |
ClearUndisplayedContentIn(aChild, aContainer); |
7947 |
ClearUndisplayedContentIn(aChild, aContainer); |
| 7721 |
} |
7948 |
} |
| 7722 |
|
7949 |
MOZ_ASSERT(!childFrame || !GetDisplayContentsStyleFor(aChild), |
|
|
7950 |
"display:contents nodes shouldn't have a frame"); |
| 7951 |
if (!childFrame && GetDisplayContentsStyleFor(aChild)) { |
| 7952 |
nsIFrame* ancestorFrame = nullptr; |
| 7953 |
nsIContent* ancestor = aContainer; |
| 7954 |
for (; ancestor; ancestor = ancestor->GetParent()) { |
| 7955 |
ancestorFrame = ancestor->GetPrimaryFrame(); |
| 7956 |
if (ancestorFrame) { |
| 7957 |
break; |
| 7958 |
} |
| 7959 |
} |
| 7960 |
if (ancestorFrame) { |
| 7961 |
nsTArray<nsIContent*>* generated = ancestorFrame->GetGenConPseudos(); |
| 7962 |
if (generated) { |
| 7963 |
*aDidReconstruct = true; |
| 7964 |
LAYOUT_PHASE_TEMP_EXIT(); |
| 7965 |
// XXXmats Can we recreate frames only for the ::after/::before content? |
| 7966 |
// XXX Perhaps even only those that belong to the aChild sub-tree? |
| 7967 |
RecreateFramesForContent(ancestor, false, aFlags, aDestroyedFramesFor); |
| 7968 |
LAYOUT_PHASE_TEMP_REENTER(); |
| 7969 |
return NS_OK; |
| 7970 |
} |
| 7971 |
} |
| 7972 |
|
| 7973 |
FlattenedChildIterator iter(aChild); |
| 7974 |
for (nsIContent* c = iter.GetNextChild(); c; c = iter.GetNextChild()) { |
| 7975 |
if (c->GetPrimaryFrame() || GetDisplayContentsStyleFor(c)) { |
| 7976 |
LAYOUT_PHASE_TEMP_EXIT(); |
| 7977 |
rv = ContentRemoved(aChild, c, nullptr, aFlags, aDidReconstruct, aDestroyedFramesFor); |
| 7978 |
LAYOUT_PHASE_TEMP_REENTER(); |
| 7979 |
NS_ENSURE_SUCCESS(rv, rv); |
| 7980 |
if (aFlags != REMOVE_DESTROY_FRAMES && *aDidReconstruct) { |
| 7981 |
return rv; |
| 7982 |
} |
| 7983 |
} |
| 7984 |
} |
| 7985 |
ClearDisplayContentsIn(aChild, aContainer); |
| 7986 |
} |
| 7987 |
|
| 7988 |
nsPresContext* presContext = mPresShell->GetPresContext(); |
| 7723 |
#ifdef MOZ_XUL |
7989 |
#ifdef MOZ_XUL |
| 7724 |
if (NotifyListBoxBody(presContext, aContainer, aChild, aOldNextSibling, |
7990 |
if (NotifyListBoxBody(presContext, aContainer, aChild, aOldNextSibling, |
| 7725 |
mDocument, childFrame, CONTENT_REMOVED)) { |
7991 |
mDocument, childFrame, CONTENT_REMOVED)) { |
| 7726 |
if (aFlags == REMOVE_DESTROY_FRAMES) { |
7992 |
if (aFlags == REMOVE_DESTROY_FRAMES) { |
| 7727 |
CaptureStateForFramesOf(aChild, mTempFrameTreeState); |
7993 |
CaptureStateForFramesOf(aChild, mTempFrameTreeState); |
| 7728 |
} |
7994 |
} |
| 7729 |
return NS_OK; |
7995 |
return NS_OK; |
| 7730 |
} |
7996 |
} |
|
Lines 8564-8640
nsCSSFrameConstructor::ReplicateFixedFra
|
Link Here
|
|---|
|
| 8564 |
// XXXbz this is a little screwed up, since the fixed frames will have |
8830 |
// XXXbz this is a little screwed up, since the fixed frames will have |
| 8565 |
// broken auto-positioning. Oh, well. |
8831 |
// broken auto-positioning. Oh, well. |
| 8566 |
NS_ASSERTION(!canvasFrame->GetFirstPrincipalChild(), |
8832 |
NS_ASSERTION(!canvasFrame->GetFirstPrincipalChild(), |
| 8567 |
"leaking frames; doc root continuation must be empty"); |
8833 |
"leaking frames; doc root continuation must be empty"); |
| 8568 |
canvasFrame->SetInitialChildList(kPrincipalList, fixedPlaceholders); |
8834 |
canvasFrame->SetInitialChildList(kPrincipalList, fixedPlaceholders); |
| 8569 |
return NS_OK; |
8835 |
return NS_OK; |
| 8570 |
} |
8836 |
} |
| 8571 |
|
8837 |
|
| 8572 |
nsContainerFrame* |
8838 |
nsCSSFrameConstructor::InsertionPoint |
| 8573 |
nsCSSFrameConstructor::GetInsertionPoint(nsIContent* aContainer, |
8839 |
nsCSSFrameConstructor::GetInsertionPoint(nsIContent* aContainer, |
| 8574 |
nsIContent* aChildContent, |
8840 |
nsIContent* aChild) |
| 8575 |
bool* aMultiple) |
8841 |
{ |
| 8576 |
{ |
8842 |
nsBindingManager* bindingManager = mDocument->BindingManager(); |
| 8577 |
nsBindingManager *bindingManager = mDocument->BindingManager(); |
|
|
| 8578 |
|
8843 |
|
| 8579 |
nsIContent* insertionElement; |
8844 |
nsIContent* insertionElement; |
| 8580 |
if (aChildContent) { |
8845 |
if (aChild) { |
| 8581 |
// We've got an explicit insertion child. Check to see if it's |
8846 |
// We've got an explicit insertion child. Check to see if it's |
| 8582 |
// anonymous. |
8847 |
// anonymous. |
| 8583 |
if (aChildContent->GetBindingParent() == aContainer) { |
8848 |
if (aChild->GetBindingParent() == aContainer) { |
| 8584 |
// This child content is anonymous. Don't use the insertion |
8849 |
// This child content is anonymous. Don't use the insertion |
| 8585 |
// point, since that's only for the explicit kids. |
8850 |
// point, since that's only for the explicit kids. |
| 8586 |
return ::GetContentInsertionFrameFor(aContainer); |
8851 |
return InsertionPoint(GetContentInsertionFrameFor(aContainer), aContainer); |
| 8587 |
} |
8852 |
} |
| 8588 |
|
8853 |
|
| 8589 |
if (nsContentUtils::HasDistributedChildren(aContainer)) { |
8854 |
if (nsContentUtils::HasDistributedChildren(aContainer)) { |
| 8590 |
// The container distributes nodes, use the frame of the flattened tree parent. |
8855 |
// The container distributes nodes, use the frame of the flattened tree parent. |
| 8591 |
// It may be the case that the node is distributed but not matched to any |
8856 |
// It may be the case that the node is distributed but not matched to any |
| 8592 |
// insertion points, so there is no flattened parent. |
8857 |
// insertion points, so there is no flattened parent. |
| 8593 |
nsIContent* flattenedParent = aChildContent->GetFlattenedTreeParent(); |
8858 |
nsIContent* flattenedParent = aChild->GetFlattenedTreeParent(); |
| 8594 |
return flattenedParent ? ::GetContentInsertionFrameFor(flattenedParent) : nullptr; |
8859 |
if (flattenedParent) { |
| 8595 |
} |
8860 |
return InsertionPoint(GetContentInsertionFrameFor(flattenedParent), |
| 8596 |
|
8861 |
flattenedParent); |
| 8597 |
insertionElement = bindingManager->FindNestedInsertionPoint(aContainer, aChildContent); |
8862 |
} |
| 8598 |
} |
8863 |
return InsertionPoint(); |
| 8599 |
else { |
8864 |
} |
|
|
8865 |
|
| 8866 |
insertionElement = bindingManager->FindNestedInsertionPoint(aContainer, aChild); |
| 8867 |
} else { |
| 8600 |
if (nsContentUtils::HasDistributedChildren(aContainer)) { |
8868 |
if (nsContentUtils::HasDistributedChildren(aContainer)) { |
| 8601 |
// The container distributes nodes to shadow DOM insertion points. |
8869 |
// The container distributes nodes to shadow DOM insertion points. |
| 8602 |
// Return with aMultiple set to true to induce callers to insert children |
8870 |
// Return with aMultiple set to true to induce callers to insert children |
| 8603 |
// individually into the node's flattened tree parent. |
8871 |
// individually into the node's flattened tree parent. |
| 8604 |
*aMultiple = true; |
8872 |
return InsertionPoint(nullptr, nullptr, true); |
| 8605 |
return nullptr; |
|
|
| 8606 |
} |
8873 |
} |
| 8607 |
|
8874 |
|
| 8608 |
bool multiple; |
8875 |
bool multiple; |
| 8609 |
insertionElement = bindingManager->FindNestedSingleInsertionPoint(aContainer, &multiple); |
8876 |
insertionElement = bindingManager->FindNestedSingleInsertionPoint(aContainer, &multiple); |
| 8610 |
|
|
|
| 8611 |
if (multiple) { |
8877 |
if (multiple) { |
| 8612 |
if (aMultiple) { |
8878 |
return InsertionPoint(nullptr, nullptr, true); |
| 8613 |
*aMultiple = true; |
|
|
| 8614 |
} |
| 8615 |
return nullptr; |
| 8616 |
} |
8879 |
} |
| 8617 |
} |
8880 |
} |
| 8618 |
|
8881 |
|
| 8619 |
if (!insertionElement) { |
8882 |
if (!insertionElement) { |
| 8620 |
insertionElement = aContainer; |
8883 |
insertionElement = aContainer; |
| 8621 |
} |
8884 |
} |
| 8622 |
|
8885 |
InsertionPoint insertion(GetContentInsertionFrameFor(insertionElement), |
| 8623 |
nsContainerFrame* insertionPoint = |
8886 |
insertionElement); |
| 8624 |
::GetContentInsertionFrameFor(insertionElement); |
8887 |
|
| 8625 |
|
8888 |
// Fieldsets have multiple insertion points. |
| 8626 |
// fieldsets have multiple insertion points. Note that we might |
8889 |
if (insertionElement->IsHTML(nsGkAtoms::fieldset)) { |
| 8627 |
// have to look at insertionElement here... |
8890 |
insertion.mMultiple = true; |
| 8628 |
if (aMultiple && insertionElement->IsHTML(nsGkAtoms::fieldset)) { |
8891 |
} |
| 8629 |
*aMultiple = true; |
8892 |
|
| 8630 |
} |
8893 |
return insertion; |
| 8631 |
|
|
|
| 8632 |
return insertionPoint; |
| 8633 |
} |
8894 |
} |
| 8634 |
|
8895 |
|
| 8635 |
// Capture state for the frame tree rooted at the frame associated with the |
8896 |
// Capture state for the frame tree rooted at the frame associated with the |
| 8636 |
// content object, aContent |
8897 |
// content object, aContent |
| 8637 |
void |
8898 |
void |
| 8638 |
nsCSSFrameConstructor::CaptureStateForFramesOf(nsIContent* aContent, |
8899 |
nsCSSFrameConstructor::CaptureStateForFramesOf(nsIContent* aContent, |
| 8639 |
nsILayoutHistoryState* aHistoryState) |
8900 |
nsILayoutHistoryState* aHistoryState) |
| 8640 |
{ |
8901 |
{ |
|
Lines 8653-8698
nsCSSFrameConstructor::CaptureStateForFr
|
Link Here
|
|---|
|
| 8653 |
|
8914 |
|
| 8654 |
static bool EqualURIs(mozilla::css::URLValue *aURI1, |
8915 |
static bool EqualURIs(mozilla::css::URLValue *aURI1, |
| 8655 |
mozilla::css::URLValue *aURI2) |
8916 |
mozilla::css::URLValue *aURI2) |
| 8656 |
{ |
8917 |
{ |
| 8657 |
return aURI1 == aURI2 || // handle null==null, and optimize |
8918 |
return aURI1 == aURI2 || // handle null==null, and optimize |
| 8658 |
(aURI1 && aURI2 && aURI1->URIEquals(*aURI2)); |
8919 |
(aURI1 && aURI2 && aURI1->URIEquals(*aURI2)); |
| 8659 |
} |
8920 |
} |
| 8660 |
|
8921 |
|
| 8661 |
nsresult |
8922 |
nsStyleContext* |
| 8662 |
nsCSSFrameConstructor::MaybeRecreateFramesForElement(Element* aElement) |
8923 |
nsCSSFrameConstructor::MaybeRecreateFramesForElement(Element* aElement) |
| 8663 |
{ |
8924 |
{ |
| 8664 |
nsRefPtr<nsStyleContext> oldContext = GetUndisplayedContent(aElement); |
8925 |
nsRefPtr<nsStyleContext> oldContext = GetUndisplayedContent(aElement); |
|
|
8926 |
uint8_t oldDisplay = NS_STYLE_DISPLAY_NONE; |
| 8665 |
if (!oldContext) { |
8927 |
if (!oldContext) { |
| 8666 |
return NS_OK; |
8928 |
oldContext = GetDisplayContentsStyleFor(aElement); |
|
|
8929 |
if (!oldContext) { |
| 8930 |
return nullptr; |
| 8931 |
} |
| 8932 |
oldDisplay = NS_STYLE_DISPLAY_CONTENTS; |
| 8667 |
} |
8933 |
} |
| 8668 |
|
8934 |
|
| 8669 |
// The parent has a frame, so try resolving a new context. |
8935 |
// The parent has a frame, so try resolving a new context. |
| 8670 |
nsRefPtr<nsStyleContext> newContext = mPresShell->StyleSet()-> |
8936 |
nsRefPtr<nsStyleContext> newContext = mPresShell->StyleSet()-> |
| 8671 |
ResolveStyleFor(aElement, oldContext->GetParent()); |
8937 |
ResolveStyleFor(aElement, oldContext->GetParent()); |
| 8672 |
|
8938 |
|
| 8673 |
ChangeUndisplayedContent(aElement, newContext); |
8939 |
if (oldDisplay == NS_STYLE_DISPLAY_NONE) { |
|
|
8940 |
ChangeUndisplayedContent(aElement, newContext); |
| 8941 |
} else { |
| 8942 |
ChangeDisplayContents(aElement, newContext); |
| 8943 |
} |
| 8944 |
|
| 8674 |
const nsStyleDisplay* disp = newContext->StyleDisplay(); |
8945 |
const nsStyleDisplay* disp = newContext->StyleDisplay(); |
| 8675 |
if (disp->mDisplay == NS_STYLE_DISPLAY_NONE) { |
8946 |
if (oldDisplay == disp->mDisplay) { |
| 8676 |
// We can skip trying to recreate frames here, but only if our style |
8947 |
// We can skip trying to recreate frames here, but only if our style |
| 8677 |
// context does not have a binding URI that differs from our old one. |
8948 |
// context does not have a binding URI that differs from our old one. |
| 8678 |
// Otherwise, we should try to recreate, because we may want to apply the |
8949 |
// Otherwise, we should try to recreate, because we may want to apply the |
| 8679 |
// new binding |
8950 |
// new binding |
| 8680 |
if (!disp->mBinding) { |
8951 |
if (!disp->mBinding) { |
| 8681 |
return NS_OK; |
8952 |
return newContext; |
| 8682 |
} |
8953 |
} |
| 8683 |
const nsStyleDisplay* oldDisp = oldContext->PeekStyleDisplay(); |
8954 |
const nsStyleDisplay* oldDisp = oldContext->PeekStyleDisplay(); |
| 8684 |
if (oldDisp && EqualURIs(disp->mBinding, oldDisp->mBinding)) { |
8955 |
if (oldDisp && EqualURIs(disp->mBinding, oldDisp->mBinding)) { |
| 8685 |
return NS_OK; |
8956 |
return newContext; |
| 8686 |
} |
8957 |
} |
| 8687 |
} |
8958 |
} |
| 8688 |
|
8959 |
|
| 8689 |
return RecreateFramesForContent(aElement, false, REMOVE_FOR_RECONSTRUCTION, |
8960 |
RecreateFramesForContent(aElement, false, REMOVE_FOR_RECONSTRUCTION, nullptr); |
| 8690 |
nullptr); |
8961 |
return nullptr; |
| 8691 |
} |
8962 |
} |
| 8692 |
|
8963 |
|
| 8693 |
static nsIFrame* |
8964 |
static nsIFrame* |
| 8694 |
FindFirstNonWhitespaceChild(nsIFrame* aParentFrame) |
8965 |
FindFirstNonWhitespaceChild(nsIFrame* aParentFrame) |
| 8695 |
{ |
8966 |
{ |
| 8696 |
nsIFrame* f = aParentFrame->GetFirstPrincipalChild(); |
8967 |
nsIFrame* f = aParentFrame->GetFirstPrincipalChild(); |
| 8697 |
while (f && f->GetType() == nsGkAtoms::textFrame && |
8968 |
while (f && f->GetType() == nsGkAtoms::textFrame && |
| 8698 |
f->GetContent()->TextIsOnlyWhitespace()) { |
8969 |
f->GetContent()->TextIsOnlyWhitespace()) { |
|
Lines 9836-9876
nsCSSFrameConstructor::ProcessChildren(n
|
Link Here
|
|---|
|
| 9836 |
itemsToConstruct); |
10107 |
itemsToConstruct); |
| 9837 |
} |
10108 |
} |
| 9838 |
|
10109 |
|
| 9839 |
const bool addChildItems = MOZ_LIKELY(mCurrentDepth < kMaxDepth); |
10110 |
const bool addChildItems = MOZ_LIKELY(mCurrentDepth < kMaxDepth); |
| 9840 |
if (!addChildItems) { |
10111 |
if (!addChildItems) { |
| 9841 |
NS_WARNING("ProcessChildren max depth exceeded"); |
10112 |
NS_WARNING("ProcessChildren max depth exceeded"); |
| 9842 |
} |
10113 |
} |
| 9843 |
|
10114 |
|
|
|
10115 |
InsertionPoint insertion(aFrame, nullptr); |
| 9844 |
FlattenedChildIterator iter(aContent); |
10116 |
FlattenedChildIterator iter(aContent); |
| 9845 |
for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) { |
10117 |
for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) { |
| 9846 |
// Get the parent of the content and check if it is a XBL children element |
10118 |
// Get the parent of the content and check if it is a XBL children element |
| 9847 |
// (if the content is a children element then parent != aContent because the |
10119 |
// (if the content is a children element then parent != aContent because the |
| 9848 |
// FlattenedChildIterator will transitively iterate through <xbl:children> |
10120 |
// FlattenedChildIterator will transitively iterate through <xbl:children> |
| 9849 |
// for default content). Push the children element as an ancestor here because |
10121 |
// for default content). Push the children element as an ancestor here because |
| 9850 |
// it does not have a frame and would not otherwise be pushed as an ancestor. |
10122 |
// it does not have a frame and would not otherwise be pushed as an ancestor. |
|
|
10123 |
insertion.mContainer = aContent; |
| 9851 |
nsIContent* parent = child->GetParent(); |
10124 |
nsIContent* parent = child->GetParent(); |
| 9852 |
MOZ_ASSERT(parent, "Parent must be non-null because we are iterating children."); |
10125 |
MOZ_ASSERT(parent, "Parent must be non-null because we are iterating children."); |
| 9853 |
TreeMatchContext::AutoAncestorPusher ancestorPusher(aState.mTreeMatchContext); |
10126 |
TreeMatchContext::AutoAncestorPusher ancestorPusher(aState.mTreeMatchContext); |
| 9854 |
if (parent != aContent && parent->IsElement()) { |
10127 |
if (parent != aContent && parent->IsElement()) { |
|
|
10128 |
insertion.mContainer = GetInsertionPoint(parent, child).mContainer; |
| 10129 |
MOZ_ASSERT(insertion.mContainer == child->GetFlattenedTreeParent()); |
| 9855 |
if (aState.mTreeMatchContext.mAncestorFilter.HasFilter()) { |
10130 |
if (aState.mTreeMatchContext.mAncestorFilter.HasFilter()) { |
| 9856 |
ancestorPusher.PushAncestorAndStyleScope(parent->AsElement()); |
10131 |
ancestorPusher.PushAncestorAndStyleScope(parent->AsElement()); |
| 9857 |
} else { |
10132 |
} else { |
| 9858 |
ancestorPusher.PushStyleScope(parent->AsElement()); |
10133 |
ancestorPusher.PushStyleScope(parent->AsElement()); |
| 9859 |
} |
10134 |
} |
| 9860 |
} |
10135 |
} |
| 9861 |
|
10136 |
|
| 9862 |
// Frame construction item construction should not post |
10137 |
// Frame construction item construction should not post |
| 9863 |
// restyles, so removing restyle flags here is safe. |
10138 |
// restyles, so removing restyle flags here is safe. |
| 9864 |
if (child->IsElement()) { |
10139 |
if (child->IsElement()) { |
| 9865 |
child->UnsetFlags(ELEMENT_ALL_RESTYLE_FLAGS); |
10140 |
child->UnsetFlags(ELEMENT_ALL_RESTYLE_FLAGS); |
| 9866 |
} |
10141 |
} |
| 9867 |
if (addChildItems) { |
10142 |
if (addChildItems) { |
| 9868 |
AddFrameConstructionItems(aState, child, iter.XBLInvolved(), aFrame, |
10143 |
AddFrameConstructionItems(aState, child, iter.XBLInvolved(), insertion, |
| 9869 |
itemsToConstruct); |
10144 |
itemsToConstruct); |
| 9870 |
} else { |
10145 |
} else { |
| 9871 |
ClearLazyBits(child, child->GetNextSibling()); |
10146 |
ClearLazyBits(child, child->GetNextSibling()); |
| 9872 |
} |
10147 |
} |
| 9873 |
} |
10148 |
} |
| 9874 |
itemsToConstruct.SetParentHasNoXBLChildren(!iter.XBLInvolved()); |
10149 |
itemsToConstruct.SetParentHasNoXBLChildren(!iter.XBLInvolved()); |
| 9875 |
|
10150 |
|
| 9876 |
if (aCanHaveGeneratedContent) { |
10151 |
if (aCanHaveGeneratedContent) { |