зеркало из https://github.com/mozilla/gecko-dev.git
Bug 577309 part 9. Stop using content indices in GetInsertionPrevSibling. r=tnikkel
This commit is contained in:
Родитель
f8d11ee8bc
Коммит
f09e89345a
|
@ -6015,26 +6015,11 @@ nsIFrame*
|
|||
nsCSSFrameConstructor::GetInsertionPrevSibling(nsIFrame*& aParentFrame,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer,
|
||||
PRBool* aIsAppend,
|
||||
PRBool* aIsRangeInsertSafe,
|
||||
PRInt32 aStartSkipIndexInContainer,
|
||||
nsIContent* aStartSkipChild,
|
||||
PRInt32 aEndSkipIndexInContainer,
|
||||
nsIContent *aEndSkipChild)
|
||||
nsIContent* aEndSkipChild)
|
||||
{
|
||||
NS_PRECONDITION((aStartSkipIndexInContainer >= 0) == !!aStartSkipChild,
|
||||
"aStartSkipIndexInContainer >= 0 iff aStartSkipChild");
|
||||
NS_PRECONDITION((aEndSkipIndexInContainer >= 0) == !!aEndSkipChild,
|
||||
"aEndSkipIndexInContainer >= 0 iff aEndSkipChild");
|
||||
NS_PRECONDITION((aStartSkipIndexInContainer >= 0 &&
|
||||
aEndSkipIndexInContainer >= 0 &&
|
||||
aEndSkipIndexInContainer > aStartSkipIndexInContainer) ||
|
||||
(aStartSkipIndexInContainer == -1 &&
|
||||
aEndSkipIndexInContainer == -1),
|
||||
"aStartSkipIndexInContainer and aEndSkipIndexInContainer "
|
||||
"should both be valid and in correct order or both invalid");
|
||||
|
||||
*aIsAppend = PR_FALSE;
|
||||
|
||||
// Find the frame that precedes the insertion point. Walk backwards
|
||||
|
@ -6059,10 +6044,6 @@ nsCSSFrameConstructor::GetInsertionPrevSibling(nsIFrame*& aParentFrame,
|
|||
iter.seek(aChild);
|
||||
}
|
||||
}
|
||||
// If xblCase is true, aIndexInContainer is almost certainly bogus, but don't
|
||||
// change in here. If someone wants to use an index below, they should make
|
||||
// sure to use the right index (aIndexInContainer vs iter.position()) with
|
||||
// the right parent node.
|
||||
#ifdef DEBUG
|
||||
else {
|
||||
NS_WARNING("Someone passed native anonymous content directly into frame "
|
||||
|
@ -6987,8 +6968,7 @@ nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aContainer,
|
|||
|
||||
PRBool isAppend, isRangeInsertSafe;
|
||||
nsIFrame* prevSibling =
|
||||
GetInsertionPrevSibling(parentFrame, aContainer,
|
||||
aStartChild, aIndexInContainer,
|
||||
GetInsertionPrevSibling(parentFrame, aContainer, aStartChild,
|
||||
&isAppend, &isRangeInsertSafe);
|
||||
|
||||
// check if range insert is safe
|
||||
|
@ -7106,8 +7086,8 @@ nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aContainer,
|
|||
// and creating frames. We need to reget our prevsibling, parent frame,
|
||||
// etc.
|
||||
prevSibling = GetInsertionPrevSibling(parentFrame, aContainer,
|
||||
aStartChild, aIndexInContainer,
|
||||
&isAppend, &isRangeInsertSafe);
|
||||
aStartChild, &isAppend,
|
||||
&isRangeInsertSafe);
|
||||
|
||||
// Need check whether a range insert is still safe.
|
||||
if (!isSingleInsert && !isRangeInsertSafe) {
|
||||
|
@ -7296,17 +7276,16 @@ nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aContainer,
|
|||
if (isSingleInsert) {
|
||||
captionPrevSibling =
|
||||
GetInsertionPrevSibling(captionParent, aContainer, aStartChild,
|
||||
aIndexInContainer, &captionIsAppend, &ignored);
|
||||
&captionIsAppend, &ignored);
|
||||
} else {
|
||||
nsIContent* firstCaption = captionItems.FirstChild()->GetContent();
|
||||
// It is very important here that we skip the children in
|
||||
// [aIndexInContainer,aEndIndexInContainer) when looking for a
|
||||
// [aStartChild,aEndChild) when looking for a
|
||||
// prevsibling.
|
||||
captionPrevSibling =
|
||||
GetInsertionPrevSibling(captionParent, aContainer, firstCaption,
|
||||
aContainer->IndexOf(firstCaption), &captionIsAppend, &ignored,
|
||||
aIndexInContainer, aStartChild,
|
||||
aEndIndexInContainer, aContainer->GetChildAt(aEndIndexInContainer));
|
||||
&captionIsAppend, &ignored,
|
||||
aStartChild, aEndChild);
|
||||
}
|
||||
|
||||
nsIFrame* outerTable = nsnull;
|
||||
|
|
|
@ -1784,27 +1784,22 @@ private:
|
|||
// Find the right previous sibling for an insertion. This also updates the
|
||||
// parent frame to point to the correct continuation of the parent frame to
|
||||
// use, and returns whether this insertion is to be treated as an append.
|
||||
// aChild is the child being inserted and aIndexInContainer its index in
|
||||
// aContainer (which is aChild's DOM parent).
|
||||
// aChild is the child being inserted.
|
||||
// aIsRangeInsertSafe returns whether it is safe to do a range insert with
|
||||
// aChild being the first child in the range. It is the callers'
|
||||
// responsibility to check whether a range insert is safe with regards to
|
||||
// fieldsets.
|
||||
// The skip parameters are used to ignore a range of children when looking
|
||||
// for a sibling. All nodes starting from aStartSkipChild (which is in
|
||||
// aContainer's regular child list at aStartSkipIndexInContainer) and up to
|
||||
// but not including aEndSkipChild (which is at aEndSkipIndexInContainer in
|
||||
// aContainer) will be skipped over when looking for sibling frames. Skipping
|
||||
// a range can deal with XBL but not when there are multiple insertion points.
|
||||
// for a sibling. All nodes starting from aStartSkipChild and up to but not
|
||||
// including aEndSkipChild will be skipped over when looking for sibling
|
||||
// frames. Skipping a range can deal with XBL but not when there are multiple
|
||||
// insertion points.
|
||||
nsIFrame* GetInsertionPrevSibling(nsIFrame*& aParentFrame, /* inout */
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer,
|
||||
PRBool* aIsAppend,
|
||||
PRBool* aIsRangeInsertSafe,
|
||||
PRInt32 aStartSkipIndexInContainer = -1,
|
||||
nsIContent* aStartSkipChild = nsnull,
|
||||
PRInt32 aEndSkipIndexInContainer = -1,
|
||||
nsIContent *aEndSkipChild = nsnull);
|
||||
|
||||
// see if aContent and aSibling are legitimate siblings due to restrictions
|
||||
|
|
Загрузка…
Ссылка в новой задаче