diff options
Diffstat (limited to 'layout/base/nsCSSFrameConstructor.cpp')
-rw-r--r-- | layout/base/nsCSSFrameConstructor.cpp | 163 |
1 files changed, 4 insertions, 159 deletions
diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 19f450e66..053351ee1 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -8130,22 +8130,11 @@ nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aContainer, prevSibling = ::FindAppendPrevSibling(insertion.mParentFrame, appendAfterFrame); } - if (haveFirstLineStyle && insertion.mParentFrame == containingBlock) { + if (haveFirstLineStyle && insertion.mParentFrame == containingBlock && isAppend) { // It's possible that the new frame goes into a first-line // frame. Look at it and see... - if (isAppend) { - // Use append logic when appending - AppendFirstLineFrames(state, containingBlock->GetContent(), - containingBlock, frameItems); - } - else { - // Use more complicated insert logic when inserting - // XXXbz this method is a no-op, so it's easy for the args being passed - // here to make no sense without anyone noticing... If it ever stops - // being a no-op, vet them carefully! - InsertFirstLineFrames(state, container, containingBlock, &insertion.mParentFrame, - prevSibling, frameItems); - } + AppendFirstLineFrames(state, containingBlock->GetContent(), + containingBlock, frameItems); } // We might have captions; put them into the caption list of the @@ -8228,8 +8217,7 @@ nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aContainer, #endif #ifdef ACCESSIBILITY - nsAccessibilityService* accService = nsIPresShell::AccService(); - if (accService) { + if (nsAccessibilityService* accService = nsIPresShell::AccService()) { accService->ContentRangeInserted(mPresShell, aContainer, aStartChild, aEndChild); } @@ -11095,149 +11083,6 @@ nsCSSFrameConstructor::AppendFirstLineFrames( lineFrame, aFrameItems); } -// Special routine to handle inserting a new frame into a block -// frame's child list. Takes care of placing the new frame into the -// right place when first-line style is present. -void -nsCSSFrameConstructor::InsertFirstLineFrames( - nsFrameConstructorState& aState, - nsIContent* aContent, - nsIFrame* aBlockFrame, - nsContainerFrame** aParentFrame, - nsIFrame* aPrevSibling, - nsFrameItems& aFrameItems) -{ - // XXXbz If you make this method actually do something, check to - // make sure that the caller is passing what you expect. In - // particular, which content is aContent? And audit the rest of - // this code too; it makes bogus assumptions and may not build. -#if 0 - nsIFrame* parentFrame = *aParentFrame; - nsIFrame* newFrame = aFrameItems.childList; - bool isInline = IsInlineOutside(newFrame); - - if (!aPrevSibling) { - // Insertion will become the first frame. Two cases: we either - // already have a first-line frame or we don't. - nsIFrame* firstBlockKid = aBlockFrame->PrincipalChildList().FirstChild(); - if (firstBlockKid->GetType() == nsGkAtoms::lineFrame) { - // We already have a first-line frame - nsIFrame* lineFrame = firstBlockKid; - - if (isInline) { - // Easy case: the new inline frame will go into the lineFrame. - ReparentFrame(this, lineFrame, newFrame); - InsertFrames(lineFrame, kPrincipalList, nullptr, newFrame); - - // Since the frame is going into the lineFrame, don't let it - // go into the block too. - aFrameItems.childList = nullptr; - aFrameItems.lastChild = nullptr; - } - else { - // Harder case: We are about to insert a block level element - // before the first-line frame. - // XXX need a method to steal away frames from the line-frame - } - } - else { - // We do not have a first-line frame - if (isInline) { - // We now need a first-line frame to contain the inline frame. - nsIFrame* lineFrame = NS_NewFirstLineFrame(firstLineStyle); - - if (NS_SUCCEEDED(rv)) { - // Lookup first-line style context - nsStyleContext* parentStyle = - nsFrame::CorrectStyleParentFrame(aBlockFrame, - nsCSSPseudoElements::firstLine)-> - StyleContext(); - RefPtr<nsStyleContext> firstLineStyle = - GetFirstLineStyle(aContent, parentStyle); - - // Initialize the line frame - InitAndRestoreFrame(aState, aContent, aBlockFrame, lineFrame); - - // Make sure the caller inserts the lineFrame into the - // blocks list of children. - aFrameItems.childList = lineFrame; - aFrameItems.lastChild = lineFrame; - - // Give the inline frames to the lineFrame <b>after</b> - // reparenting them - NS_ASSERTION(lineFrame->StyleContext() == firstLineStyle, - "Bogus style context on line frame"); - ReparentFrame(aPresContext, lineFrame, newFrame); - lineFrame->SetInitialChildList(kPrincipalList, newFrame); - } - } - else { - // Easy case: the regular insertion logic can insert the new - // frame because it's a block frame. - } - } - } - else { - // Insertion will not be the first frame. - nsIFrame* prevSiblingParent = aPrevSibling->GetParent(); - if (prevSiblingParent == aBlockFrame) { - // Easy case: The prev-siblings parent is the block - // frame. Therefore the prev-sibling is not currently in a - // line-frame. Therefore the new frame which is going after it, - // regardless of type, is not going into a line-frame. - } - else { - // If the prevSiblingParent is not the block-frame then it must - // be a line-frame (if it were a letter-frame, that logic would - // already have adjusted the prev-sibling to be the - // letter-frame). - if (isInline) { - // Easy case: the insertion can go where the caller thinks it - // should go (which is into prevSiblingParent). - } - else { - // Block elements don't end up in line-frames, therefore - // change the insertion point to aBlockFrame. However, there - // might be more inline elements following aPrevSibling that - // need to be pulled out of the line-frame and become children - // of the block. - nsIFrame* nextSibling = aPrevSibling->GetNextSibling(); - nsIFrame* nextLineFrame = prevSiblingParent->GetNextInFlow(); - if (nextSibling || nextLineFrame) { - // Oy. We have work to do. Create a list of the new frames - // that are going into the block by stripping them away from - // the line-frame(s). - if (nextSibling) { - nsLineFrame* lineFrame = (nsLineFrame*) prevSiblingParent; - nsFrameList tail = lineFrame->StealFramesAfter(aPrevSibling); - // XXX do something with 'tail' - } - - nsLineFrame* nextLineFrame = (nsLineFrame*) lineFrame; - for (;;) { - nextLineFrame = nextLineFrame->GetNextInFlow(); - if (!nextLineFrame) { - break; - } - nsIFrame* kids = nextLineFrame->PrincipalChildList().FirstChild(); - } - } - else { - // We got lucky: aPrevSibling was the last inline frame in - // the line-frame. - ReparentFrame(this, aBlockFrame, newFrame); - InsertFrames(aBlockFrame, kPrincipalList, - prevSiblingParent, newFrame); - aFrameItems.childList = nullptr; - aFrameItems.lastChild = nullptr; - } - } - } - } - -#endif -} - //---------------------------------------------------------------------- // First-letter support |