|
|
|
Lines 2384-2400
nsCSSFrameConstructor::ConstructDocEleme
|
Link Here
|
|---|
|
| 2384 |
|
2384 |
|
| 2385 |
#ifdef DEBUG |
2385 |
#ifdef DEBUG |
| 2386 |
NS_ASSERTION(!display->IsScrollableOverflow() || |
2386 |
NS_ASSERTION(!display->IsScrollableOverflow() || |
| 2387 |
state.mPresContext->IsPaginated() || |
2387 |
state.mPresContext->IsPaginated() || |
| 2388 |
propagatedScrollFrom == aDocElement, |
2388 |
propagatedScrollFrom == aDocElement, |
| 2389 |
"Scrollbars should have been propagated to the viewport"); |
2389 |
"Scrollbars should have been propagated to the viewport"); |
| 2390 |
#endif |
2390 |
#endif |
| 2391 |
|
2391 |
|
| 2392 |
if (MOZ_UNLIKELY(display->mDisplay == NS_STYLE_DISPLAY_NONE)) { |
2392 |
if (MOZ_UNLIKELY(display->mDisplayBox == NS_STYLE_DISPLAY_BOX_NONE)) { |
| 2393 |
SetUndisplayedContent(aDocElement, styleContext); |
2393 |
SetUndisplayedContent(aDocElement, styleContext); |
| 2394 |
return nullptr; |
2394 |
return nullptr; |
| 2395 |
} |
2395 |
} |
| 2396 |
|
2396 |
|
| 2397 |
TreeMatchContext::AutoAncestorPusher ancestorPusher(state.mTreeMatchContext); |
2397 |
TreeMatchContext::AutoAncestorPusher ancestorPusher(state.mTreeMatchContext); |
| 2398 |
ancestorPusher.PushAncestorAndStyleScope(aDocElement); |
2398 |
ancestorPusher.PushAncestorAndStyleScope(aDocElement); |
| 2399 |
|
2399 |
|
| 2400 |
// Make sure to start any background image loads for the root element now. |
2400 |
// Make sure to start any background image loads for the root element now. |
|
Lines 2518-2534
nsCSSFrameConstructor::ConstructDocEleme
|
Link Here
|
|---|
|
| 2518 |
NS_ASSERTION(processChildren ? !mRootElementFrame : |
2518 |
NS_ASSERTION(processChildren ? !mRootElementFrame : |
| 2519 |
mRootElementFrame == contentFrame, |
2519 |
mRootElementFrame == contentFrame, |
| 2520 |
"unexpected mRootElementFrame"); |
2520 |
"unexpected mRootElementFrame"); |
| 2521 |
mRootElementFrame = contentFrame; |
2521 |
mRootElementFrame = contentFrame; |
| 2522 |
|
2522 |
|
| 2523 |
// Figure out which frame has the main style for the document element, |
2523 |
// Figure out which frame has the main style for the document element, |
| 2524 |
// assigning it to mRootElementStyleFrame. |
2524 |
// assigning it to mRootElementStyleFrame. |
| 2525 |
// Backgrounds should be propagated from that frame to the viewport. |
2525 |
// Backgrounds should be propagated from that frame to the viewport. |
| 2526 |
mRootElementStyleFrame = contentFrame->GetParentStyleContextFrame(); |
2526 |
contentFrame->GetParentStyleContext(&mRootElementStyleFrame); |
| 2527 |
bool isChild = mRootElementStyleFrame && |
2527 |
bool isChild = mRootElementStyleFrame && |
| 2528 |
mRootElementStyleFrame->GetParent() == contentFrame; |
2528 |
mRootElementStyleFrame->GetParent() == contentFrame; |
| 2529 |
if (!isChild) { |
2529 |
if (!isChild) { |
| 2530 |
mRootElementStyleFrame = mRootElementFrame; |
2530 |
mRootElementStyleFrame = mRootElementFrame; |
| 2531 |
} |
2531 |
} |
| 2532 |
|
2532 |
|
| 2533 |
if (processChildren) { |
2533 |
if (processChildren) { |
| 2534 |
// Still need to process the child content |
2534 |
// Still need to process the child content |
|
Lines 3325-3340
IsFrameForFieldSet(nsIFrame* aFrame, nsI
|
Link Here
|
|---|
|
| 3325 |
/* static */ |
3325 |
/* static */ |
| 3326 |
const nsCSSFrameConstructor::FrameConstructionData* |
3326 |
const nsCSSFrameConstructor::FrameConstructionData* |
| 3327 |
nsCSSFrameConstructor::FindHTMLData(Element* aElement, |
3327 |
nsCSSFrameConstructor::FindHTMLData(Element* aElement, |
| 3328 |
nsIAtom* aTag, |
3328 |
nsIAtom* aTag, |
| 3329 |
int32_t aNameSpaceID, |
3329 |
int32_t aNameSpaceID, |
| 3330 |
nsIFrame* aParentFrame, |
3330 |
nsIFrame* aParentFrame, |
| 3331 |
nsStyleContext* aStyleContext) |
3331 |
nsStyleContext* aStyleContext) |
| 3332 |
{ |
3332 |
{ |
|
|
3333 |
MOZ_ASSERT(aStyleContext->StyleDisplay()->mDisplayBox != NS_STYLE_DISPLAY_BOX_NONE); |
| 3334 |
|
| 3333 |
// Ignore the tag if it's not HTML content and if it doesn't extend (via XBL) |
3335 |
// Ignore the tag if it's not HTML content and if it doesn't extend (via XBL) |
| 3334 |
// a valid HTML namespace. This check must match the one in |
3336 |
// a valid HTML namespace. This check must match the one in |
| 3335 |
// ShouldHaveFirstLineStyle. |
3337 |
// ShouldHaveFirstLineStyle. |
| 3336 |
if (aNameSpaceID != kNameSpaceID_XHTML) { |
3338 |
if (aNameSpaceID != kNameSpaceID_XHTML) { |
| 3337 |
return nullptr; |
3339 |
return nullptr; |
| 3338 |
} |
3340 |
} |
| 3339 |
|
3341 |
|
| 3340 |
NS_ASSERTION(!aParentFrame || |
3342 |
NS_ASSERTION(!aParentFrame || |
|
Lines 3570-3598
nsCSSFrameConstructor::ConstructFrameFro
|
Link Here
|
|---|
|
| 3570 |
|
3572 |
|
| 3571 |
// Don't create a subdocument frame for iframes if we're creating extra frames |
3573 |
// Don't create a subdocument frame for iframes if we're creating extra frames |
| 3572 |
if (aState.mCreatingExtraFrames && aItem.mContent->IsHTML() && |
3574 |
if (aState.mCreatingExtraFrames && aItem.mContent->IsHTML() && |
| 3573 |
aItem.mContent->Tag() == nsGkAtoms::iframe) |
3575 |
aItem.mContent->Tag() == nsGkAtoms::iframe) |
| 3574 |
{ |
3576 |
{ |
| 3575 |
return; |
3577 |
return; |
| 3576 |
} |
3578 |
} |
| 3577 |
|
3579 |
|
| 3578 |
nsStyleContext* const styleContext = aItem.mStyleContext; |
|
|
| 3579 |
const nsStyleDisplay* display = styleContext->StyleDisplay(); |
| 3580 |
nsIContent* const content = aItem.mContent; |
3580 |
nsIContent* const content = aItem.mContent; |
|
|
3581 |
nsIContent* parent = content->GetParent(); |
| 3582 |
|
| 3583 |
// Push display-box:contents ancestors. |
| 3584 |
AutoDisplayBoxContentsAncestorPusher adcp(aState.mTreeMatchContext, |
| 3585 |
aState.mPresContext, |
| 3586 |
parent); |
| 3581 |
|
3587 |
|
| 3582 |
// Get the parent of the content and check if it is a XBL children element. |
3588 |
// Get the parent of the content and check if it is a XBL children element. |
| 3583 |
// Push the children element as an ancestor here because it does |
3589 |
// Push the children element as an ancestor here because it does |
| 3584 |
// not have a frame and would not otherwise be pushed as an ancestor. It is |
3590 |
// not have a frame and would not otherwise be pushed as an ancestor. It is |
| 3585 |
// necessary to do so in order to correctly handle style resolution on |
3591 |
// necessary to do so in order to correctly handle style resolution on |
| 3586 |
// descendants. |
3592 |
// descendants. |
| 3587 |
nsIContent* parent = content->GetParent(); |
|
|
| 3588 |
TreeMatchContext::AutoAncestorPusher |
3593 |
TreeMatchContext::AutoAncestorPusher |
| 3589 |
insertionPointPusher(aState.mTreeMatchContext); |
3594 |
insertionPointPusher(aState.mTreeMatchContext); |
| 3590 |
if (parent && nsContentUtils::IsContentInsertionPoint(parent)) { |
3595 |
if (adcp.IsEmpty() && parent && nsContentUtils::IsContentInsertionPoint(parent)) { |
| 3591 |
if (aState.mTreeMatchContext.mAncestorFilter.HasFilter()) { |
3596 |
if (aState.mTreeMatchContext.mAncestorFilter.HasFilter()) { |
| 3592 |
insertionPointPusher.PushAncestorAndStyleScope(parent); |
3597 |
insertionPointPusher.PushAncestorAndStyleScope(parent); |
| 3593 |
} else { |
3598 |
} else { |
| 3594 |
insertionPointPusher.PushStyleScope(parent); |
3599 |
insertionPointPusher.PushStyleScope(parent); |
| 3595 |
} |
3600 |
} |
| 3596 |
} |
3601 |
} |
| 3597 |
|
3602 |
|
| 3598 |
// Push the content as a style ancestor now, so we don't have to do |
3603 |
// Push the content as a style ancestor now, so we don't have to do |
|
Lines 3608-3623
nsCSSFrameConstructor::ConstructFrameFro
|
Link Here
|
|---|
|
| 3608 |
if (aState.mTreeMatchContext.mAncestorFilter.HasFilter()) { |
3613 |
if (aState.mTreeMatchContext.mAncestorFilter.HasFilter()) { |
| 3609 |
ancestorPusher.PushAncestorAndStyleScope(content); |
3614 |
ancestorPusher.PushAncestorAndStyleScope(content); |
| 3610 |
} else { |
3615 |
} else { |
| 3611 |
ancestorPusher.PushStyleScope(content); |
3616 |
ancestorPusher.PushStyleScope(content); |
| 3612 |
} |
3617 |
} |
| 3613 |
|
3618 |
|
| 3614 |
nsIFrame* newFrame; |
3619 |
nsIFrame* newFrame; |
| 3615 |
nsIFrame* primaryFrame; |
3620 |
nsIFrame* primaryFrame; |
|
|
3621 |
nsStyleContext* const styleContext = aItem.mStyleContext; |
| 3622 |
const nsStyleDisplay* display = styleContext->StyleDisplay(); |
| 3616 |
if (bits & FCDATA_FUNC_IS_FULL_CTOR) { |
3623 |
if (bits & FCDATA_FUNC_IS_FULL_CTOR) { |
| 3617 |
newFrame = |
3624 |
newFrame = |
| 3618 |
(this->*(data->mFullConstructor))(aState, aItem, aParentFrame, |
3625 |
(this->*(data->mFullConstructor))(aState, aItem, aParentFrame, |
| 3619 |
display, aFrameItems); |
3626 |
display, aFrameItems); |
| 3620 |
MOZ_ASSERT(newFrame, "Full constructor failed"); |
3627 |
MOZ_ASSERT(newFrame, "Full constructor failed"); |
| 3621 |
primaryFrame = newFrame; |
3628 |
primaryFrame = newFrame; |
| 3622 |
} else { |
3629 |
} else { |
| 3623 |
newFrame = |
3630 |
newFrame = |
|
Lines 4347-4370
nsCSSFrameConstructor::BuildScrollFrame(
|
Link Here
|
|---|
|
| 4347 |
|
4354 |
|
| 4348 |
const nsCSSFrameConstructor::FrameConstructionData* |
4355 |
const nsCSSFrameConstructor::FrameConstructionData* |
| 4349 |
nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay* aDisplay, |
4356 |
nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay* aDisplay, |
| 4350 |
Element* aElement, |
4357 |
Element* aElement, |
| 4351 |
nsIFrame* aParentFrame, |
4358 |
nsIFrame* aParentFrame, |
| 4352 |
nsStyleContext* aStyleContext) |
4359 |
nsStyleContext* aStyleContext) |
| 4353 |
{ |
4360 |
{ |
| 4354 |
PR_STATIC_ASSERT(eParentTypeCount < (1 << (32 - FCDATA_PARENT_TYPE_OFFSET))); |
4361 |
PR_STATIC_ASSERT(eParentTypeCount < (1 << (32 - FCDATA_PARENT_TYPE_OFFSET))); |
|
|
4362 |
MOZ_ASSERT(aDisplay->mDisplayBox != NS_STYLE_DISPLAY_BOX_NONE); |
| 4355 |
|
4363 |
|
| 4356 |
// The style system ensures that floated and positioned frames are |
4364 |
// The style system ensures that floated and positioned frames are |
| 4357 |
// block-level. |
4365 |
// block-level. |
| 4358 |
NS_ASSERTION(!(aDisplay->IsFloatingStyle() || |
4366 |
NS_ASSERTION(!(aDisplay->IsFloatingStyle() || |
| 4359 |
aDisplay->IsAbsolutelyPositionedStyle()) || |
4367 |
aDisplay->IsAbsolutelyPositionedStyle()) || |
| 4360 |
aDisplay->IsBlockOutsideStyle(), |
4368 |
aDisplay->IsBlockOutsideStyle(), |
| 4361 |
"Style system did not apply CSS2.1 section 9.7 fixups"); |
4369 |
"Style system did not apply CSS2.1 section 9.7 fixups"); |
| 4362 |
|
4370 |
|
|
|
4371 |
if (aDisplay->mDisplayBox == NS_STYLE_DISPLAY_BOX_CONTENTS) { |
| 4372 |
// See the mDisplay/Box fixup code in nsRuleNode::ComputeDisplayData. |
| 4373 |
MOZ_ASSERT(!aElement->IsRootOfNativeAnonymousSubtree(), |
| 4374 |
"display-box:contents on anonymous content is unsupported"); |
| 4375 |
static const FrameConstructionData sDisplayBoxContentsData = |
| 4376 |
FULL_CTOR_FCDATA(FCDATA_IS_CONTENTS, nullptr/*never called*/); |
| 4377 |
return &sDisplayBoxContentsData; |
| 4378 |
} |
| 4379 |
|
| 4363 |
// If this is "body", try propagating its scroll style to the viewport |
4380 |
// If this is "body", try propagating its scroll style to the viewport |
| 4364 |
// Note that we need to do this even if the body is NOT scrollable; |
4381 |
// Note that we need to do this even if the body is NOT scrollable; |
| 4365 |
// it might have dynamically changed from scrollable to not scrollable, |
4382 |
// it might have dynamically changed from scrollable to not scrollable, |
| 4366 |
// and that might need to be propagated. |
4383 |
// and that might need to be propagated. |
| 4367 |
// XXXbz is this the right place to do this? If this code moves, |
4384 |
// XXXbz is this the right place to do this? If this code moves, |
| 4368 |
// make this function static. |
4385 |
// make this function static. |
| 4369 |
bool propagatedScrollToViewport = false; |
4386 |
bool propagatedScrollToViewport = false; |
| 4370 |
if (aElement->IsHTML(nsGkAtoms::body)) { |
4387 |
if (aElement->IsHTML(nsGkAtoms::body)) { |
|
Lines 4578-4609
nsCSSFrameConstructor::InitAndRestoreFra
|
Link Here
|
|---|
|
| 4578 |
} |
4595 |
} |
| 4579 |
} |
4596 |
} |
| 4580 |
|
4597 |
|
| 4581 |
already_AddRefed<nsStyleContext> |
4598 |
already_AddRefed<nsStyleContext> |
| 4582 |
nsCSSFrameConstructor::ResolveStyleContext(nsIFrame* aParentFrame, |
4599 |
nsCSSFrameConstructor::ResolveStyleContext(nsIFrame* aParentFrame, |
| 4583 |
nsIContent* aContent, |
4600 |
nsIContent* aContent, |
| 4584 |
nsFrameConstructorState* aState) |
4601 |
nsFrameConstructorState* aState) |
| 4585 |
{ |
4602 |
{ |
| 4586 |
nsStyleContext* parentStyleContext = nullptr; |
4603 |
nsIContent* container = aContent->GetParent(); |
| 4587 |
NS_ASSERTION(aContent->GetParent(), "Must have parent here"); |
4604 |
NS_ASSERTION(container, "Must have parent here"); |
| 4588 |
|
4605 |
nsStyleContext* parentStyleContext = GetDisplayBoxContentsStyleFor(container); |
|
|
4606 |
if (MOZ_LIKELY(!parentStyleContext)) { |
| 4589 |
aParentFrame = nsFrame::CorrectStyleParentFrame(aParentFrame, nullptr); |
4607 |
aParentFrame = nsFrame::CorrectStyleParentFrame(aParentFrame, nullptr); |
| 4590 |
|
|
|
| 4591 |
if (aParentFrame) { |
4608 |
if (aParentFrame) { |
| 4592 |
// Resolve the style context based on the content object and the parent |
4609 |
// Resolve the style context based on the content object and the parent |
| 4593 |
// style context |
4610 |
// style context |
| 4594 |
parentStyleContext = aParentFrame->StyleContext(); |
4611 |
parentStyleContext = aParentFrame->StyleContext(); |
| 4595 |
} else { |
4612 |
} else { |
| 4596 |
// Perhaps aParentFrame is a canvasFrame and we're replicating |
4613 |
// Perhaps aParentFrame is a canvasFrame and we're replicating |
| 4597 |
// fixed-pos frames. |
4614 |
// fixed-pos frames. |
| 4598 |
// XXX should we create a way to tell ConstructFrame which style |
4615 |
// XXX should we create a way to tell ConstructFrame which style |
| 4599 |
// context to use, and pass it the style context for the |
4616 |
// context to use, and pass it the style context for the |
| 4600 |
// previous page's fixed-pos frame? |
4617 |
// previous page's fixed-pos frame? |
| 4601 |
} |
4618 |
} |
|
|
4619 |
} |
| 4602 |
|
4620 |
|
| 4603 |
return ResolveStyleContext(parentStyleContext, aContent, aState); |
4621 |
return ResolveStyleContext(parentStyleContext, aContent, aState); |
| 4604 |
} |
4622 |
} |
| 4605 |
|
4623 |
|
| 4606 |
already_AddRefed<nsStyleContext> |
4624 |
already_AddRefed<nsStyleContext> |
| 4607 |
nsCSSFrameConstructor::ResolveStyleContext(nsStyleContext* aParentStyleContext, |
4625 |
nsCSSFrameConstructor::ResolveStyleContext(nsStyleContext* aParentStyleContext, |
| 4608 |
nsIContent* aContent, |
4626 |
nsIContent* aContent, |
| 4609 |
nsFrameConstructorState* aState) |
4627 |
nsFrameConstructorState* aState) |
|
Lines 5233-5251
nsCSSFrameConstructor::AddFrameConstruct
|
Link Here
|
|---|
|
| 5233 |
aStyleContext = styleContext; |
5251 |
aStyleContext = styleContext; |
| 5234 |
} |
5252 |
} |
| 5235 |
|
5253 |
|
| 5236 |
aTag = mDocument->BindingManager()->ResolveTag(aContent, &aNameSpaceID); |
5254 |
aTag = mDocument->BindingManager()->ResolveTag(aContent, &aNameSpaceID); |
| 5237 |
} |
5255 |
} |
| 5238 |
|
5256 |
|
| 5239 |
bool isGeneratedContent = ((aFlags & ITEM_IS_GENERATED_CONTENT) != 0); |
5257 |
bool isGeneratedContent = ((aFlags & ITEM_IS_GENERATED_CONTENT) != 0); |
| 5240 |
|
5258 |
|
| 5241 |
// Pre-check for display "none" - if we find that, don't create |
5259 |
// Pre-check for display-box:none - if we find that, don't create any frame at all. |
| 5242 |
// any frame at all |
5260 |
if (NS_STYLE_DISPLAY_BOX_NONE == display->mDisplayBox) { |
| 5243 |
if (NS_STYLE_DISPLAY_NONE == display->mDisplay) { |
|
|
| 5244 |
SetAsUndisplayedContent(aItems, aContent, styleContext, isGeneratedContent); |
5261 |
SetAsUndisplayedContent(aItems, aContent, styleContext, isGeneratedContent); |
| 5245 |
return; |
5262 |
return; |
| 5246 |
} |
5263 |
} |
| 5247 |
|
5264 |
|
| 5248 |
bool isText = !aContent->IsElement(); |
5265 |
bool isText = !aContent->IsElement(); |
| 5249 |
|
5266 |
|
| 5250 |
// never create frames for non-option/optgroup kids of <select> and |
5267 |
// never create frames for non-option/optgroup kids of <select> and |
| 5251 |
// non-option kids of <optgroup> inside a <select>. |
5268 |
// non-option kids of <optgroup> inside a <select>. |
|
Lines 5360-5375
nsCSSFrameConstructor::AddFrameConstruct
|
Link Here
|
|---|
|
| 5360 |
!display->IsAbsolutelyPositionedStyle() && |
5377 |
!display->IsAbsolutelyPositionedStyle() && |
| 5361 |
!(bits & FCDATA_IS_TABLE_PART) && |
5378 |
!(bits & FCDATA_IS_TABLE_PART) && |
| 5362 |
!(bits & FCDATA_IS_SVG_TEXT); |
5379 |
!(bits & FCDATA_IS_SVG_TEXT); |
| 5363 |
|
5380 |
|
| 5364 |
if (canHavePageBreak && display->mBreakBefore) { |
5381 |
if (canHavePageBreak && display->mBreakBefore) { |
| 5365 |
AddPageBreakItem(aContent, aStyleContext, aItems); |
5382 |
AddPageBreakItem(aContent, aStyleContext, aItems); |
| 5366 |
} |
5383 |
} |
| 5367 |
|
5384 |
|
|
|
5385 |
if (MOZ_UNLIKELY(bits & FCDATA_IS_CONTENTS)) { |
| 5386 |
if (!GetDisplayBoxContentsStyleFor(aContent)) { |
| 5387 |
if (styleContext->GetPseudo()) { |
| 5388 |
if (isGeneratedContent) { |
| 5389 |
aContent->UnbindFromTree(); |
| 5390 |
} |
| 5391 |
} else { |
| 5392 |
MOZ_ASSERT(!isGeneratedContent, "Should have had pseudo type"); |
| 5393 |
aState.mFrameManager->SetDisplayBoxContents(aContent, styleContext); |
| 5394 |
} |
| 5395 |
} else { |
| 5396 |
aState.mFrameManager->ChangeDisplayBoxContents(aContent, styleContext); |
| 5397 |
} |
| 5398 |
|
| 5399 |
TreeMatchContext::AutoAncestorPusher ancestorPusher(aState.mTreeMatchContext); |
| 5400 |
if (aState.mTreeMatchContext.mAncestorFilter.HasFilter()) { |
| 5401 |
ancestorPusher.PushAncestorAndStyleScope(aContent->AsElement()); |
| 5402 |
} else { |
| 5403 |
ancestorPusher.PushStyleScope(aContent->AsElement()); |
| 5404 |
} |
| 5405 |
|
| 5406 |
if (aParentFrame) { |
| 5407 |
aParentFrame->AddStateBits(NS_FRAME_MAY_HAVE_GENERATED_CONTENT); |
| 5408 |
} |
| 5409 |
CreateGeneratedContentItem(aState, aParentFrame, aContent, styleContext, |
| 5410 |
nsCSSPseudoElements::ePseudo_before, aItems); |
| 5411 |
|
| 5412 |
FlattenedChildIterator iter(aContent); |
| 5413 |
for (nsIContent* child = iter.GetNextChild(); child; child = iter.GetNextChild()) { |
| 5414 |
nsRefPtr<nsStyleContext> childContext = |
| 5415 |
ResolveStyleContext(styleContext, child, nullptr); |
| 5416 |
AddFrameConstructionItemsInternal(aState, child, aParentFrame, |
| 5417 |
child->Tag(), child->GetNameSpaceID(), |
| 5418 |
aSuppressWhiteSpaceOptimizations, |
| 5419 |
childContext, aFlags, |
| 5420 |
aAnonChildren, aItems); |
| 5421 |
} |
| 5422 |
|
| 5423 |
CreateGeneratedContentItem(aState, aParentFrame, aContent, styleContext, |
| 5424 |
nsCSSPseudoElements::ePseudo_after, aItems); |
| 5425 |
if (canHavePageBreak && display->mBreakAfter) { |
| 5426 |
AddPageBreakItem(aContent, aStyleContext, aItems); |
| 5427 |
} |
| 5428 |
return; |
| 5429 |
} |
| 5430 |
|
| 5368 |
FrameConstructionItem* item = |
5431 |
FrameConstructionItem* item = |
| 5369 |
aItems.AppendItem(data, aContent, aTag, aNameSpaceID, |
5432 |
aItems.AppendItem(data, aContent, aTag, aNameSpaceID, |
| 5370 |
pendingBinding, styleContext.forget(), |
5433 |
pendingBinding, styleContext.forget(), |
| 5371 |
aSuppressWhiteSpaceOptimizations, aAnonChildren); |
5434 |
aSuppressWhiteSpaceOptimizations, aAnonChildren); |
| 5372 |
if (!item) { |
5435 |
if (!item) { |
| 5373 |
if (isGeneratedContent) { |
5436 |
if (isGeneratedContent) { |
| 5374 |
aContent->UnbindFromTree(); |
5437 |
aContent->UnbindFromTree(); |
| 5375 |
} |
5438 |
} |
|
Lines 5466-5499
nsCSSFrameConstructor::AddFrameConstruct
|
Link Here
|
|---|
|
| 5466 |
((bits & FCDATA_DISALLOW_OUT_OF_FLOW) || |
5529 |
((bits & FCDATA_DISALLOW_OUT_OF_FLOW) || |
| 5467 |
!aState.GetGeometricParent(display, nullptr))) { |
5530 |
!aState.GetGeometricParent(display, nullptr))) { |
| 5468 |
item->mIsLineParticipant = true; |
5531 |
item->mIsLineParticipant = true; |
| 5469 |
aItems.LineParticipantItemAdded(); |
5532 |
aItems.LineParticipantItemAdded(); |
| 5470 |
} |
5533 |
} |
| 5471 |
} |
5534 |
} |
| 5472 |
|
5535 |
|
| 5473 |
static void |
5536 |
static void |
| 5474 |
DestroyContent(void* aPropertyValue) |
5537 |
AddGenConPseudoToFrame(nsIFrame* aOwnerFrame, nsIAtom* aPseudo, |
|
|
5538 |
nsIContent* aContent) |
| 5475 |
{ |
5539 |
{ |
| 5476 |
nsIContent* content = static_cast<nsIContent*>(aPropertyValue); |
5540 |
typedef nsTArray<nsIContent*> T; |
| 5477 |
content->UnbindFromTree(); |
5541 |
const FramePropertyDescriptor* prop = nsIFrame::GenConProperty(); |
| 5478 |
NS_RELEASE(content); |
5542 |
FrameProperties props = aOwnerFrame->Properties(); |
|
|
5543 |
T* value = static_cast<T*>(props.Get(prop)); |
| 5544 |
if (!value) { |
| 5545 |
value = new T(2); |
| 5546 |
props.Set(prop, value); |
| 5479 |
} |
5547 |
} |
| 5480 |
|
5548 |
value->AppendElement(aContent); |
| 5481 |
NS_DECLARE_FRAME_PROPERTY(BeforeProperty, DestroyContent) |
|
|
| 5482 |
NS_DECLARE_FRAME_PROPERTY(AfterProperty, DestroyContent) |
| 5483 |
|
| 5484 |
static const FramePropertyDescriptor* |
| 5485 |
GenConPseudoToProperty(nsIAtom* aPseudo) |
| 5486 |
{ |
| 5487 |
NS_ASSERTION(aPseudo == nsCSSPseudoElements::before || |
| 5488 |
aPseudo == nsCSSPseudoElements::after, |
| 5489 |
"Bad gen-con pseudo"); |
| 5490 |
return aPseudo == nsCSSPseudoElements::before ? BeforeProperty() |
| 5491 |
: AfterProperty(); |
| 5492 |
} |
5549 |
} |
| 5493 |
|
5550 |
|
| 5494 |
/** |
5551 |
/** |
| 5495 |
* Return true if the frame construction item pointed to by aIter will |
5552 |
* Return true if the frame construction item pointed to by aIter will |
| 5496 |
* create a frame adjacent to a line boundary in the frame tree, and that |
5553 |
* create a frame adjacent to a line boundary in the frame tree, and that |
| 5497 |
* line boundary is induced by a content node adjacent to the frame's |
5554 |
* line boundary is induced by a content node adjacent to the frame's |
| 5498 |
* content node in the content tree. The latter condition is necessary so |
5555 |
* content node in the content tree. The latter condition is necessary so |
| 5499 |
* that ContentAppended/ContentInserted/ContentRemoved can easily find any |
5556 |
* that ContentAppended/ContentInserted/ContentRemoved can easily find any |
|
Lines 5590-5606
nsCSSFrameConstructor::ConstructFramesFr
|
Link Here
|
|---|
|
| 5590 |
// NS_FRAME_GENERATED_CONTENT. |
5647 |
// NS_FRAME_GENERATED_CONTENT. |
| 5591 |
aState.mAdditionalStateBits |= NS_FRAME_GENERATED_CONTENT; |
5648 |
aState.mAdditionalStateBits |= NS_FRAME_GENERATED_CONTENT; |
| 5592 |
|
5649 |
|
| 5593 |
// Note that we're not necessarily setting this property on the primary |
5650 |
// Note that we're not necessarily setting this property on the primary |
| 5594 |
// frame for the content for which this is generated content. We might be |
5651 |
// frame for the content for which this is generated content. We might be |
| 5595 |
// setting it on a table pseudo-frame inserted under that instead. That's |
5652 |
// setting it on a table pseudo-frame inserted under that instead. That's |
| 5596 |
// OK, though; we just need to do the property set so that the content will |
5653 |
// OK, though; we just need to do the property set so that the content will |
| 5597 |
// get cleaned up when the frame is destroyed. |
5654 |
// get cleaned up when the frame is destroyed. |
| 5598 |
aParentFrame->Properties().Set(GenConPseudoToProperty(styleContext->GetPseudo()), |
5655 |
::AddGenConPseudoToFrame(aParentFrame, styleContext->GetPseudo(), |
| 5599 |
item.mContent); |
5656 |
item.mContent); |
| 5600 |
|
5657 |
|
| 5601 |
// Now that we've passed ownership of item.mContent to the frame, unset |
5658 |
// Now that we've passed ownership of item.mContent to the frame, unset |
| 5602 |
// our generated content flag so we don't release or unbind it ourselves. |
5659 |
// our generated content flag so we don't release or unbind it ourselves. |
| 5603 |
item.mIsGeneratedContent = false; |
5660 |
item.mIsGeneratedContent = false; |
| 5604 |
} |
5661 |
} |
| 5605 |
|
5662 |
|
| 5606 |
// XXXbz maybe just inline ConstructFrameFromItemInternal here or something? |
5663 |
// XXXbz maybe just inline ConstructFrameFromItemInternal here or something? |
|
Lines 5623-5652
nsCSSFrameConstructor::ReconstructDocEle
|
Link Here
|
|---|
|
| 5623 |
if (!rootElement) { |
5680 |
if (!rootElement) { |
| 5624 |
/* nothing to do */ |
5681 |
/* nothing to do */ |
| 5625 |
return NS_OK; |
5682 |
return NS_OK; |
| 5626 |
} |
5683 |
} |
| 5627 |
return RecreateFramesForContent(rootElement, false); |
5684 |
return RecreateFramesForContent(rootElement, false); |
| 5628 |
} |
5685 |
} |
| 5629 |
|
5686 |
|
| 5630 |
nsIFrame* |
5687 |
nsIFrame* |
| 5631 |
nsCSSFrameConstructor::GetFrameFor(nsIContent* aContent) |
5688 |
nsCSSFrameConstructor::GetInsertionFrameFor(nsIContent* aContent) |
| 5632 |
{ |
5689 |
{ |
| 5633 |
// Get the primary frame associated with the content |
5690 |
// Get the primary frame associated with the content |
| 5634 |
nsIFrame* frame = aContent->GetPrimaryFrame(); |
5691 |
nsIFrame* frame = aContent->GetPrimaryFrame(); |
| 5635 |
|
5692 |
|
| 5636 |
if (!frame) |
5693 |
if (!frame) { |
|
|
5694 |
if (GetDisplayBoxContentsStyleFor(aContent)) { |
| 5695 |
nsIContent* parent = aContent->GetParent(); |
| 5696 |
frame = parent ? GetInsertionFrameFor(parent) : nullptr; |
| 5697 |
} |
| 5698 |
if (!frame) { |
| 5637 |
return nullptr; |
5699 |
return nullptr; |
| 5638 |
|
5700 |
} |
|
|
5701 |
} else { |
| 5639 |
// If the content of the frame is not the desired content then this is not |
5702 |
// If the content of the frame is not the desired content then this is not |
| 5640 |
// really a frame for the desired content. |
5703 |
// really a frame for the desired content. |
| 5641 |
// XXX This check is needed due to bug 135040. Remove it once that's fixed. |
5704 |
// XXX This check is needed due to bug 135040. Remove it once that's fixed. |
| 5642 |
if (frame->GetContent() != aContent) { |
5705 |
if (frame->GetContent() != aContent) { |
| 5643 |
return nullptr; |
5706 |
return nullptr; |
| 5644 |
} |
5707 |
} |
|
|
5708 |
} |
| 5645 |
|
5709 |
|
| 5646 |
nsIFrame* insertionFrame = frame->GetContentInsertionFrame(); |
5710 |
nsIFrame* insertionFrame = frame->GetContentInsertionFrame(); |
| 5647 |
|
5711 |
|
| 5648 |
NS_ASSERTION(insertionFrame == frame || !frame->IsLeaf(), |
5712 |
NS_ASSERTION(insertionFrame == frame || !frame->IsLeaf(), |
| 5649 |
"The insertion frame is the primary frame or the primary frame isn't a leaf"); |
5713 |
"The insertion frame is the primary frame or the primary frame isn't a leaf"); |
| 5650 |
|
5714 |
|
| 5651 |
return insertionFrame; |
5715 |
return insertionFrame; |
| 5652 |
} |
5716 |
} |
|
Lines 5743-5773
nsCSSFrameConstructor::GetFloatContainin
|
Link Here
|
|---|
|
| 5743 |
|
5807 |
|
| 5744 |
/** |
5808 |
/** |
| 5745 |
* This function will check whether aContainer has :after generated content. |
5809 |
* This function will check whether aContainer has :after generated content. |
| 5746 |
* If so, appending to it should actually insert. The return value is the |
5810 |
* If so, appending to it should actually insert. The return value is the |
| 5747 |
* parent to use for newly-appended content. *aAfterFrame points to the :after |
5811 |
* parent to use for newly-appended content. *aAfterFrame points to the :after |
| 5748 |
* frame before which appended content should go, if there is one. |
5812 |
* frame before which appended content should go, if there is one. |
| 5749 |
*/ |
5813 |
*/ |
| 5750 |
static nsIFrame* |
5814 |
static nsIFrame* |
| 5751 |
AdjustAppendParentForAfterContent(nsPresContext* aPresContext, |
5815 |
AdjustAppendParentForAfterContent(nsFrameManager* aFrameManager, |
| 5752 |
nsIContent* aContainer, |
5816 |
nsIContent* aContainer, |
| 5753 |
nsIFrame* aParentFrame, |
5817 |
nsIFrame* aParentFrame, |
|
|
5818 |
nsIContent* aChild, |
| 5754 |
nsIFrame** aAfterFrame) |
5819 |
nsIFrame** aAfterFrame) |
| 5755 |
{ |
5820 |
{ |
| 5756 |
// See if the parent has an :after pseudo-element. Check for the presence |
5821 |
// If the parent frame has any pseudo-elements or aContainer is a |
| 5757 |
// of style first, since nsLayoutUtils::GetAfterFrame is sorta expensive. |
5822 |
// display-box:contents node then we need to walk through the child |
| 5758 |
nsStyleContext* parentStyle = aParentFrame->StyleContext(); |
5823 |
// frames to find the first one that is either a ::after frame for an |
| 5759 |
if (nsLayoutUtils::HasPseudoStyle(aContainer, parentStyle, |
5824 |
// ancestor of aChild or a frame that is for a node later in the |
|
|
5825 |
// document than aChild and return that in aAfterFrame. |
| 5826 |
if (nsLayoutUtils::HasPseudoStyle(aContainer, aParentFrame->StyleContext(), |
| 5760 |
nsCSSPseudoElements::ePseudo_after, |
5827 |
nsCSSPseudoElements::ePseudo_after, |
| 5761 |
aPresContext)) { |
5828 |
aParentFrame->PresContext()) || |
| 5762 |
// Ensure that the :after frame is on the principal child list. |
5829 |
aParentFrame->GetGenConPseudos() || |
| 5763 |
aParentFrame->DrainSelfOverflowList(); |
5830 |
aFrameManager->GetDisplayBoxContentsStyleFor(aContainer)) { |
|
|
5831 |
nsIFrame* afterFrame = nullptr; |
| 5832 |
nsIFrame* parent = aParentFrame->LastContinuation(); |
| 5833 |
bool done = false; |
| 5834 |
while (!done && parent) { |
| 5835 |
// Ensure that all normal flow children are on the principal child list. |
| 5836 |
parent->DrainSelfOverflowList(); |
| 5837 |
|
| 5838 |
nsIFrame* child = parent->GetLastChild(nsIFrame::kPrincipalList); |
| 5839 |
if (child && child->IsPseudoFrame(aContainer) && |
| 5840 |
!child->IsGeneratedContentFrame()) { |
| 5841 |
// Drill down into non-generated pseudo frames of aContainer. |
| 5842 |
parent = nsLayoutUtils::LastContinuationWithChild(child); |
| 5843 |
continue; |
| 5844 |
} |
| 5764 |
|
5845 |
|
| 5765 |
nsIFrame* afterFrame = nsLayoutUtils::GetAfterFrame(aParentFrame); |
5846 |
for (; child; child = child->GetPrevSibling()) { |
|
|
5847 |
nsIContent* c = child->GetContent(); |
| 5848 |
if (child->IsGeneratedContentFrame()) { |
| 5849 |
nsIContent* p = c->GetParent(); |
| 5850 |
if (c->Tag() == nsGkAtoms::mozgeneratedcontentafter) { |
| 5851 |
if (!nsContentUtils::ContentIsDescendantOf(aChild, p) && |
| 5852 |
(!c->IsInAnonymousSubtree() || c->GetBindingParent() != aContainer) && |
| 5853 |
nsContentUtils::PositionIsBefore(p, aChild)) { |
| 5854 |
// ::after generated content for content earlier in the doc and not |
| 5855 |
// for an ancestor. |
| 5856 |
done = true; |
| 5857 |
break; |
| 5858 |
} |
| 5859 |
} else if (nsContentUtils::PositionIsBefore(p, aChild)) { |
| 5860 |
// Non-::after generated content for content earlier in the doc. |
| 5861 |
done = true; |
| 5862 |
break; |
| 5863 |
} |
| 5864 |
} else if (nsContentUtils::PositionIsBefore(c, aChild)) { |
| 5865 |
// Content is before aChild. |
| 5866 |
done = true; |
| 5867 |
break; |
| 5868 |
} |
| 5869 |
afterFrame = child; |
| 5870 |
} |
| 5871 |
|
| 5872 |
parent = parent->GetPrevContinuation(); |
| 5873 |
} |
| 5766 |
if (afterFrame) { |
5874 |
if (afterFrame) { |
| 5767 |
*aAfterFrame = afterFrame; |
5875 |
*aAfterFrame = afterFrame; |
| 5768 |
return afterFrame->GetParent(); |
5876 |
return afterFrame->GetParent(); |
| 5769 |
} |
5877 |
} |
| 5770 |
} |
5878 |
} |
| 5771 |
|
5879 |
|
| 5772 |
*aAfterFrame = nullptr; |
5880 |
*aAfterFrame = nullptr; |
| 5773 |
|
5881 |
|
|
Lines 5950-5974
nsCSSFrameConstructor::IsValidSibling(ns
|
Link Here
|
|---|
|
| 5950 |
(NS_STYLE_DISPLAY_TABLE_COLUMN == siblingDisplay) || |
6058 |
(NS_STYLE_DISPLAY_TABLE_COLUMN == siblingDisplay) || |
| 5951 |
(NS_STYLE_DISPLAY_TABLE_CAPTION == siblingDisplay) || |
6059 |
(NS_STYLE_DISPLAY_TABLE_CAPTION == siblingDisplay) || |
| 5952 |
(NS_STYLE_DISPLAY_TABLE_HEADER_GROUP == siblingDisplay) || |
6060 |
(NS_STYLE_DISPLAY_TABLE_HEADER_GROUP == siblingDisplay) || |
| 5953 |
(NS_STYLE_DISPLAY_TABLE_ROW_GROUP == siblingDisplay) || |
6061 |
(NS_STYLE_DISPLAY_TABLE_ROW_GROUP == siblingDisplay) || |
| 5954 |
(NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP == siblingDisplay) || |
6062 |
(NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP == siblingDisplay) || |
| 5955 |
nsGkAtoms::menuFrame == parentType) { |
6063 |
nsGkAtoms::menuFrame == parentType) { |
| 5956 |
// if we haven't already, construct a style context to find the display type of aContent |
6064 |
// if we haven't already, construct a style context to find the display type of aContent |
| 5957 |
if (UNSET_DISPLAY == aDisplay) { |
6065 |
if (UNSET_DISPLAY == aDisplay) { |
| 5958 |
nsRefPtr<nsStyleContext> styleContext; |
6066 |
nsIFrame* styleParent; |
| 5959 |
nsIFrame* styleParent = aSibling->GetParentStyleContextFrame(); |
6067 |
aSibling->GetParentStyleContext(&styleParent); |
|
|
6068 |
if (!styleParent) { |
| 6069 |
styleParent = aSibling->GetParent(); |
| 6070 |
} |
| 5960 |
if (!styleParent) { |
6071 |
if (!styleParent) { |
| 5961 |
NS_NOTREACHED("Shouldn't happen"); |
6072 |
NS_NOTREACHED("Shouldn't happen"); |
| 5962 |
return false; |
6073 |
return false; |
| 5963 |
} |
6074 |
} |
| 5964 |
// XXXbz when this code is killed, the state argument to |
6075 |
// XXXbz when this code is killed, the state argument to |
| 5965 |
// ResolveStyleContext can be made non-optional. |
6076 |
// ResolveStyleContext can be made non-optional. |
| 5966 |
styleContext = ResolveStyleContext(styleParent, aContent, nullptr); |
6077 |
nsRefPtr<nsStyleContext> styleContext = |
|
|
6078 |
ResolveStyleContext(styleParent, aContent, nullptr); |
| 5967 |
const nsStyleDisplay* display = styleContext->StyleDisplay(); |
6079 |
const nsStyleDisplay* display = styleContext->StyleDisplay(); |
| 5968 |
aDisplay = display->mDisplay; |
6080 |
aDisplay = display->mDisplay; |
| 5969 |
} |
6081 |
} |
| 5970 |
if (nsGkAtoms::menuFrame == parentType) { |
6082 |
if (nsGkAtoms::menuFrame == parentType) { |
| 5971 |
return |
6083 |
return |
| 5972 |
(NS_STYLE_DISPLAY_POPUP == aDisplay) == |
6084 |
(NS_STYLE_DISPLAY_POPUP == aDisplay) == |
| 5973 |
(NS_STYLE_DISPLAY_POPUP == siblingDisplay); |
6085 |
(NS_STYLE_DISPLAY_POPUP == siblingDisplay); |
| 5974 |
} |
6086 |
} |
|
Lines 6133-6149
nsCSSFrameConstructor::GetInsertionPrevS
|
Link Here
|
|---|
|
| 6133 |
*aIsAppend = false; |
6245 |
*aIsAppend = false; |
| 6134 |
|
6246 |
|
| 6135 |
// Find the frame that precedes the insertion point. Walk backwards |
6247 |
// Find the frame that precedes the insertion point. Walk backwards |
| 6136 |
// from the parent frame to get the parent content, because if an |
6248 |
// from the parent frame to get the parent content, because if an |
| 6137 |
// XBL insertion point is involved, we'll need to use _that_ to find |
6249 |
// XBL insertion point is involved, we'll need to use _that_ to find |
| 6138 |
// the preceding frame. |
6250 |
// the preceding frame. |
| 6139 |
|
6251 |
|
| 6140 |
NS_PRECONDITION(aParentFrame, "Must have parent frame to start with"); |
6252 |
NS_PRECONDITION(aParentFrame, "Must have parent frame to start with"); |
| 6141 |
nsIContent* container = aParentFrame->GetContent(); |
6253 |
const bool boxContents = GetDisplayBoxContentsStyleFor(aContainer); |
|
|
6254 |
nsIContent* container = boxContents ? aContainer : aParentFrame->GetContent(); |
| 6142 |
|
6255 |
|
| 6143 |
FlattenedChildIterator iter(container); |
6256 |
FlattenedChildIterator iter(container); |
| 6144 |
bool xblCase = iter.XBLInvolved() || container != aContainer; |
6257 |
bool xblCase = iter.XBLInvolved() || container != aContainer; |
| 6145 |
if (xblCase || !aChild->IsRootOfAnonymousSubtree()) { |
6258 |
if (xblCase || !aChild->IsRootOfAnonymousSubtree()) { |
| 6146 |
// The check for IsRootOfAnonymousSubtree() is because editor is |
6259 |
// The check for IsRootOfAnonymousSubtree() is because editor is |
| 6147 |
// severely broken and calls us directly for native anonymous |
6260 |
// severely broken and calls us directly for native anonymous |
| 6148 |
// nodes that it creates. |
6261 |
// nodes that it creates. |
| 6149 |
if (aStartSkipChild) { |
6262 |
if (aStartSkipChild) { |
|
Lines 6163-6191
nsCSSFrameConstructor::GetInsertionPrevS
|
Link Here
|
|---|
|
| 6163 |
uint8_t childDisplay = UNSET_DISPLAY; |
6276 |
uint8_t childDisplay = UNSET_DISPLAY; |
| 6164 |
nsIFrame* prevSibling = FindPreviousSibling(iter, childDisplay); |
6277 |
nsIFrame* prevSibling = FindPreviousSibling(iter, childDisplay); |
| 6165 |
|
6278 |
|
| 6166 |
// Now, find the geometric parent so that we can handle |
6279 |
// Now, find the geometric parent so that we can handle |
| 6167 |
// continuations properly. Use the prev sibling if we have it; |
6280 |
// continuations properly. Use the prev sibling if we have it; |
| 6168 |
// otherwise use the next sibling. |
6281 |
// otherwise use the next sibling. |
| 6169 |
if (prevSibling) { |
6282 |
if (prevSibling) { |
| 6170 |
aParentFrame = prevSibling->GetParent()->GetContentInsertionFrame(); |
6283 |
aParentFrame = prevSibling->GetParent()->GetContentInsertionFrame(); |
| 6171 |
} |
6284 |
} else { |
| 6172 |
else { |
|
|
| 6173 |
// If there is no previous sibling, then find the frame that follows |
6285 |
// If there is no previous sibling, then find the frame that follows |
| 6174 |
if (aEndSkipChild) { |
6286 |
if (aEndSkipChild) { |
| 6175 |
iter.Seek(aEndSkipChild); |
6287 |
iter.Seek(aEndSkipChild); |
| 6176 |
iter.GetPreviousChild(); |
6288 |
iter.GetPreviousChild(); |
| 6177 |
} |
6289 |
} |
| 6178 |
nsIFrame* nextSibling = FindNextSibling(iter, childDisplay); |
6290 |
nsIFrame* nextSibling = FindNextSibling(iter, childDisplay); |
| 6179 |
|
6291 |
if (boxContents) { |
| 6180 |
if (nextSibling) { |
6292 |
if (nextSibling) { |
| 6181 |
aParentFrame = nextSibling->GetParent()->GetContentInsertionFrame(); |
6293 |
aParentFrame = nextSibling->GetParent()->GetContentInsertionFrame(); |
|
|
6294 |
return nextSibling->GetPrevSibling(); |
| 6182 |
} |
6295 |
} |
| 6183 |
else { |
6296 |
return GetInsertionPrevSibling(aParentFrame, aContainer->GetParent(), |
|
|
6297 |
aContainer, aIsAppend, |
| 6298 |
aIsRangeInsertSafe, nullptr, nullptr); |
| 6299 |
} |
| 6300 |
if (nextSibling) { |
| 6301 |
aParentFrame = nextSibling->GetParent()->GetContentInsertionFrame(); |
| 6302 |
} else { |
| 6184 |
// No previous or next sibling, so treat this like an appended frame. |
6303 |
// No previous or next sibling, so treat this like an appended frame. |
| 6185 |
*aIsAppend = true; |
6304 |
*aIsAppend = true; |
| 6186 |
if (IsFramePartOfIBSplit(aParentFrame)) { |
6305 |
if (IsFramePartOfIBSplit(aParentFrame)) { |
| 6187 |
// Since we're appending, we'll walk to the last anonymous frame |
6306 |
// Since we're appending, we'll walk to the last anonymous frame |
| 6188 |
// that was created for the broken inline frame. But don't walk |
6307 |
// that was created for the broken inline frame. But don't walk |
| 6189 |
// to the trailing inline if it's empty; stop at the block. |
6308 |
// to the trailing inline if it's empty; stop at the block. |
| 6190 |
aParentFrame = GetLastIBSplitSibling(aParentFrame, false); |
6309 |
aParentFrame = GetLastIBSplitSibling(aParentFrame, false); |
| 6191 |
} |
6310 |
} |
|
Lines 6193-6211
nsCSSFrameConstructor::GetInsertionPrevS
|
Link Here
|
|---|
|
| 6193 |
// before the AdjustAppendParentForAfterContent call. |
6312 |
// before the AdjustAppendParentForAfterContent call. |
| 6194 |
aParentFrame = nsLayoutUtils::LastContinuationWithChild(aParentFrame); |
6313 |
aParentFrame = nsLayoutUtils::LastContinuationWithChild(aParentFrame); |
| 6195 |
// Deal with fieldsets |
6314 |
// Deal with fieldsets |
| 6196 |
aParentFrame = ::GetAdjustedParentFrame(aParentFrame, |
6315 |
aParentFrame = ::GetAdjustedParentFrame(aParentFrame, |
| 6197 |
aParentFrame->GetType(), |
6316 |
aParentFrame->GetType(), |
| 6198 |
aChild); |
6317 |
aChild); |
| 6199 |
nsIFrame* appendAfterFrame; |
6318 |
nsIFrame* appendAfterFrame; |
| 6200 |
aParentFrame = |
6319 |
aParentFrame = |
| 6201 |
::AdjustAppendParentForAfterContent(mPresShell->GetPresContext(), |
6320 |
::AdjustAppendParentForAfterContent(this, container, aParentFrame, |
| 6202 |
container, aParentFrame, |
6321 |
aChild, &appendAfterFrame); |
| 6203 |
&appendAfterFrame); |
|
|
| 6204 |
prevSibling = ::FindAppendPrevSibling(aParentFrame, appendAfterFrame); |
6322 |
prevSibling = ::FindAppendPrevSibling(aParentFrame, appendAfterFrame); |
| 6205 |
} |
6323 |
} |
| 6206 |
} |
6324 |
} |
| 6207 |
|
6325 |
|
| 6208 |
*aIsRangeInsertSafe = (childDisplay == UNSET_DISPLAY); |
6326 |
*aIsRangeInsertSafe = (childDisplay == UNSET_DISPLAY); |
| 6209 |
return prevSibling; |
6327 |
return prevSibling; |
| 6210 |
} |
6328 |
} |
| 6211 |
|
6329 |
|
|
Lines 6340-6355
nsCSSFrameConstructor::MaybeConstructLaz
|
Link Here
|
|---|
|
| 6340 |
} |
6458 |
} |
| 6341 |
if (!noPrimaryFrame && !content->GetPrimaryFrame()) { |
6459 |
if (!noPrimaryFrame && !content->GetPrimaryFrame()) { |
| 6342 |
noPrimaryFrame = true; |
6460 |
noPrimaryFrame = true; |
| 6343 |
} |
6461 |
} |
| 6344 |
if (!needsFrameBitSet && content->HasFlag(NODE_NEEDS_FRAME)) { |
6462 |
if (!needsFrameBitSet && content->HasFlag(NODE_NEEDS_FRAME)) { |
| 6345 |
needsFrameBitSet = true; |
6463 |
needsFrameBitSet = true; |
| 6346 |
} |
6464 |
} |
| 6347 |
#endif |
6465 |
#endif |
|
|
6466 |
// XXX no lazy frames for display-box:contents descendants yet (bug 979782). |
| 6467 |
if (GetDisplayBoxContentsStyleFor(content)) { |
| 6468 |
return false; |
| 6469 |
} |
| 6348 |
content->SetFlags(NODE_DESCENDANTS_NEED_FRAMES); |
6470 |
content->SetFlags(NODE_DESCENDANTS_NEED_FRAMES); |
| 6349 |
content = content->GetFlattenedTreeParent(); |
6471 |
content = content->GetFlattenedTreeParent(); |
| 6350 |
} |
6472 |
} |
| 6351 |
#ifdef DEBUG |
6473 |
#ifdef DEBUG |
| 6352 |
if (content && content->GetPrimaryFrame() && |
6474 |
if (content && content->GetPrimaryFrame() && |
| 6353 |
content->GetPrimaryFrame()->IsLeaf()) { |
6475 |
content->GetPrimaryFrame()->IsLeaf()) { |
| 6354 |
noPrimaryFrame = needsFrameBitSet = false; |
6476 |
noPrimaryFrame = needsFrameBitSet = false; |
| 6355 |
} |
6477 |
} |
|
|
| 6462 |
nsCSSFrameConstructor::IssueSingleInsertNofications(nsIContent* aContainer, |
6584 |
nsCSSFrameConstructor::IssueSingleInsertNofications(nsIContent* aContainer, |
| 6463 |
nsIContent* aStartChild, |
6585 |
nsIContent* aStartChild, |
| 6464 |
nsIContent* aEndChild, |
6586 |
nsIContent* aEndChild, |
| 6465 |
bool aAllowLazyConstruction) |
6587 |
bool aAllowLazyConstruction) |
| 6466 |
{ |
6588 |
{ |
| 6467 |
for (nsIContent* child = aStartChild; |
6589 |
for (nsIContent* child = aStartChild; |
| 6468 |
child != aEndChild; |
6590 |
child != aEndChild; |
| 6469 |
child = child->GetNextSibling()) { |
6591 |
child = child->GetNextSibling()) { |
| 6470 |
if ((child->GetPrimaryFrame() || |
6592 |
if ((child->GetPrimaryFrame() || GetUndisplayedContent(child) || |
| 6471 |
GetUndisplayedContent(child)) |
6593 |
GetDisplayBoxContentsStyleFor(child)) |
| 6472 |
#ifdef MOZ_XUL |
6594 |
#ifdef MOZ_XUL |
| 6473 |
// Except listboxes suck, so do NOT skip anything here if |
6595 |
// Except listboxes suck, so do NOT skip anything here if |
| 6474 |
// we plan to notify a listbox. |
6596 |
// we plan to notify a listbox. |
| 6475 |
&& !MaybeGetListBoxBodyFrame(aContainer, child) |
6597 |
&& !MaybeGetListBoxBodyFrame(aContainer, child) |
| 6476 |
#endif |
6598 |
#endif |
| 6477 |
) { |
6599 |
) { |
| 6478 |
// Already have a frame or undisplayed entry for this content; a |
6600 |
// Already have a frame or undisplayed entry for this content; a |
| 6479 |
// previous ContentInserted in this loop must have reconstructed |
6601 |
// previous ContentInserted in this loop must have reconstructed |
|
Lines 6622-6638
nsCSSFrameConstructor::ContentAppended(n
|
Link Here
|
|---|
|
| 6622 |
nsIContent* bindingParent = aContainer->GetBindingParent(); |
6744 |
nsIContent* bindingParent = aContainer->GetBindingParent(); |
| 6623 |
LAYOUT_PHASE_TEMP_EXIT(); |
6745 |
LAYOUT_PHASE_TEMP_EXIT(); |
| 6624 |
nsresult rv = RecreateFramesForContent(bindingParent, false); |
6746 |
nsresult rv = RecreateFramesForContent(bindingParent, false); |
| 6625 |
LAYOUT_PHASE_TEMP_REENTER(); |
6747 |
LAYOUT_PHASE_TEMP_REENTER(); |
| 6626 |
return rv; |
6748 |
return rv; |
| 6627 |
} |
6749 |
} |
| 6628 |
|
6750 |
|
| 6629 |
// Get the frame associated with the content |
6751 |
// Get the frame associated with the content |
| 6630 |
nsIFrame* parentFrame = GetFrameFor(aContainer); |
6752 |
nsIFrame* parentFrame = GetInsertionFrameFor(aContainer); |
| 6631 |
|
6753 |
|
| 6632 |
// See comment in ContentRangeInserted for why this is necessary. |
6754 |
// See comment in ContentRangeInserted for why this is necessary. |
| 6633 |
if (!parentFrame && !aContainer->IsActiveChildrenElement()) { |
6755 |
if (!parentFrame && !aContainer->IsActiveChildrenElement()) { |
| 6634 |
return NS_OK; |
6756 |
return NS_OK; |
| 6635 |
} |
6757 |
} |
| 6636 |
|
6758 |
|
| 6637 |
if (aAllowLazyConstruction && |
6759 |
if (aAllowLazyConstruction && |
| 6638 |
MaybeConstructLazily(CONTENTAPPEND, aContainer, aFirstNewContent)) { |
6760 |
MaybeConstructLazily(CONTENTAPPEND, aContainer, aFirstNewContent)) { |
|
Lines 6695-6713
nsCSSFrameConstructor::ContentAppended(n
|
Link Here
|
|---|
|
| 6695 |
// We should never get here with fieldsets, since they have multiple |
6817 |
// We should never get here with fieldsets, since they have multiple |
| 6696 |
// insertion points. |
6818 |
// insertion points. |
| 6697 |
NS_ASSERTION(parentFrame->GetType() != nsGkAtoms::fieldSetFrame, |
6819 |
NS_ASSERTION(parentFrame->GetType() != nsGkAtoms::fieldSetFrame, |
| 6698 |
"Unexpected parent"); |
6820 |
"Unexpected parent"); |
| 6699 |
|
6821 |
|
| 6700 |
// Deal with possible :after generated content on the parent |
6822 |
// Deal with possible :after generated content on the parent |
| 6701 |
nsIFrame* parentAfterFrame; |
6823 |
nsIFrame* parentAfterFrame; |
| 6702 |
parentFrame = |
6824 |
parentFrame = |
| 6703 |
::AdjustAppendParentForAfterContent(mPresShell->GetPresContext(), |
6825 |
::AdjustAppendParentForAfterContent(this, aContainer, parentFrame, |
| 6704 |
aContainer, parentFrame, |
6826 |
aFirstNewContent, &parentAfterFrame); |
| 6705 |
&parentAfterFrame); |
|
|
| 6706 |
|
6827 |
|
| 6707 |
// Create some new frames |
6828 |
// Create some new frames |
| 6708 |
nsFrameConstructorState state(mPresShell, |
6829 |
nsFrameConstructorState state(mPresShell, |
| 6709 |
GetAbsoluteContainingBlock(parentFrame, FIXED_POS), |
6830 |
GetAbsoluteContainingBlock(parentFrame, FIXED_POS), |
| 6710 |
GetAbsoluteContainingBlock(parentFrame, ABS_POS), |
6831 |
GetAbsoluteContainingBlock(parentFrame, ABS_POS), |
| 6711 |
GetFloatContainingBlock(parentFrame)); |
6832 |
GetFloatContainingBlock(parentFrame)); |
| 6712 |
state.mTreeMatchContext.InitAncestors(aContainer->AsElement()); |
6833 |
state.mTreeMatchContext.InitAncestors(aContainer->AsElement()); |
| 6713 |
|
6834 |
|
|
Lines 7055-7080
nsCSSFrameConstructor::ContentRangeInser
|
Link Here
|
|---|
|
| 7055 |
// the children of the host. |
7176 |
// the children of the host. |
| 7056 |
nsIContent* bindingParent = aContainer->GetBindingParent(); |
7177 |
nsIContent* bindingParent = aContainer->GetBindingParent(); |
| 7057 |
LAYOUT_PHASE_TEMP_EXIT(); |
7178 |
LAYOUT_PHASE_TEMP_EXIT(); |
| 7058 |
nsresult rv = RecreateFramesForContent(bindingParent, false); |
7179 |
nsresult rv = RecreateFramesForContent(bindingParent, false); |
| 7059 |
LAYOUT_PHASE_TEMP_REENTER(); |
7180 |
LAYOUT_PHASE_TEMP_REENTER(); |
| 7060 |
return rv; |
7181 |
return rv; |
| 7061 |
} |
7182 |
} |
| 7062 |
|
7183 |
|
| 7063 |
nsIFrame* parentFrame = GetFrameFor(aContainer); |
7184 |
nsIFrame* parentFrame = GetInsertionFrameFor(aContainer); |
| 7064 |
// The xbl:children element won't have a frame, but default content can have the children as |
7185 |
// The xbl:children element won't have a frame, but default content can have the children as |
| 7065 |
// a parent. While its uncommon to change the structure of the default content itself, a label, |
7186 |
// a parent. While its uncommon to change the structure of the default content itself, a label, |
| 7066 |
// for example, can be reframed by having its value attribute set or removed. |
7187 |
// for example, can be reframed by having its value attribute set or removed. |
| 7067 |
if (!parentFrame && !aContainer->IsActiveChildrenElement()) { |
7188 |
if (!parentFrame && !aContainer->IsActiveChildrenElement()) { |
| 7068 |
return NS_OK; |
7189 |
return NS_OK; |
| 7069 |
} |
7190 |
} |
| 7070 |
|
7191 |
|
| 7071 |
// Otherwise, we've got parent content. Find its frame. |
7192 |
// Otherwise, we've got parent content. Find its frame. |
| 7072 |
NS_ASSERTION(!parentFrame || parentFrame->GetContent() == aContainer, "New XBL code is possibly wrong!"); |
7193 |
NS_ASSERTION(!parentFrame || parentFrame->GetContent() == aContainer || |
|
|
7194 |
GetDisplayBoxContentsStyleFor(aContainer), "New XBL code is possibly wrong!"); |
| 7073 |
|
7195 |
|
| 7074 |
if (aAllowLazyConstruction && |
7196 |
if (aAllowLazyConstruction && |
| 7075 |
MaybeConstructLazily(CONTENTINSERT, aContainer, aStartChild)) { |
7197 |
MaybeConstructLazily(CONTENTINSERT, aContainer, aStartChild)) { |
| 7076 |
return NS_OK; |
7198 |
return NS_OK; |
| 7077 |
} |
7199 |
} |
| 7078 |
|
7200 |
|
| 7079 |
if (isSingleInsert) { |
7201 |
if (isSingleInsert) { |
| 7080 |
// See if we have an XBL insertion point. If so, then that's our |
7202 |
// See if we have an XBL insertion point. If so, then that's our |
|
Lines 7351-7370
nsCSSFrameConstructor::ContentRangeInser
|
Link Here
|
|---|
|
| 7351 |
frame1->GetType() == nsGkAtoms::fieldSetFrame || |
7473 |
frame1->GetType() == nsGkAtoms::fieldSetFrame || |
| 7352 |
(frame1->GetParent() && |
7474 |
(frame1->GetParent() && |
| 7353 |
frame1->GetParent()->GetType() == nsGkAtoms::fieldSetFrame), |
7475 |
frame1->GetParent()->GetType() == nsGkAtoms::fieldSetFrame), |
| 7354 |
"Unexpected frame types"); |
7476 |
"Unexpected frame types"); |
| 7355 |
#endif |
7477 |
#endif |
| 7356 |
isAppend = true; |
7478 |
isAppend = true; |
| 7357 |
nsIFrame* appendAfterFrame; |
7479 |
nsIFrame* appendAfterFrame; |
| 7358 |
parentFrame = |
7480 |
parentFrame = |
| 7359 |
::AdjustAppendParentForAfterContent(mPresShell->GetPresContext(), |
7481 |
::AdjustAppendParentForAfterContent(this, container, |
| 7360 |
container, |
|
|
| 7361 |
frameItems.FirstChild()->GetParent(), |
7482 |
frameItems.FirstChild()->GetParent(), |
| 7362 |
&appendAfterFrame); |
7483 |
aStartChild, &appendAfterFrame); |
| 7363 |
prevSibling = ::FindAppendPrevSibling(parentFrame, appendAfterFrame); |
7484 |
prevSibling = ::FindAppendPrevSibling(parentFrame, appendAfterFrame); |
| 7364 |
} |
7485 |
} |
| 7365 |
|
7486 |
|
| 7366 |
if (haveFirstLineStyle && parentFrame == containingBlock) { |
7487 |
if (haveFirstLineStyle && parentFrame == containingBlock) { |
| 7367 |
// It's possible that the new frame goes into a first-line |
7488 |
// It's possible that the new frame goes into a first-line |
| 7368 |
// frame. Look at it and see... |
7489 |
// frame. Look at it and see... |
| 7369 |
if (isAppend) { |
7490 |
if (isAppend) { |
| 7370 |
// Use append logic when appending |
7491 |
// Use append logic when appending |
|
Lines 7494-7521
nsCSSFrameConstructor::ContentRemoved(ns
|
Link Here
|
|---|
|
| 7494 |
static_cast<void*>(aChild), |
7615 |
static_cast<void*>(aChild), |
| 7495 |
static_cast<void*>(aOldNextSibling)); |
7616 |
static_cast<void*>(aOldNextSibling)); |
| 7496 |
if (gReallyNoisyContentUpdates) { |
7617 |
if (gReallyNoisyContentUpdates) { |
| 7497 |
aContainer->List(stdout, 0); |
7618 |
aContainer->List(stdout, 0); |
| 7498 |
} |
7619 |
} |
| 7499 |
} |
7620 |
} |
| 7500 |
#endif |
7621 |
#endif |
| 7501 |
|
7622 |
|
| 7502 |
nsPresContext *presContext = mPresShell->GetPresContext(); |
|
|
| 7503 |
nsresult rv = NS_OK; |
7623 |
nsresult rv = NS_OK; |
| 7504 |
|
|
|
| 7505 |
// Find the child frame that maps the content |
| 7506 |
nsIFrame* childFrame = aChild->GetPrimaryFrame(); |
7624 |
nsIFrame* childFrame = aChild->GetPrimaryFrame(); |
| 7507 |
|
|
|
| 7508 |
if (!childFrame || childFrame->GetContent() != aChild) { |
7625 |
if (!childFrame || childFrame->GetContent() != aChild) { |
| 7509 |
// XXXbz the GetContent() != aChild check is needed due to bug 135040. |
7626 |
// XXXbz the GetContent() != aChild check is needed due to bug 135040. |
| 7510 |
// Remove it once that's fixed. |
7627 |
// Remove it once that's fixed. |
| 7511 |
ClearUndisplayedContentIn(aChild, aContainer); |
7628 |
ClearUndisplayedContentIn(aChild, aContainer); |
| 7512 |
} |
7629 |
} |
|
|
7630 |
MOZ_ASSERT(!childFrame || !GetDisplayBoxContentsStyleFor(aChild), |
| 7631 |
"display-box:contents nodes shouldn't have a frame"); |
| 7632 |
if (!childFrame && GetDisplayBoxContentsStyleFor(aChild)) { |
| 7633 |
nsIFrame* ancestorFrame = nullptr; |
| 7634 |
for (nsIContent* p = aContainer; p && !ancestorFrame; p = p->GetParent()) { |
| 7635 |
ancestorFrame = p->GetPrimaryFrame(); |
| 7636 |
} |
| 7637 |
if (ancestorFrame) { |
| 7638 |
nsTArray<nsIContent*>* generated = ancestorFrame->GetGenConPseudos(); |
| 7639 |
if (generated) { |
| 7640 |
LAYOUT_PHASE_TEMP_EXIT(); |
| 7641 |
// XXXmats Can we recreate frames only for the ::after/::before content? |
| 7642 |
// XXX Perhaps even only those that belong to the aChild sub-tree? |
| 7643 |
RecreateFramesForContent(ancestorFrame->GetContent(), false); |
| 7644 |
LAYOUT_PHASE_TEMP_REENTER(); |
| 7645 |
*aDidReconstruct = true; |
| 7646 |
return NS_OK; |
| 7647 |
} |
| 7648 |
} |
| 7649 |
|
| 7650 |
FlattenedChildIterator iter(aChild); |
| 7651 |
for (nsIContent* c = iter.GetNextChild(); c; c = iter.GetNextChild()) { |
| 7652 |
if (c->GetPrimaryFrame() || GetDisplayBoxContentsStyleFor(c)) { |
| 7653 |
LAYOUT_PHASE_TEMP_EXIT(); |
| 7654 |
rv = ContentRemoved(aChild, c, nullptr, aFlags, aDidReconstruct); |
| 7655 |
LAYOUT_PHASE_TEMP_REENTER(); |
| 7656 |
NS_ENSURE_SUCCESS(rv, rv); |
| 7657 |
if (*aDidReconstruct) { |
| 7658 |
return rv; |
| 7659 |
} |
| 7660 |
} |
| 7661 |
} |
| 7662 |
ClearDisplayBoxContentsIn(aChild, aContainer); |
| 7663 |
} |
| 7513 |
|
7664 |
|
|
|
7665 |
nsPresContext* presContext = mPresShell->GetPresContext(); |
| 7514 |
#ifdef MOZ_XUL |
7666 |
#ifdef MOZ_XUL |
| 7515 |
if (NotifyListBoxBody(presContext, aContainer, aChild, aOldNextSibling, |
7667 |
if (NotifyListBoxBody(presContext, aContainer, aChild, aOldNextSibling, |
| 7516 |
mDocument, childFrame, CONTENT_REMOVED)) |
7668 |
mDocument, childFrame, CONTENT_REMOVED)) |
| 7517 |
return NS_OK; |
7669 |
return NS_OK; |
| 7518 |
|
7670 |
|
| 7519 |
#endif // MOZ_XUL |
7671 |
#endif // MOZ_XUL |
| 7520 |
|
7672 |
|
| 7521 |
// If we're removing the root, then make sure to remove things starting at |
7673 |
// If we're removing the root, then make sure to remove things starting at |
|
Lines 8329-8345
nsCSSFrameConstructor::GetInsertionPoint
|
Link Here
|
|---|
|
| 8329 |
|
8481 |
|
| 8330 |
nsIContent* insertionElement; |
8482 |
nsIContent* insertionElement; |
| 8331 |
if (aChildContent) { |
8483 |
if (aChildContent) { |
| 8332 |
// We've got an explicit insertion child. Check to see if it's |
8484 |
// We've got an explicit insertion child. Check to see if it's |
| 8333 |
// anonymous. |
8485 |
// anonymous. |
| 8334 |
if (aChildContent->GetBindingParent() == aContainer) { |
8486 |
if (aChildContent->GetBindingParent() == aContainer) { |
| 8335 |
// This child content is anonymous. Don't use the insertion |
8487 |
// This child content is anonymous. Don't use the insertion |
| 8336 |
// point, since that's only for the explicit kids. |
8488 |
// point, since that's only for the explicit kids. |
| 8337 |
return GetFrameFor(aContainer); |
8489 |
return GetInsertionFrameFor(aContainer); |
| 8338 |
} |
8490 |
} |
| 8339 |
|
8491 |
|
| 8340 |
insertionElement = bindingManager->FindNestedInsertionPoint(aContainer, aChildContent); |
8492 |
insertionElement = bindingManager->FindNestedInsertionPoint(aContainer, aChildContent); |
| 8341 |
} |
8493 |
} |
| 8342 |
else { |
8494 |
else { |
| 8343 |
bool multiple; |
8495 |
bool multiple; |
| 8344 |
insertionElement = bindingManager->FindNestedSingleInsertionPoint(aContainer, &multiple); |
8496 |
insertionElement = bindingManager->FindNestedSingleInsertionPoint(aContainer, &multiple); |
| 8345 |
|
8497 |
|
|
Lines 8350-8366
nsCSSFrameConstructor::GetInsertionPoint
|
Link Here
|
|---|
|
| 8350 |
return nullptr; |
8502 |
return nullptr; |
| 8351 |
} |
8503 |
} |
| 8352 |
} |
8504 |
} |
| 8353 |
|
8505 |
|
| 8354 |
if (!insertionElement) { |
8506 |
if (!insertionElement) { |
| 8355 |
insertionElement = aContainer; |
8507 |
insertionElement = aContainer; |
| 8356 |
} |
8508 |
} |
| 8357 |
|
8509 |
|
| 8358 |
nsIFrame* insertionPoint = GetFrameFor(insertionElement); |
8510 |
nsIFrame* insertionPoint = GetInsertionFrameFor(insertionElement); |
| 8359 |
|
8511 |
|
| 8360 |
// fieldsets have multiple insertion points. Note that we might |
8512 |
// fieldsets have multiple insertion points. Note that we might |
| 8361 |
// have to look at insertionElement here... |
8513 |
// have to look at insertionElement here... |
| 8362 |
if (aMultiple && insertionElement->IsHTML(nsGkAtoms::fieldset)) { |
8514 |
if (aMultiple && insertionElement->IsHTML(nsGkAtoms::fieldset)) { |
| 8363 |
*aMultiple = true; |
8515 |
*aMultiple = true; |
| 8364 |
} |
8516 |
} |
| 8365 |
|
8517 |
|
| 8366 |
return insertionPoint; |
8518 |
return insertionPoint; |
|
Lines 8387-8431
nsCSSFrameConstructor::CaptureStateForFr
|
Link Here
|
|---|
|
| 8387 |
|
8539 |
|
| 8388 |
static bool EqualURIs(mozilla::css::URLValue *aURI1, |
8540 |
static bool EqualURIs(mozilla::css::URLValue *aURI1, |
| 8389 |
mozilla::css::URLValue *aURI2) |
8541 |
mozilla::css::URLValue *aURI2) |
| 8390 |
{ |
8542 |
{ |
| 8391 |
return aURI1 == aURI2 || // handle null==null, and optimize |
8543 |
return aURI1 == aURI2 || // handle null==null, and optimize |
| 8392 |
(aURI1 && aURI2 && aURI1->URIEquals(*aURI2)); |
8544 |
(aURI1 && aURI2 && aURI1->URIEquals(*aURI2)); |
| 8393 |
} |
8545 |
} |
| 8394 |
|
8546 |
|
| 8395 |
nsresult |
8547 |
nsStyleContext* |
| 8396 |
nsCSSFrameConstructor::MaybeRecreateFramesForElement(Element* aElement) |
8548 |
nsCSSFrameConstructor::MaybeRecreateFramesForElement(Element* aElement) |
| 8397 |
{ |
8549 |
{ |
| 8398 |
nsRefPtr<nsStyleContext> oldContext = GetUndisplayedContent(aElement); |
8550 |
nsRefPtr<nsStyleContext> oldContext = GetUndisplayedContent(aElement); |
|
|
8551 |
uint8_t oldDisplayBoxStyle = NS_STYLE_DISPLAY_BOX_NONE; |
| 8399 |
if (!oldContext) { |
8552 |
if (!oldContext) { |
| 8400 |
return NS_OK; |
8553 |
oldContext = GetDisplayBoxContentsStyleFor(aElement); |
|
|
8554 |
if (!oldContext) { |
| 8555 |
return nullptr; |
| 8556 |
} |
| 8557 |
oldDisplayBoxStyle = NS_STYLE_DISPLAY_BOX_CONTENTS; |
| 8401 |
} |
8558 |
} |
| 8402 |
|
8559 |
|
| 8403 |
// The parent has a frame, so try resolving a new context. |
8560 |
// The parent has a frame, so try resolving a new context. |
| 8404 |
nsRefPtr<nsStyleContext> newContext = mPresShell->StyleSet()-> |
8561 |
nsRefPtr<nsStyleContext> newContext = mPresShell->StyleSet()-> |
| 8405 |
ResolveStyleFor(aElement, oldContext->GetParent()); |
8562 |
ResolveStyleFor(aElement, oldContext->GetParent()); |
| 8406 |
|
8563 |
|
|
|
8564 |
if (oldDisplayBoxStyle == NS_STYLE_DISPLAY_BOX_NONE) { |
| 8407 |
ChangeUndisplayedContent(aElement, newContext); |
8565 |
ChangeUndisplayedContent(aElement, newContext); |
|
|
8566 |
} else { |
| 8567 |
ChangeDisplayBoxContents(aElement, newContext); |
| 8568 |
} |
| 8569 |
|
| 8408 |
const nsStyleDisplay* disp = newContext->StyleDisplay(); |
8570 |
const nsStyleDisplay* disp = newContext->StyleDisplay(); |
| 8409 |
if (disp->mDisplay == NS_STYLE_DISPLAY_NONE) { |
8571 |
if (oldDisplayBoxStyle == disp->mDisplayBox) { |
| 8410 |
// We can skip trying to recreate frames here, but only if our style |
8572 |
// We can skip trying to recreate frames here, but only if our style |
| 8411 |
// context does not have a binding URI that differs from our old one. |
8573 |
// context does not have a binding URI that differs from our old one. |
| 8412 |
// Otherwise, we should try to recreate, because we may want to apply the |
8574 |
// Otherwise, we should try to recreate, because we may want to apply the |
| 8413 |
// new binding |
8575 |
// new binding |
| 8414 |
if (!disp->mBinding) { |
8576 |
if (!disp->mBinding) { |
| 8415 |
return NS_OK; |
8577 |
return newContext; |
| 8416 |
} |
8578 |
} |
| 8417 |
const nsStyleDisplay* oldDisp = oldContext->PeekStyleDisplay(); |
8579 |
const nsStyleDisplay* oldDisp = oldContext->PeekStyleDisplay(); |
| 8418 |
if (oldDisp && EqualURIs(disp->mBinding, oldDisp->mBinding)) { |
8580 |
if (oldDisp && EqualURIs(disp->mBinding, oldDisp->mBinding)) { |
| 8419 |
return NS_OK; |
8581 |
return newContext; |
| 8420 |
} |
8582 |
} |
| 8421 |
} |
8583 |
} |
| 8422 |
|
8584 |
|
| 8423 |
return RecreateFramesForContent(aElement, false); |
8585 |
RecreateFramesForContent(aElement, false); |
|
|
8586 |
return nullptr; |
| 8424 |
} |
8587 |
} |
| 8425 |
|
8588 |
|
| 8426 |
static nsIFrame* |
8589 |
static nsIFrame* |
| 8427 |
FindFirstNonWhitespaceChild(nsIFrame* aParentFrame) |
8590 |
FindFirstNonWhitespaceChild(nsIFrame* aParentFrame) |
| 8428 |
{ |
8591 |
{ |
| 8429 |
nsIFrame* f = aParentFrame->GetFirstPrincipalChild(); |
8592 |
nsIFrame* f = aParentFrame->GetFirstPrincipalChild(); |
| 8430 |
while (f && f->GetType() == nsGkAtoms::textFrame && |
8593 |
while (f && f->GetType() == nsGkAtoms::textFrame && |
| 8431 |
f->GetContent()->TextIsOnlyWhitespace()) { |
8594 |
f->GetContent()->TextIsOnlyWhitespace()) { |
|
Lines 10306-10326
nsCSSFrameConstructor::CreateListBoxCont
|
Link Here
|
|---|
|
| 10306 |
mTempFrameTreeState); |
10469 |
mTempFrameTreeState); |
| 10307 |
|
10470 |
|
| 10308 |
// If we ever initialize the ancestor filter on |state|, make sure |
10471 |
// If we ever initialize the ancestor filter on |state|, make sure |
| 10309 |
// to push the right parent! |
10472 |
// to push the right parent! |
| 10310 |
|
10473 |
|
| 10311 |
nsRefPtr<nsStyleContext> styleContext; |
10474 |
nsRefPtr<nsStyleContext> styleContext; |
| 10312 |
styleContext = ResolveStyleContext(aParentFrame, aChild, &state); |
10475 |
styleContext = ResolveStyleContext(aParentFrame, aChild, &state); |
| 10313 |
|
10476 |
|
| 10314 |
// Pre-check for display "none" - only if we find that, do we create |
10477 |
// Pre-check for display-box:none - if we find that, don't create any frame at all. |
| 10315 |
// any frame at all |
|
|
| 10316 |
const nsStyleDisplay* display = styleContext->StyleDisplay(); |
10478 |
const nsStyleDisplay* display = styleContext->StyleDisplay(); |
| 10317 |
|
10479 |
if (NS_STYLE_DISPLAY_BOX_NONE == display->mDisplayBox) { |
| 10318 |
if (NS_STYLE_DISPLAY_NONE == display->mDisplay) { |
|
|
| 10319 |
*aNewFrame = nullptr; |
10480 |
*aNewFrame = nullptr; |
| 10320 |
return NS_OK; |
10481 |
return NS_OK; |
| 10321 |
} |
10482 |
} |
| 10322 |
|
10483 |
|
| 10323 |
BeginUpdate(); |
10484 |
BeginUpdate(); |
| 10324 |
|
10485 |
|
| 10325 |
FrameConstructionItemList items; |
10486 |
FrameConstructionItemList items; |
| 10326 |
AddFrameConstructionItemsInternal(state, aChild, aParentFrame, |
10487 |
AddFrameConstructionItemsInternal(state, aChild, aParentFrame, |