Simplify handling of {ib} splits. Bug 390425, r+sr=roc, a=dbaron

This commit is contained in:
bzbarsky@mit.edu 2007-08-10 13:02:11 -07:00
Родитель da26ffbd92
Коммит f8925181f0
54 изменённых файлов: 1307 добавлений и 314 удалений

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

@ -451,23 +451,22 @@ IsFrameSpecial(nsIFrame* aFrame)
return (aFrame->GetStateBits() & NS_FRAME_IS_SPECIAL) != 0; return (aFrame->GetStateBits() & NS_FRAME_IS_SPECIAL) != 0;
} }
static void static nsIFrame* GetSpecialSibling(nsIFrame* aFrame)
GetSpecialSibling(nsFrameManager* aFrameManager, nsIFrame* aFrame, nsIFrame** aResult)
{ {
// We only store the "special sibling" annotation with the first // We only store the "special sibling" annotation with the first
// frame in the flow. Walk back to find that frame now. // frame in the continuation chain. Walk back to find that frame now.
aFrame = aFrame->GetFirstInFlow(); aFrame = aFrame->GetFirstContinuation();
void* value = aFrame->GetProperty(nsGkAtoms::IBSplitSpecialSibling); void* value = aFrame->GetProperty(nsGkAtoms::IBSplitSpecialSibling);
*aResult = static_cast<nsIFrame*>(value); return static_cast<nsIFrame*>(value);
} }
static nsIFrame* static nsIFrame*
GetLastSpecialSibling(nsFrameManager* aFrameManager, nsIFrame* aFrame) GetLastSpecialSibling(nsIFrame* aFrame)
{ {
for (nsIFrame *frame = aFrame, *next; ; frame = next) { for (nsIFrame *frame = aFrame, *next; ; frame = next) {
GetSpecialSibling(aFrameManager, frame, &next); next = GetSpecialSibling(frame);
if (!next) if (!next)
return frame; return frame;
} }
@ -537,10 +536,18 @@ IsInlineOutside(nsIFrame* aFrame)
return aFrame->GetStyleDisplay()->IsInlineOutside(); return aFrame->GetStyleDisplay()->IsInlineOutside();
} }
/**
* True if aFrame is an actual inline frame in the sense of non-replaced
* display:inline CSS boxes. In other words, it can be affected by {ib}
* splitting and can contain first-letter frames. Basically, this is either an
* inline frame (positioned or otherwise) or an line frame (this last because
* it can contain first-letter and because inserting blocks in the middle of it
* needs to terminate it).
*/
static PRBool static PRBool
IsBlockOutside(nsIFrame* aFrame) IsInlineFrame(const nsIFrame* aFrame)
{ {
return aFrame->GetStyleDisplay()->IsBlockOutside(); return aFrame->IsFrameOfType(nsIFrame::eLineParticipant);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1416,7 +1423,7 @@ nsFrameConstructorState::AddChild(nsIFrame* aNewFrame,
// Now add the special siblings too. // Now add the special siblings too.
nsIFrame* specialSibling = aNewFrame; nsIFrame* specialSibling = aNewFrame;
while (specialSibling && IsFrameSpecial(specialSibling)) { while (specialSibling && IsFrameSpecial(specialSibling)) {
GetSpecialSibling(mFrameManager, specialSibling, &specialSibling); specialSibling = GetSpecialSibling(specialSibling);
if (specialSibling) { if (specialSibling) {
NS_ASSERTION(frameItems == &aFrameItems, NS_ASSERTION(frameItems == &aFrameItems,
"IB split ending up in an out-of-flow childlist?"); "IB split ending up in an out-of-flow childlist?");
@ -7958,8 +7965,7 @@ FindPreviousAnonymousSibling(nsIPresShell* aPresShell,
// The frame may be a special frame (a split inline frame that // The frame may be a special frame (a split inline frame that
// contains a block). Get the last part of that split. // contains a block). Get the last part of that split.
if (IsFrameSpecial(prevSibling)) { if (IsFrameSpecial(prevSibling)) {
prevSibling = GetLastSpecialSibling(aPresShell->FrameManager(), prevSibling = GetLastSpecialSibling(prevSibling);
prevSibling);
} }
// The frame may have a continuation. If so, we want the // The frame may have a continuation. If so, we want the
@ -8144,8 +8150,7 @@ nsCSSFrameConstructor::FindPreviousSibling(nsIContent* aContainer,
// The frame may be a special frame (a split inline frame that // The frame may be a special frame (a split inline frame that
// contains a block). Get the last part of that split. // contains a block). Get the last part of that split.
if (IsFrameSpecial(prevSibling)) { if (IsFrameSpecial(prevSibling)) {
prevSibling = GetLastSpecialSibling(mPresShell->FrameManager(), prevSibling = GetLastSpecialSibling(prevSibling);
prevSibling);
} }
// The frame may have a continuation. Get the last continuation // The frame may have a continuation. Get the last continuation
@ -8418,7 +8423,7 @@ nsCSSFrameConstructor::ContentAppended(nsIContent* aContainer,
if (item == child) if (item == child)
// Call ContentInserted with this index. // Call ContentInserted with this index.
ContentInserted(aContainer, child, ContentInserted(aContainer, child,
iter.index(), mTempFrameTreeState, PR_FALSE); iter.index(), mTempFrameTreeState);
LAYOUT_PHASE_TEMP_REENTER(); LAYOUT_PHASE_TEMP_REENTER();
} }
} }
@ -8445,20 +8450,9 @@ nsCSSFrameConstructor::ContentAppended(nsIContent* aContainer,
return NS_OK; return NS_OK;
} }
// If the frame we are manipulating is a ``special'' frame (that // If the frame we are manipulating is a ``special'' frame (that is, one
// is, one that's been created as a result of a block-in-inline // that's been created as a result of a block-in-inline situation) then we
// situation) then do something different instead of just // need to append to the last special sibling, not to the frame itself.
// appending newly created frames. Note that only the
// first-in-flow is marked so we check before getting to the
// last-in-flow.
//
// We run into this situation occasionally while loading web
// pages, typically when some content generation tool has
// sprinkled invalid markup into the document. More often than
// not, we'll be able to just use the normal fast-path frame
// construction code, because the frames will be appended to the
// ``anonymous'' block that got created to parent the block
// children of the inline.
if (IsFrameSpecial(parentFrame)) { if (IsFrameSpecial(parentFrame)) {
#ifdef DEBUG #ifdef DEBUG
if (gNoisyContentUpdates) { if (gNoisyContentUpdates) {
@ -8470,37 +8464,7 @@ nsCSSFrameConstructor::ContentAppended(nsIContent* aContainer,
// Since we're appending, we'll walk to the last anonymous frame // Since we're appending, we'll walk to the last anonymous frame
// that was created for the broken inline frame. // that was created for the broken inline frame.
nsFrameManager *frameManager = mPresShell->FrameManager(); parentFrame = GetLastSpecialSibling(parentFrame);
while (1) {
nsIFrame* sibling;
GetSpecialSibling(frameManager, parentFrame, &sibling);
if (! sibling)
break;
parentFrame = sibling;
}
// If this frame is the anonymous block frame, then all's well:
// just append frames as usual.
const nsStyleDisplay* display = parentFrame->GetStyleDisplay();
if (NS_STYLE_DISPLAY_BLOCK != display->mDisplay) {
// Nope, it's an inline, so just reframe the entire stinkin' mess if the
// content is a block. We _could_ do better here with a little more work...
// find out if the child is a block or inline, an inline means we don't have to reframe
nsIContent *child = aContainer->GetChildAt(aNewIndexInContainer);
PRBool needReframe = !child;
if (child && child->IsNodeOfType(nsINode::eELEMENT)) {
nsRefPtr<nsStyleContext> styleContext;
styleContext = ResolveStyleContext(parentFrame, child);
// XXX since the block child goes in the last inline of the sacred triad, frames would
// need to be moved into the 2nd triad (block) but that is more work, for now bail.
needReframe = styleContext->GetStyleDisplay()->IsBlockOutside();
}
if (needReframe)
return ReframeContainingBlock(parentFrame);
}
} }
// Get the parent frame's last continuation // Get the parent frame's last continuation
@ -8596,8 +8560,7 @@ nsCSSFrameConstructor::ContentAppended(nsIContent* aContainer,
// Perform special check for diddling around with the frames in // Perform special check for diddling around with the frames in
// a special inline frame. // a special inline frame.
if (WipeContainingBlock(state, containingBlock, parentFrame, if (WipeContainingBlock(state, containingBlock, parentFrame, frameItems)) {
frameItems.childList)) {
return NS_OK; return NS_OK;
} }
@ -8641,121 +8604,6 @@ nsCSSFrameConstructor::ContentAppended(nsIContent* aContainer,
return NS_OK; return NS_OK;
} }
// Return TRUE if the insertion of aChild into aParent1,2 should force a reframe. aParent1 is
// the special inline container which contains a block. aParentFrame is approximately aParent1's
// primary frame and will be set to the correct parent of aChild if a reframe is not necessary.
// aParent2 is aParentFrame's content. aPrevSibling will be set to the correct prev sibling of
// aChild if a reframe is not necessary.
PRBool
nsCSSFrameConstructor::NeedSpecialFrameReframe(nsIContent* aParent1,
nsIContent* aParent2,
nsIFrame*& aParentFrame,
nsIContent* aChild,
PRInt32 aIndexInContainer,
nsIFrame*& aPrevSibling,
nsIFrame* aNextSibling)
{
// XXXbz aNextSibling is utterly unused. Why?
if (IsBlockOutside(aParentFrame))
return PR_FALSE;
// find out if aChild is a block or inline
PRBool childIsBlock = PR_FALSE;
if (aChild->IsNodeOfType(nsINode::eELEMENT)) {
nsRefPtr<nsStyleContext> styleContext;
styleContext = ResolveStyleContext(aParentFrame, aChild);
const nsStyleDisplay* display = styleContext->GetStyleDisplay();
childIsBlock = display->IsBlockOutside();
}
nsIFrame* prevParent; // parent of prev sibling
nsIFrame* nextParent; // parent of next sibling
if (childIsBlock) {
if (aPrevSibling) {
prevParent = aPrevSibling->GetParent();
NS_ASSERTION(prevParent, "program error - null parent frame");
if (!IsBlockOutside(prevParent)) { // prevParent is an inline
// XXX we need to find out if prevParent is the 1st inline or the last. If it
// is the 1st, then aChild and the frames after aPrevSibling within the 1st inline
// need to be moved to the block(inline). If it is the last, then aChild and the
// frames before aPrevSibling within the last need to be moved to the block(inline).
return PR_TRUE; // For now, bail.
}
aParentFrame = prevParent; // prevParent is a block, put aChild there
}
else {
// XXXbz see comments in ContentInserted about this being wrong in many
// cases! Why doesn't this just use aNextSibling anyway? Why are we
// looking sometimes in aParent1 and sometimes in aParent2?
nsIFrame* nextSibling = (aIndexInContainer >= 0)
? FindNextSibling(aParent2, aParentFrame,
aIndexInContainer)
: FindNextAnonymousSibling(mPresShell, mDocument,
aParent1, aChild);
if (nextSibling) {
nextParent = nextSibling->GetParent();
NS_ASSERTION(nextParent, "program error - null parent frame");
if (!IsBlockOutside(nextParent)) {
// XXX we need to move aChild, aNextSibling and all the frames after aNextSibling within
// the 1st inline to the block(inline).
return PR_TRUE; // for now, bail
}
// put aChild in nextParent which is the block(inline) and leave aPrevSibling null
aParentFrame = nextParent;
}
}
}
else { // aChild is an inline
if (aPrevSibling) {
prevParent = aPrevSibling->GetParent();
NS_ASSERTION(prevParent, "program error - null parent frame");
if (!IsBlockOutside(prevParent)) { // prevParent is an inline
// aChild goes into the same inline frame as aPrevSibling
aParentFrame = aPrevSibling->GetParent();
NS_ASSERTION(aParentFrame, "program error - null parent frame");
}
else { // prevParent is a block
// XXXbz see comments in ContentInserted about this being wrong in many
// cases! Why doesn't this just use aNextSibling anyway? Why are we
// looking sometimes in aParent1 and sometimes in aParent2?
nsIFrame* nextSibling = (aIndexInContainer >= 0)
? FindNextSibling(aParent2, aParentFrame,
aIndexInContainer)
: FindNextAnonymousSibling(mPresShell,
mDocument, aParent1,
aChild);
if (nextSibling) {
nextParent = nextSibling->GetParent();
NS_ASSERTION(nextParent, "program error - null parent frame");
if (!IsBlockOutside(nextParent)) {
// nextParent is the ending inline frame. Put aChild there and
// set aPrevSibling to null so aChild is its first element.
aParentFrame = nextSibling->GetParent();
NS_ASSERTION(aParentFrame, "program error - null parent frame");
aPrevSibling = nsnull;
}
else { // nextParent is a block
// prevParent and nextParent should be the same, and aChild goes there
NS_ASSERTION(prevParent == nextParent, "special frame error");
aParentFrame = prevParent;
}
}
else {
// The child has no next sibling, so we can't find the ending inline
// frame (which might not exist in this case anyway!), but aChild
// should go in there. Force a reframe.
// XXXbz wouldn't getting prevParent's special sibling work, with
// reframing only needed if that's null?
return PR_TRUE;
}
}
}
// else aChild goes into the 1st inline frame which is aParentFrame
}
return PR_FALSE;
}
#ifdef MOZ_XUL #ifdef MOZ_XUL
enum content_operation enum content_operation
@ -8828,8 +8676,7 @@ nsresult
nsCSSFrameConstructor::ContentInserted(nsIContent* aContainer, nsCSSFrameConstructor::ContentInserted(nsIContent* aContainer,
nsIContent* aChild, nsIContent* aChild,
PRInt32 aIndexInContainer, PRInt32 aIndexInContainer,
nsILayoutHistoryState* aFrameState, nsILayoutHistoryState* aFrameState)
PRBool aInReinsertContent)
{ {
AUTO_LAYOUT_PHASE_ENTRY_POINT(mPresShell->GetPresContext(), FrameC); AUTO_LAYOUT_PHASE_ENTRY_POINT(mPresShell->GetPresContext(), FrameC);
// XXXldb Do we need to re-resolve style to handle the CSS2 + combinator and // XXXldb Do we need to re-resolve style to handle the CSS2 + combinator and
@ -8955,17 +8802,13 @@ nsCSSFrameConstructor::ContentInserted(nsIContent* aContainer,
: FindNextAnonymousSibling(mPresShell, mDocument, aContainer, aChild); : FindNextAnonymousSibling(mPresShell, mDocument, aContainer, aChild);
} }
PRBool handleSpecialFrame = IsFrameSpecial(parentFrame) && !aInReinsertContent;
// Now, find the geometric parent so that we can handle // Now, find the geometric parent so that we can handle
// continuations properly. Use the prev sibling if we have it; // continuations properly. Use the prev sibling if we have it;
// otherwise use the next sibling. // otherwise use the next sibling.
if (prevSibling) { if (prevSibling) {
if (!handleSpecialFrame)
parentFrame = prevSibling->GetParent()->GetContentInsertionFrame(); parentFrame = prevSibling->GetParent()->GetContentInsertionFrame();
} }
else if (nextSibling) { else if (nextSibling) {
if (!handleSpecialFrame)
parentFrame = nextSibling->GetParent()->GetContentInsertionFrame(); parentFrame = nextSibling->GetParent()->GetContentInsertionFrame();
} }
else { else {
@ -8991,26 +8834,6 @@ nsCSSFrameConstructor::ContentInserted(nsIContent* aContainer,
return NS_OK; return NS_OK;
} }
// If the frame we are manipulating is a special frame then see if we need to reframe
// NOTE: if we are in ReinsertContent, then don't reframe as we are already doing just that!
if (handleSpecialFrame) {
// a special inline frame has propagated some of its children upward to be children
// of the block and those frames may need to move around. Sometimes we may need to reframe
#ifdef DEBUG
if (gNoisyContentUpdates) {
printf("nsCSSFrameConstructor::ContentInserted: parentFrame=");
nsFrame::ListTag(stdout, parentFrame);
printf(" is special\n");
}
#endif
// if we don't need to reframe then set parentFrame and prevSibling to the correct values
if (NeedSpecialFrameReframe(aContainer, container, parentFrame,
aChild, aIndexInContainer, prevSibling,
nextSibling)) {
return ReframeContainingBlock(parentFrame);
}
}
nsFrameConstructorState state(mPresShell, mFixedContainingBlock, nsFrameConstructorState state(mPresShell, mFixedContainingBlock,
GetAbsoluteContainingBlock(parentFrame), GetAbsoluteContainingBlock(parentFrame),
GetFloatContainingBlock(parentFrame), GetFloatContainingBlock(parentFrame),
@ -9023,8 +8846,6 @@ nsCSSFrameConstructor::ContentInserted(nsIContent* aContainer,
// is not the normal structure and requires custom updating // is not the normal structure and requires custom updating
// logic. // logic.
nsIFrame* containingBlock = state.mFloatedItems.containingBlock; nsIFrame* containingBlock = state.mFloatedItems.containingBlock;
nsStyleContext* blockSC;
nsIContent* blockContent = nsnull;
PRBool haveFirstLetterStyle = PR_FALSE; PRBool haveFirstLetterStyle = PR_FALSE;
PRBool haveFirstLineStyle = PR_FALSE; PRBool haveFirstLineStyle = PR_FALSE;
@ -9077,33 +8898,6 @@ nsCSSFrameConstructor::ContentInserted(nsIContent* aContainer,
? FindNextSibling(container, parentFrame, aIndexInContainer, aChild) ? FindNextSibling(container, parentFrame, aIndexInContainer, aChild)
: FindNextAnonymousSibling(mPresShell, mDocument, aContainer, aChild); : FindNextAnonymousSibling(mPresShell, mDocument, aContainer, aChild);
} }
handleSpecialFrame = IsFrameSpecial(parentFrame) && !aInReinsertContent;
if (handleSpecialFrame &&
NeedSpecialFrameReframe(aContainer, container, parentFrame,
aChild, aIndexInContainer, prevSibling,
nextSibling)) {
#ifdef DEBUG
nsIContent* parentContainer = blockContent->GetParent();
if (gNoisyContentUpdates) {
printf("nsCSSFrameConstructor::ContentInserted: parentFrame=");
nsFrame::ListTag(stdout, parentFrame);
printf(" is special inline\n");
printf(" ==> blockContent=%p, parentContainer=%p\n",
static_cast<void*>(blockContent),
static_cast<void*>(parentContainer));
}
#endif
NS_ASSERTION(GetFloatContainingBlock(parentFrame) == containingBlock,
"Unexpected block ancestor for parentFrame");
// Note that in this case we're guaranteed that the closest block
// containing parentFrame is |containingBlock|. So
// ReframeContainingBlock(parentFrame) will make sure to rebuild the
// first-letter stuff we just blew away.
return ReframeContainingBlock(parentFrame);
}
} }
} }
@ -9145,8 +8939,7 @@ nsCSSFrameConstructor::ContentInserted(nsIContent* aContainer,
// Perform special check for diddling around with the frames in // Perform special check for diddling around with the frames in
// a special inline frame. // a special inline frame.
if (WipeContainingBlock(state, containingBlock, parentFrame, if (WipeContainingBlock(state, containingBlock, parentFrame, frameItems))
frameItems.childList))
return NS_OK; return NS_OK;
if (haveFirstLineStyle && parentFrame == containingBlock) { if (haveFirstLineStyle && parentFrame == containingBlock) {
@ -9264,7 +9057,7 @@ nsCSSFrameConstructor::ReinsertContent(nsIContent* aContainer,
nsresult res = ContentRemoved(aContainer, aChild, ix, PR_TRUE); nsresult res = ContentRemoved(aContainer, aChild, ix, PR_TRUE);
if (NS_SUCCEEDED(res)) { if (NS_SUCCEEDED(res)) {
res = ContentInserted(aContainer, aChild, ix, nsnull, PR_TRUE); res = ContentInserted(aContainer, aChild, ix, nsnull);
} }
return res; return res;
@ -9487,21 +9280,9 @@ nsCSSFrameConstructor::ContentRemoved(nsIContent* aContainer,
// frames. // frames.
// NOTE: if we are in ReinsertContent, // NOTE: if we are in ReinsertContent,
// then do not reframe as we are already doing just that! // then do not reframe as we are already doing just that!
if (IsFrameSpecial(childFrame) && !aInReinsertContent) { if (!aInReinsertContent &&
// We are pretty harsh here (and definitely not optimal) -- we MaybeRecreateContainerForIBSplitterFrame(childFrame, &rv)) {
// wipe out the entire containing block and recreate it from return rv;
// scratch. The reason is that because we know that a special
// inline frame has propagated some of its children upward to be
// children of the block and that those frames may need to move
// around. This logic guarantees a correct answer.
#ifdef DEBUG
if (gNoisyContentUpdates) {
printf("nsCSSFrameConstructor::ContentRemoved: childFrame=");
nsFrame::ListTag(stdout, childFrame);
printf(" is special\n");
}
#endif
return ReframeContainingBlock(childFrame);
} }
// Get the childFrame's parent frame // Get the childFrame's parent frame
@ -10910,9 +10691,7 @@ nsCSSFrameConstructor::FindPrimaryFrameFor(nsFrameManager* aFrameManager,
// that's been split because it contained a block), we need to // that's been split because it contained a block), we need to
// follow the out-of-flow "special sibling" link, and search // follow the out-of-flow "special sibling" link, and search
// *that* subtree as well. // *that* subtree as well.
nsIFrame* specialSibling = nsnull; parentFrame = GetSpecialSibling(parentFrame);
GetSpecialSibling(aFrameManager, parentFrame, &specialSibling);
parentFrame = specialSibling;
} }
else { else {
break; break;
@ -11056,22 +10835,52 @@ nsCSSFrameConstructor::MaybeRecreateFramesForContent(nsIContent* aContent)
} }
PRBool PRBool
nsCSSFrameConstructor::MaybeRecreateContainerForIBSplitterFrame(nsIFrame* aFrame, nsresult* aResult) nsCSSFrameConstructor::MaybeRecreateContainerForIBSplitterFrame(nsIFrame* aFrame,
nsresult* aResult)
{ {
if (!aFrame || !IsFrameSpecial(aFrame)) NS_PRECONDITION(aFrame, "Must have a frame");
return PR_FALSE; NS_PRECONDITION(aFrame->GetParent(), "Frame shouldn't be root");
NS_PRECONDITION(aResult, "Null out param?");
NS_PRECONDITION(aFrame == aFrame->GetFirstContinuation(),
"aFrame not the result of GetPrimaryFrameFor()?");
if (IsFrameSpecial(aFrame)) {
// The removal functions can't handle removal of an {ib} split directly; we
// need to rebuild the containing block.
#ifdef DEBUG #ifdef DEBUG
if (gNoisyContentUpdates) { if (gNoisyContentUpdates) {
printf("nsCSSFrameConstructor::RecreateFramesForContent: frame="); printf("nsCSSFrameConstructor::MaybeRecreateContainerForIBSplitterFrame: "
"frame=");
nsFrame::ListTag(stdout, aFrame); nsFrame::ListTag(stdout, aFrame);
printf(" is special\n"); printf(" is special\n");
} }
#endif #endif
*aResult = ReframeContainingBlock(aFrame); *aResult = ReframeContainingBlock(aFrame);
return PR_TRUE; return PR_TRUE;
} }
// We might still need to reconstruct things if the parent of aFrame is
// special, since in that case the removal of aFrame might affect the
// splitting of its parent.
nsIFrame* parent = aFrame->GetParent();
if (!IsFrameSpecial(parent)) {
return PR_FALSE;
}
#ifdef DEBUG
if (gNoisyContentUpdates || 1) {
printf("nsCSSFrameConstructor::MaybeRecreateContainerForIBSplitterFrame: "
"frame=");
nsFrame::ListTag(stdout, parent);
printf(" is special\n");
}
#endif
*aResult = ReframeContainingBlock(parent);
return PR_TRUE;
}
nsresult nsresult
nsCSSFrameConstructor::RecreateFramesForContent(nsIContent* aContent) nsCSSFrameConstructor::RecreateFramesForContent(nsIContent* aContent)
{ {
@ -11086,22 +10895,14 @@ nsCSSFrameConstructor::RecreateFramesForContent(nsIContent* aContent)
// block *here*, rather than trying to remove and re-insert the // block *here*, rather than trying to remove and re-insert the
// content (which would otherwise result in *two* nested reframe // content (which would otherwise result in *two* nested reframe
// containing block from ContentRemoved() and ContentInserted(), // containing block from ContentRemoved() and ContentInserted(),
// below!) // below!). We'd really like to optimize away one of those
// containing block reframes, hence the code here.
nsIFrame* frame = mPresShell->GetPrimaryFrameFor(aContent); nsIFrame* frame = mPresShell->GetPrimaryFrameFor(aContent);
nsresult rv = NS_OK; nsresult rv = NS_OK;
if (frame) { if (frame && MaybeRecreateContainerForIBSplitterFrame(frame, &rv)) {
// If the frame is an anonymous frame created as part of inline-in-block
// splitting --- or if its parent is such an anonymous frame (i.e., this
// frame might have been the cause of such splitting), then recreate the
// containing block. Note that if |frame| is an inline, then it can't
// possibly have caused the splitting, and if the inline is changing to a
// block, any reframing that's needed will happen in ContentInserted.
if (MaybeRecreateContainerForIBSplitterFrame(frame, &rv) ||
(!IsInlineOutside(frame) &&
MaybeRecreateContainerForIBSplitterFrame(frame->GetParent(), &rv)))
return rv; return rv;
} }
@ -11121,7 +10922,7 @@ nsCSSFrameConstructor::RecreateFramesForContent(nsIContent* aContent)
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
// Now, recreate the frames associated with this content object. // Now, recreate the frames associated with this content object.
rv = ContentInserted(container, aContent, rv = ContentInserted(container, aContent,
indexInContainer, mTempFrameTreeState, PR_FALSE); indexInContainer, mTempFrameTreeState);
} }
} else { } else {
// The content is the root node, so just rebuild the world. // The content is the root node, so just rebuild the world.
@ -11951,8 +11752,7 @@ nsCSSFrameConstructor::WrapFramesInFirstLetterFrame(
while (frame) { while (frame) {
nsIFrame* nextFrame = frame->GetNextSibling(); nsIFrame* nextFrame = frame->GetNextSibling();
nsIAtom* frameType = frame->GetType(); if (nsGkAtoms::textFrame == frame->GetType()) {
if (nsGkAtoms::textFrame == frameType) {
// Wrap up first-letter content in a letter frame // Wrap up first-letter content in a letter frame
nsIContent* textContent = frame->GetContent(); nsIContent* textContent = frame->GetContent();
if (IsFirstLetterContent(textContent)) { if (IsFirstLetterContent(textContent)) {
@ -11971,9 +11771,7 @@ nsCSSFrameConstructor::WrapFramesInFirstLetterFrame(
return NS_OK; return NS_OK;
} }
} }
else if ((nsGkAtoms::inlineFrame == frameType) || else if (IsInlineFrame(frame)) {
(nsGkAtoms::lineFrame == frameType) ||
(nsGkAtoms::positionedInlineFrame == frameType)) {
nsIFrame* kids = frame->GetFirstChild(nsnull); nsIFrame* kids = frame->GetFirstChild(nsnull);
WrapFramesInFirstLetterFrame(aState, aBlockFrame, frame, kids, WrapFramesInFirstLetterFrame(aState, aBlockFrame, frame, kids,
aModifiedParent, aTextFrame, aModifiedParent, aTextFrame,
@ -12126,8 +11924,7 @@ nsCSSFrameConstructor::RemoveFirstLetterFrames(nsPresContext* aPresContext,
nsIFrame* kid = aFrame->GetFirstChild(nsnull); nsIFrame* kid = aFrame->GetFirstChild(nsnull);
while (kid) { while (kid) {
nsIAtom* frameType = kid->GetType(); if (nsGkAtoms::letterFrame == kid->GetType()) {
if (nsGkAtoms::letterFrame == frameType) {
// Bingo. Found it. First steal away the text frame. // Bingo. Found it. First steal away the text frame.
nsIFrame* textFrame = kid->GetFirstChild(nsnull); nsIFrame* textFrame = kid->GetFirstChild(nsnull);
if (!textFrame) { if (!textFrame) {
@ -12161,9 +11958,7 @@ nsCSSFrameConstructor::RemoveFirstLetterFrames(nsPresContext* aPresContext,
*aStopLooking = PR_TRUE; *aStopLooking = PR_TRUE;
break; break;
} }
else if ((nsGkAtoms::inlineFrame == frameType) || else if (IsInlineFrame(kid)) {
(nsGkAtoms::lineFrame == frameType) ||
(nsGkAtoms::positionedInlineFrame == frameType)) {
// Look inside child inline frame for the letter frame // Look inside child inline frame for the letter frame
RemoveFirstLetterFrames(aPresContext, aPresShell, aFrameManager, kid, RemoveFirstLetterFrames(aPresContext, aPresShell, aFrameManager, kid,
aStopLooking); aStopLooking);
@ -12521,6 +12316,9 @@ nsCSSFrameConstructor::ConstructInline(nsFrameConstructorState& aState,
nsIFrame* inlineFrame = nsnull; nsIFrame* inlineFrame = nsnull;
if (list3) { if (list3) {
// If we ever start constructing a second inline in the split even when
// list3 is null, the logic in MaybeRecreateContainerForIBSplitterFrame
// needs to be adjusted.
if (aIsPositioned) { if (aIsPositioned) {
inlineFrame = NS_NewPositionedInlineFrame(mPresShell, aStyleContext); inlineFrame = NS_NewPositionedInlineFrame(mPresShell, aStyleContext);
} }
@ -12675,24 +12473,34 @@ PRBool
nsCSSFrameConstructor::WipeContainingBlock(nsFrameConstructorState& aState, nsCSSFrameConstructor::WipeContainingBlock(nsFrameConstructorState& aState,
nsIFrame* aContainingBlock, nsIFrame* aContainingBlock,
nsIFrame* aFrame, nsIFrame* aFrame,
nsIFrame* aFrameList) const nsFrameItems& aFrameList)
{ {
if (!aFrameList.childList) {
return PR_FALSE;
}
// Before we go and append the frames, check for a special // Before we go and append the frames, check for a special
// situation: an inline frame that will now contain block // situation: an inline frame that will now contain block
// frames. This is a no-no and the frame construction logic knows // frames. This is a no-no and the frame construction logic knows
// how to fix this. // how to fix this. See defition of IsInlineFrame() for what "an
// inline" is. Whether we have "a block" is tested for by
// AreAllKidsInline.
// If we don't have a block within an inline, just return false. Here // We also need to check for an append of
// "an inline" is an actual inline frame (positioned or not) or a lineframe // content ending in an inline to the block in an {ib} split. If
// (corresponding to :first-line), since the latter should stop at the first // that happens, we also need to reframe, since that content
// block it runs into and we might be inserting one in the middle of it. // needs to go into the following inline in the split.
// Whether we have "a block" is tested for by AreAllKidsInline.
nsIAtom* frameType = aFrame->GetType(); if (IsInlineFrame(aFrame)) {
if ((frameType != nsGkAtoms::inlineFrame && // Nothing to do if all kids are inline
frameType != nsGkAtoms::positionedInlineFrame && if (AreAllKidsInline(aFrameList.childList)) {
frameType != nsGkAtoms::lineFrame) ||
AreAllKidsInline(aFrameList))
return PR_FALSE; return PR_FALSE;
}
} else if (!IsFrameSpecial(aFrame) ||
!aFrameList.lastChild->GetStyleDisplay()->IsInlineOutside()) {
// Nothing to do if aFrame is not special or if the last kid is not inline
return PR_FALSE;
}
// Ok, reverse tracks: wipe out the frames we just created // Ok, reverse tracks: wipe out the frames we just created
nsFrameManager *frameManager = aState.mFrameManager; nsFrameManager *frameManager = aState.mFrameManager;
@ -12701,7 +12509,7 @@ nsCSSFrameConstructor::WipeContainingBlock(nsFrameConstructorState& aState,
// or entries in the undisplayed content map are removed // or entries in the undisplayed content map are removed
frameManager->ClearAllUndisplayedContentIn(aFrame->GetContent()); frameManager->ClearAllUndisplayedContentIn(aFrame->GetContent());
CleanupFrameReferences(frameManager, aFrameList); CleanupFrameReferences(frameManager, aFrameList.childList);
if (aState.mAbsoluteItems.childList) { if (aState.mAbsoluteItems.childList) {
CleanupFrameReferences(frameManager, aState.mAbsoluteItems.childList); CleanupFrameReferences(frameManager, aState.mAbsoluteItems.childList);
} }
@ -12716,7 +12524,7 @@ nsCSSFrameConstructor::WipeContainingBlock(nsFrameConstructorState& aState,
CleanupFrameReferences(frameManager, aState.mPopupItems.childList); CleanupFrameReferences(frameManager, aState.mPopupItems.childList);
} }
#endif #endif
nsFrameList tmp(aFrameList); nsFrameList tmp(aFrameList.childList);
tmp.DestroyFrames(); tmp.DestroyFrames();
tmp.SetFrames(aState.mAbsoluteItems.childList); tmp.SetFrames(aState.mAbsoluteItems.childList);

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

@ -111,8 +111,7 @@ public:
nsresult ContentInserted(nsIContent* aContainer, nsresult ContentInserted(nsIContent* aContainer,
nsIContent* aChild, nsIContent* aChild,
PRInt32 aIndexInContainer, PRInt32 aIndexInContainer,
nsILayoutHistoryState* aFrameState, nsILayoutHistoryState* aFrameState);
PRBool aInReinsertContent);
nsresult ContentRemoved(nsIContent* aContainer, nsresult ContentRemoved(nsIContent* aContainer,
nsIContent* aChild, nsIContent* aChild,
@ -754,7 +753,16 @@ private:
nsresult RecreateFramesForContent(nsIContent* aContent); nsresult RecreateFramesForContent(nsIContent* aContent);
PRBool MaybeRecreateContainerForIBSplitterFrame(nsIFrame* aFrame, nsresult* aResult); // If removal of aFrame from the frame tree requires reconstruction of some
// containing block (either of aFrame or of its parent) due to {ib} splits,
// recreate the relevant containing block. The return value indicates
// whether this happened. If this method returns true, *aResult is the
// return value of ReframeContainingBlock. If this method returns false, the
// value of *aResult is no affected. aFrame and aResult must not be null.
// aFrame must be the result of a GetPrimaryFrameFor() call (which means its
// parent is also not null).
PRBool MaybeRecreateContainerForIBSplitterFrame(nsIFrame* aFrame,
nsresult* aResult);
nsresult CreateContinuingOuterTableFrame(nsIPresShell* aPresShell, nsresult CreateContinuingOuterTableFrame(nsIPresShell* aPresShell,
nsPresContext* aPresContext, nsPresContext* aPresContext,
@ -838,17 +846,9 @@ private:
PRBool AreAllKidsInline(nsIFrame* aFrameList); PRBool AreAllKidsInline(nsIFrame* aFrameList);
PRBool WipeContainingBlock(nsFrameConstructorState& aState, PRBool WipeContainingBlock(nsFrameConstructorState& aState,
nsIFrame* blockContent, nsIFrame* aContainingBlock,
nsIFrame* aFrame, nsIFrame* aFrame,
nsIFrame* aFrameList); const nsFrameItems& aFrameList);
PRBool NeedSpecialFrameReframe(nsIContent* aParent1,
nsIContent* aParent2,
nsIFrame*& aParentFrame,
nsIContent* aChild,
PRInt32 aIndexInContainer,
nsIFrame*& aPrevSibling,
nsIFrame* aNextSibling);
nsresult ReframeContainingBlock(nsIFrame* aFrame); nsresult ReframeContainingBlock(nsIFrame* aFrame);

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

@ -2366,8 +2366,7 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
// Have the style sheet processor construct frame for the root // Have the style sheet processor construct frame for the root
// content object down // content object down
mFrameConstructor->ContentInserted(nsnull, root, 0, mFrameConstructor->ContentInserted(nsnull, root, 0, nsnull);
nsnull, PR_FALSE);
VERIFY_STYLE_TREE; VERIFY_STYLE_TREE;
MOZ_TIMER_DEBUGLOG(("Stop: Frame Creation: PresShell::InitialReflow(), this=%p\n", MOZ_TIMER_DEBUGLOG(("Stop: Frame Creation: PresShell::InitialReflow(), this=%p\n",
(void*)this)); (void*)this));
@ -4539,7 +4538,7 @@ PresShell::ContentInserted(nsIDocument* aDocument,
WillCauseReflow(); WillCauseReflow();
mFrameConstructor->ContentInserted(aContainer, aChild, mFrameConstructor->ContentInserted(aContainer, aChild,
aIndexInContainer, nsnull, PR_FALSE); aIndexInContainer, nsnull);
VERIFY_STYLE_TREE; VERIFY_STYLE_TREE;
DidCauseReflow(); DidCauseReflow();
} }

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

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body>
<span
><span>One</span
><span>Two</span
><span>Three</span
><div>Four</div
><div>Five</div
><span>Six</span
><div>Seven</div
><div>Eight</div
><span>Nine</span
><span>Ten</span
><span>Eleven</span
></span>
</body>
</html>

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

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("span");
newNode.appendChild(document.createTextNode("One"));
document.getElementById("target")
.insertBefore(newNode, document.getElementById("insertion"));
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
><span id="insertion">Two</span
><span>Three</span
><div>Four</div
><div>Five</div
><span>Six</span
><div>Seven</div
><div>Eight</div
><span>Nine</span
><span>Ten</span
><span>Eleven</span
></span>
</body>
</html>

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

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("span");
newNode.appendChild(document.createTextNode("Two"));
document.getElementById("target")
.insertBefore(newNode, document.getElementById("insertion"));
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
><span>One</span
><span id="insertion">Three</span
><div>Four</div
><div>Five</div
><span>Six</span
><div>Seven</div
><div>Eight</div
><span>Nine</span
><span>Ten</span
><span>Eleven</span
></span>
</body>
</html>

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

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("span");
newNode.appendChild(document.createTextNode("Three"));
document.getElementById("target")
.insertBefore(newNode, document.getElementById("insertion"));
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
><span>One</span
><span>Two</span
><div id="insertion">Four</div
><div>Five</div
><span>Six</span
><div>Seven</div
><div>Eight</div
><span>Nine</span
><span>Ten</span
><span>Eleven</span
></span>
</body>
</html>

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

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("div");
newNode.appendChild(document.createTextNode("Four"));
document.getElementById("target")
.insertBefore(newNode, document.getElementById("insertion"));
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
><span>One</span
><span>Two</span
><span>Three</span
><div id="insertion">Five</div
><span>Six</span
><div>Seven</div
><div>Eight</div
><span>Nine</span
><span>Ten</span
><span>Eleven</span
></span>
</body>
</html>

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

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("div");
newNode.appendChild(document.createTextNode("Five"));
document.getElementById("target")
.insertBefore(newNode, document.getElementById("insertion"));
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
><span>One</span
><span>Two</span
><span>Three</span
><div>Four</div
><span id="insertion">Six</span
><div>Seven</div
><div>Eight</div
><span>Nine</span
><span>Ten</span
><span>Eleven</span
></span>
</body>
</html>

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

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("span");
newNode.appendChild(document.createTextNode("Six"));
document.getElementById("target")
.insertBefore(newNode, document.getElementById("insertion"));
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
><span>One</span
><span>Two</span
><span>Three</span
><div>Four</div
><div>Five</div
><div id="insertion">Seven</div
><div>Eight</div
><span>Nine</span
><span>Ten</span
><span>Eleven</span
></span>
</body>
</html>

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

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("div");
newNode.appendChild(document.createTextNode("Seven"));
document.getElementById("target")
.insertBefore(newNode, document.getElementById("insertion"));
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
><span>One</span
><span>Two</span
><span>Three</span
><div>Four</div
><div>Five</div
><span>Six</span
><div id="insertion">Eight</div
><span>Nine</span
><span>Ten</span
><span>Eleven</span
></span>
</body>
</html>

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

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("div");
newNode.appendChild(document.createTextNode("Eight"));
document.getElementById("target")
.insertBefore(newNode, document.getElementById("insertion"));
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
><span>One</span
><span>Two</span
><span>Three</span
><div>Four</div
><div>Five</div
><span>Six</span
><div>Seven</div
><span id="insertion">Nine</span
><span>Ten</span
><span>Eleven</span
></span>
</body>
</html>

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

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("span");
newNode.appendChild(document.createTextNode("Nine"));
document.getElementById("target")
.insertBefore(newNode, document.getElementById("insertion"));
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
><span>One</span
><span>Two</span
><span>Three</span
><div>Four</div
><div>Five</div
><span>Six</span
><div>Seven</div
><div>Eight</div
><span id="insertion">Ten</span
><span>Eleven</span
></span>
</body>
</html>

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

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("span");
newNode.appendChild(document.createTextNode("Ten"));
document.getElementById("target")
.insertBefore(newNode, document.getElementById("insertion"));
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
><span>One</span
><span>Two</span
><span>Three</span
><div>Four</div
><div>Five</div
><span>Six</span
><div>Seven</div
><div>Eight</div
><span>Nine</span
><span id="insertion">Eleven</span
></span>
</body>
</html>

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

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("span");
newNode.appendChild(document.createTextNode("Eleven"));
document.getElementById("target")
.insertBefore(newNode, document.getElementById("insertion"));
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
><span>One</span
><span>Two</span
><span>Three</span
><div>Four</div
><div>Five</div
><span>Six</span
><div>Seven</div
><div>Eight</div
><span>Nine</span
><span>Ten</span
></span>
</body>
</html>

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

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("span");
newNode.appendChild(document.createTextNode("Eleven"));
document.getElementById("target").appendChild(newNode);
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
><span>One</span
><span>Two</span
><span>Three</span
><div>Four</div
><div>Five</div
><span>Six</span
><div>Seven</div
><div>Eight</div
><span>Nine</span
><span>Ten</span
></span>
</body>
</html>

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

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body>
<span
><span>One</span
><span>Two</span
><span>Three</span
><div>Four</div
><div>Five</div
><span>Six</span
><div>Seven</div
><div>Eight</div
></span>
</body>
</html>

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

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("span");
newNode.appendChild(document.createTextNode("One"));
document.getElementById("target")
.insertBefore(newNode, document.getElementById("insertion"));
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
><span id="insertion">Two</span
><span>Three</span
><div>Four</div
><div>Five</div
><span>Six</span
><div>Seven</div
><div>Eight</div
></span>
</body>
</html>

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

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("span");
newNode.appendChild(document.createTextNode("Two"));
document.getElementById("target")
.insertBefore(newNode, document.getElementById("insertion"));
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
><span>One</span
><span id="insertion">Three</span
><div>Four</div
><div>Five</div
><span>Six</span
><div>Seven</div
><div>Eight</div
></span>
</body>
</html>

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

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("span");
newNode.appendChild(document.createTextNode("Three"));
document.getElementById("target")
.insertBefore(newNode, document.getElementById("insertion"));
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
><span>One</span
><span>Two</span
><div id="insertion">Four</div
><div>Five</div
><span>Six</span
><div>Seven</div
><div>Eight</div
></span>
</body>
</html>

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

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("div");
newNode.appendChild(document.createTextNode("Four"));
document.getElementById("target")
.insertBefore(newNode, document.getElementById("insertion"));
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
><span>One</span
><span>Two</span
><span>Three</span
><div id="insertion">Five</div
><span>Six</span
><div>Seven</div
><div>Eight</div
></span>
</body>
</html>

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

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("div");
newNode.appendChild(document.createTextNode("Five"));
document.getElementById("target")
.insertBefore(newNode, document.getElementById("insertion"));
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
><span>One</span
><span>Two</span
><span>Three</span
><div>Four</div
><span id="insertion">Six</span
><div>Seven</div
><div>Eight</div
></span>
</body>
</html>

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

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("span");
newNode.appendChild(document.createTextNode("Six"));
document.getElementById("target")
.insertBefore(newNode, document.getElementById("insertion"));
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
><span>One</span
><span>Two</span
><span>Three</span
><div>Four</div
><div>Five</div
><div id="insertion">Seven</div
><div>Eight</div
></span>
</body>
</html>

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

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("div");
newNode.appendChild(document.createTextNode("Seven"));
document.getElementById("target")
.insertBefore(newNode, document.getElementById("insertion"));
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
><span>One</span
><span>Two</span
><span>Three</span
><div>Four</div
><div>Five</div
><span>Six</span
><div id="insertion">Eight</div
></span>
</body>
</html>

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

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("div");
newNode.appendChild(document.createTextNode("Eight"));
document.getElementById("target")
.insertBefore(newNode, document.getElementById("insertion"));
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
><span>One</span
><span>Two</span
><span>Three</span
><div>Four</div
><div>Five</div
><span>Six</span
><div>Seven</div
></span>
</body>
</html>

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

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("div");
newNode.appendChild(document.createTextNode("Eight"));
document.getElementById("target").appendChild(newNode);
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
><span>One</span
><span>Two</span
><span>Three</span
><div>Four</div
><div>Five</div
><span>Six</span
><div>Seven</div
></span>
</body>
</html>

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

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body>
<span
><span>One</span
><span>Two</span
><span>Three</span
><div>Four</div
><div>Five</div
><span>Six</span
><div>Seven</div
><div>Eight</div
><span>Nine</span
></span>
</body>
</html>

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

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("span");
newNode.appendChild(document.createTextNode("Nine"));
document.getElementById("target").appendChild(newNode);
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
><span>One</span
><span>Two</span
><span>Three</span
><div>Four</div
><div>Five</div
><span>Six</span
><div>Seven</div
><div>Eight</div
></span>
</body>
</html>

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

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body>
<span
><span>One</span
><span>Two</span
><span>Three</span
><div>Four</div
><div>Five</div
><span>Six</span
><div>Seven</div
><div>Eight</div
><span>Nine</span
><span>Ten</span
></span>
</body>
</html>

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

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("span");
newNode.appendChild(document.createTextNode("Nine"));
document.getElementById("target")
.insertBefore(newNode, document.getElementById("insertion"));
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
><span>One</span
><span>Two</span
><span>Three</span
><div>Four</div
><div>Five</div
><span>Six</span
><div>Seven</div
><div>Eight</div
><span id="insertion">Ten</span
></span>
</body>
</html>

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

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body>
<span
><span>One</span
><span>Two</span
><span>Three</span
><div>Four</div
><div>Five</div
><span>Six</span
><div>Seven</div
><div>Eight</div
><span>Nine</span
></span>
</body>
</html>

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

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("span");
newNode.appendChild(document.createTextNode("Nine"));
document.getElementById("target").appendChild(newNode);
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
style="-moz-binding: url(insert-into-split-inline-force-ContentInserted.xml#test);"
><span>One</span
><span>Two</span
><span>Three</span
><div>Four</div
><div>Five</div
><span>Six</span
><div>Seven</div
><div>Eight</div
></span>
</body>
</html>

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

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body>
<span
><div>One</div
><div>Two</div
></span>
</body>
</html>

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

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("div");
newNode.appendChild(document.createTextNode("One"));
document.getElementById("target")
.insertBefore(newNode, document.getElementById("insertion"));
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
><div id="insertion">Two</div
></span>
</body>
</html>

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

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body>
<span
><div>One</div
><span>Two</div
></span>
</body>
</html>

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

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("div");
newNode.appendChild(document.createTextNode("One"));
document.getElementById("target")
.insertBefore(newNode, document.getElementById("insertion"));
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
><span id="insertion">Two</div
></span>
</body>
</html>

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

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body>
<span
><span>One</span
><div>Two</div
><span>Three</span
><div>Four</div
><span>Five</span
></span>
</body>
</html>

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

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("div");
newNode.appendChild(document.createTextNode("Two"));
document.getElementById("target")
.insertBefore(newNode, document.getElementById("insertion"));
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
><span>One</span
><span id="insertion">Three</span
><div>Four</div
><span>Five</span
></span>
</body>
</html>

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

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var newNode = document.createElement("div");
newNode.appendChild(document.createTextNode("Four"));
document.getElementById("target")
.insertBefore(newNode, document.getElementById("insertion"));
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span id="target"
><span>One</span
><div>Two</div
><span>Three</span
><span id="insertion">Five</span
></span>
</body>
</html>

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

@ -0,0 +1,11 @@
<bindings xmlns="http://www.mozilla.org/xbl">
<binding id="test">
<content>
<!-- Multiple insertion points to force appends to be handled via
ContentInserted -->
<children includes="foo"/>
<children includes="bar"/>
<children/>
</content>
</binding>
</bindings>

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

@ -0,0 +1,34 @@
== remove-split-inline-1.html remove-split-inline-1-ref.html
== remove-from-split-inline-1.html remove-from-split-inline-1-ref.html
== remove-from-split-inline-2.html remove-from-split-inline-2-ref.html
== remove-from-split-inline-3.html remove-from-split-inline-3-ref.html
== remove-from-split-inline-4.html remove-from-split-inline-4-ref.html
== remove-from-split-inline-5.html remove-from-split-inline-5-ref.html
== insert-into-split-inline-1a.html insert-into-split-inline-1-ref.html
== insert-into-split-inline-1b.html insert-into-split-inline-1-ref.html
== insert-into-split-inline-1c.html insert-into-split-inline-1-ref.html
== insert-into-split-inline-1d.html insert-into-split-inline-1-ref.html
== insert-into-split-inline-1e.html insert-into-split-inline-1-ref.html
== insert-into-split-inline-1f.html insert-into-split-inline-1-ref.html
== insert-into-split-inline-1g.html insert-into-split-inline-1-ref.html
== insert-into-split-inline-1h.html insert-into-split-inline-1-ref.html
== insert-into-split-inline-1i.html insert-into-split-inline-1-ref.html
== insert-into-split-inline-1j.html insert-into-split-inline-1-ref.html
== insert-into-split-inline-1k.html insert-into-split-inline-1-ref.html
== insert-into-split-inline-1l.html insert-into-split-inline-1-ref.html
== insert-into-split-inline-2a.html insert-into-split-inline-2-ref.html
== insert-into-split-inline-2b.html insert-into-split-inline-2-ref.html
== insert-into-split-inline-2c.html insert-into-split-inline-2-ref.html
== insert-into-split-inline-2d.html insert-into-split-inline-2-ref.html
== insert-into-split-inline-2e.html insert-into-split-inline-2-ref.html
== insert-into-split-inline-2f.html insert-into-split-inline-2-ref.html
== insert-into-split-inline-2g.html insert-into-split-inline-2-ref.html
== insert-into-split-inline-2h.html insert-into-split-inline-2-ref.html
== insert-into-split-inline-2i.html insert-into-split-inline-2-ref.html
== insert-into-split-inline-3.html insert-into-split-inline-3-ref.html
== insert-into-split-inline-4.html insert-into-split-inline-4-ref.html
== insert-into-split-inline-5.html insert-into-split-inline-5-ref.html
== insert-into-split-inline-6.html insert-into-split-inline-6-ref.html
== insert-into-split-inline-7.html insert-into-split-inline-7-ref.html
== insert-into-split-inline-8a.html insert-into-split-inline-8-ref.html
== insert-into-split-inline-8b.html insert-into-split-inline-8-ref.html

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

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body>
<span
><div>One</div>
Two
</span>
</body>
</html>

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

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var target = document.getElementById("target");
target.parentNode.removeChild(target);
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span
><span id="target">Four</span
><div>One</div>
Two
</span>
</body>
</html>

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

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body>
<span>
One
Two
</span>
</body>
</html>

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

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var target = document.getElementById("target");
target.parentNode.removeChild(target);
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span>
One
<div id="target">Three</div>
Two
</span>
</body>
</html>

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

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body>
<span>
One
<div>Two</div
></span>
</body>
</html>

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

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var target = document.getElementById("target");
target.parentNode.removeChild(target);
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
</head>
<body onload='doit()'>
<span>
One
<div>Two</div
><span id="target">Three</span
></span>
</body>
</html>

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

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body>
<span>
One
Two
<div>Three</div>
Four
</span>
</body>
</html>

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

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var target = document.getElementById("target");
target.parentNode.removeChild(target);
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span>
One
<div id="target">Five</div>
Two
<div>Three</div>
Four
</span>
</body>
</html>

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

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body>
<span>
One
<div>Two</div>
Three
Four
</span>
</body>
</html>

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

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var target = document.getElementById("target");
target.parentNode.removeChild(target);
}
</script>
<style>
body > span { border: 3px solid blue }
</style>
</head>
<body onload='doit()'>
<span>
One
<div>Two</div>
Three
<div id="target">Five</div>
Four
</span>
</body>
</html>

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

@ -0,0 +1,7 @@
<!DOCTYPE html>
<html>
<body>
One
Two
</body>
</html>

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

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<script>
function doit() {
var target = document.getElementById("target");
target.parentNode.removeChild(target);
}
</script>
</head>
<body onload='doit()'>
One
<span id="target">
Three
<div>Four</div>
Five
</span>
Two
</body>
</html>

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

@ -61,3 +61,6 @@ include columns/reftest.list
# image-region/ # image-region/
include image-region/reftest.list include image-region/reftest.list
# block-inside-inline splits
include ib-split/reftest.list