зеркало из https://github.com/mozilla/gecko-dev.git
Bug 577309 part 10. Stop using content indices in GetRangeInsertionPoint. r=tnikkel
This commit is contained in:
Родитель
f09e89345a
Коммит
4af3b5f631
|
@ -6413,6 +6413,8 @@ nsCSSFrameConstructor::IssueSingleInsertNofications(nsIContent* aContainer,
|
||||||
nsIFrame*
|
nsIFrame*
|
||||||
nsCSSFrameConstructor::GetRangeInsertionPoint(nsIContent* aContainer,
|
nsCSSFrameConstructor::GetRangeInsertionPoint(nsIContent* aContainer,
|
||||||
nsIFrame* aParentFrame,
|
nsIFrame* aParentFrame,
|
||||||
|
nsIContent* aStartChild,
|
||||||
|
nsIContent* aEndChild,
|
||||||
PRInt32 aStartIndexInContainer,
|
PRInt32 aStartIndexInContainer,
|
||||||
PRInt32 aEndIndexInContainer,
|
PRInt32 aEndIndexInContainer,
|
||||||
PRBool aAllowLazyConstruction)
|
PRBool aAllowLazyConstruction)
|
||||||
|
@ -6428,14 +6430,11 @@ nsCSSFrameConstructor::GetRangeInsertionPoint(nsIContent* aContainer,
|
||||||
|
|
||||||
PRBool hasInsertion = PR_FALSE;
|
PRBool hasInsertion = PR_FALSE;
|
||||||
if (!multiple) {
|
if (!multiple) {
|
||||||
nsIDocument* document = nsnull;
|
// XXXbz XBL2/sXBL issue
|
||||||
nsIContent *firstAppendedChild =
|
nsIDocument* document = aStartChild->GetDocument();
|
||||||
aContainer->GetChildAt(aStartIndexInContainer);
|
// XXXbz how would |document| be null here?
|
||||||
if (firstAppendedChild) {
|
|
||||||
document = firstAppendedChild->GetDocument();
|
|
||||||
}
|
|
||||||
if (document &&
|
if (document &&
|
||||||
document->BindingManager()->GetInsertionParent(firstAppendedChild)) {
|
document->BindingManager()->GetInsertionParent(aStartChild)) {
|
||||||
hasInsertion = PR_TRUE;
|
hasInsertion = PR_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6462,13 +6461,13 @@ nsCSSFrameConstructor::GetRangeInsertionPoint(nsIContent* aContainer,
|
||||||
// If we have multiple insertion points or if we have an insertion point
|
// If we have multiple insertion points or if we have an insertion point
|
||||||
// and the operation is not a true append or if the insertion point already
|
// and the operation is not a true append or if the insertion point already
|
||||||
// has explicit children, then we must fall back.
|
// has explicit children, then we must fall back.
|
||||||
if (multiple || aEndIndexInContainer != -1 || childCount > 0) {
|
if (multiple || aEndChild != nsnull || childCount > 0) {
|
||||||
// Now comes the fun part. For each appended child, make a
|
// Now comes the fun part. For each inserted child, make a
|
||||||
// ContentInserted call as if it had just gotten inserted at the index
|
// ContentInserted call as if it had just gotten inserted at the index
|
||||||
// it's at in aContainer and let ContentInserted handle the mess. If our
|
// it's at in aContainer and let ContentInserted handle the mess. If our
|
||||||
// insertion point is non-XBL that's the correct index, and otherwise
|
// insertion point is non-XBL that's the correct index, and otherwise
|
||||||
// ContentInserted will ignore the passed-in index.
|
// ContentInserted will ignore the passed-in index.
|
||||||
PRUint32 endIndex = aEndIndexInContainer == -1 ?
|
PRUint32 endIndex = aEndChild == nsnull ?
|
||||||
aContainer->GetChildCount() : aEndIndexInContainer;
|
aContainer->GetChildCount() : aEndIndexInContainer;
|
||||||
IssueSingleInsertNofications(aContainer, aStartIndexInContainer,
|
IssueSingleInsertNofications(aContainer, aStartIndexInContainer,
|
||||||
endIndex, aAllowLazyConstruction);
|
endIndex, aAllowLazyConstruction);
|
||||||
|
@ -6548,7 +6547,9 @@ nsCSSFrameConstructor::ContentAppended(nsIContent* aContainer,
|
||||||
|
|
||||||
LAYOUT_PHASE_TEMP_EXIT();
|
LAYOUT_PHASE_TEMP_EXIT();
|
||||||
parentFrame = GetRangeInsertionPoint(aContainer, parentFrame,
|
parentFrame = GetRangeInsertionPoint(aContainer, parentFrame,
|
||||||
aNewIndexInContainer, -1, aAllowLazyConstruction);
|
aFirstNewContent, nsnull,
|
||||||
|
aNewIndexInContainer, -1,
|
||||||
|
aAllowLazyConstruction);
|
||||||
LAYOUT_PHASE_TEMP_REENTER();
|
LAYOUT_PHASE_TEMP_REENTER();
|
||||||
if (!parentFrame) {
|
if (!parentFrame) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -6959,7 +6960,10 @@ nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aContainer,
|
||||||
// GetRangeInsertionPoint will take care of that for us.
|
// GetRangeInsertionPoint will take care of that for us.
|
||||||
LAYOUT_PHASE_TEMP_EXIT();
|
LAYOUT_PHASE_TEMP_EXIT();
|
||||||
parentFrame = GetRangeInsertionPoint(aContainer, parentFrame,
|
parentFrame = GetRangeInsertionPoint(aContainer, parentFrame,
|
||||||
aIndexInContainer, aEndIndexInContainer, aAllowLazyConstruction);
|
aStartChild, aEndChild,
|
||||||
|
aIndexInContainer,
|
||||||
|
aEndIndexInContainer,
|
||||||
|
aAllowLazyConstruction);
|
||||||
LAYOUT_PHASE_TEMP_REENTER();
|
LAYOUT_PHASE_TEMP_REENTER();
|
||||||
if (!parentFrame) {
|
if (!parentFrame) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
@ -149,14 +149,15 @@ private:
|
||||||
PRInt32 aEndIndexInContainer,
|
PRInt32 aEndIndexInContainer,
|
||||||
PRBool aAllowLazyConstruction);
|
PRBool aAllowLazyConstruction);
|
||||||
|
|
||||||
// Checks if the children of aContainer in the range
|
// Checks if the children of aContainer in the range [aStartChild, aEndChild)
|
||||||
// [aStartIndexInContainer, aEndIndexInContainer) can be inserted/appended
|
// can be inserted/appended to one insertion point together. If so, returns
|
||||||
// to one insertion point together. If so, returns that insertion point. If
|
// that insertion point. If not, returns null and issues single
|
||||||
// not, returns null and issues single ContentInserted calls for each child.
|
// ContentInserted calls for each child. aEndChild = nsnull indicates that we
|
||||||
// aEndIndexInContainer = -1 is a special value that indicates it is an
|
// are dealing with an append.
|
||||||
// append and the range includes the last child.
|
|
||||||
nsIFrame* GetRangeInsertionPoint(nsIContent* aContainer,
|
nsIFrame* GetRangeInsertionPoint(nsIContent* aContainer,
|
||||||
nsIFrame* aParentFrame,
|
nsIFrame* aParentFrame,
|
||||||
|
nsIContent* aStartChild,
|
||||||
|
nsIContent* aEndChild,
|
||||||
PRInt32 aStartIndexInContainer,
|
PRInt32 aStartIndexInContainer,
|
||||||
PRInt32 aEndIndexInContainer,
|
PRInt32 aEndIndexInContainer,
|
||||||
PRBool aAllowLazyConstruction);
|
PRBool aAllowLazyConstruction);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче