mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-18 13:17:29 +09:00
Bug 1415538 - Remove dead frame construction code (InsertFirstLineFrames)
Tag #1375
This commit is contained in:
parent
40ada5fa00
commit
b67dd1398d
2 changed files with 4 additions and 166 deletions
|
|
@ -8130,22 +8130,11 @@ nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aContainer,
|
||||||
prevSibling = ::FindAppendPrevSibling(insertion.mParentFrame, appendAfterFrame);
|
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
|
// It's possible that the new frame goes into a first-line
|
||||||
// frame. Look at it and see...
|
// frame. Look at it and see...
|
||||||
if (isAppend) {
|
AppendFirstLineFrames(state, containingBlock->GetContent(),
|
||||||
// Use append logic when appending
|
containingBlock, frameItems);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We might have captions; put them into the caption list of the
|
// We might have captions; put them into the caption list of the
|
||||||
|
|
@ -8228,8 +8217,7 @@ nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aContainer,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ACCESSIBILITY
|
#ifdef ACCESSIBILITY
|
||||||
nsAccessibilityService* accService = nsIPresShell::AccService();
|
if (nsAccessibilityService* accService = nsIPresShell::AccService()) {
|
||||||
if (accService) {
|
|
||||||
accService->ContentRangeInserted(mPresShell, aContainer,
|
accService->ContentRangeInserted(mPresShell, aContainer,
|
||||||
aStartChild, aEndChild);
|
aStartChild, aEndChild);
|
||||||
}
|
}
|
||||||
|
|
@ -11095,149 +11083,6 @@ nsCSSFrameConstructor::AppendFirstLineFrames(
|
||||||
lineFrame, aFrameItems);
|
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
|
// First-letter support
|
||||||
|
|
|
||||||
|
|
@ -1955,13 +1955,6 @@ private:
|
||||||
nsContainerFrame* aBlockFrame,
|
nsContainerFrame* aBlockFrame,
|
||||||
nsFrameItems& aFrameItems);
|
nsFrameItems& aFrameItems);
|
||||||
|
|
||||||
void InsertFirstLineFrames(nsFrameConstructorState& aState,
|
|
||||||
nsIContent* aContent,
|
|
||||||
nsIFrame* aBlockFrame,
|
|
||||||
nsContainerFrame** aParentFrame,
|
|
||||||
nsIFrame* aPrevSibling,
|
|
||||||
nsFrameItems& aFrameItems);
|
|
||||||
|
|
||||||
// The direction in which we should look for siblings.
|
// The direction in which we should look for siblings.
|
||||||
enum class SiblingDirection
|
enum class SiblingDirection
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue