mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-01 11:27:55 +00:00
Fixed problems with reframing recursively due to block-in-inline frames and content appended notifications. r=karnaze sr=waterson b=56894
This commit is contained in:
parent
e4742bb5be
commit
c4ce5b9e2e
@ -1441,7 +1441,8 @@ NS_IMETHODIMP StyleSetImpl::ContentInserted(nsIPresContext* aPresContext,
|
||||
PRInt32 aIndexInContainer)
|
||||
{
|
||||
return mFrameConstructor->ContentInserted(aPresContext, aContainer,
|
||||
aChild, aIndexInContainer, nsnull);
|
||||
aChild, aIndexInContainer,
|
||||
nsnull, PR_FALSE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP StyleSetImpl::ContentReplaced(nsIPresContext* aPresContext,
|
||||
@ -1460,7 +1461,7 @@ NS_IMETHODIMP StyleSetImpl::ContentRemoved(nsIPresContext* aPresContext,
|
||||
PRInt32 aIndexInContainer)
|
||||
{
|
||||
return mFrameConstructor->ContentRemoved(aPresContext, aContainer,
|
||||
aChild, aIndexInContainer);
|
||||
aChild, aIndexInContainer, PR_FALSE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -417,10 +417,10 @@ SetFrameIsSpecial(nsIFrameManager* aFrameManager, nsIFrame* aFrame, nsIFrame* aS
|
||||
static nsIFrame*
|
||||
GetIBContainingBlockFor(nsIFrame* aFrame)
|
||||
{
|
||||
// Get the first "normal" ancestor of the target frame.
|
||||
NS_PRECONDITION(IsFrameSpecial(aFrame),
|
||||
"GetIBContainingBlockFor() should only be called on known IB frames");
|
||||
|
||||
// Get the first "normal" ancestor of the target frame.
|
||||
nsIFrame* parentFrame;
|
||||
do {
|
||||
aFrame->GetParent(&parentFrame);
|
||||
@ -436,6 +436,10 @@ GetIBContainingBlockFor(nsIFrame* aFrame)
|
||||
aFrame = parentFrame;
|
||||
} while (1);
|
||||
|
||||
// post-conditions
|
||||
NS_ASSERTION(parentFrame, "no normal ancestor found for special frame in GetIBContainingBlockFor");
|
||||
NS_ASSERTION(parentFrame != aFrame, "parentFrame is actually the child frame - bogus reslt");
|
||||
|
||||
return parentFrame;
|
||||
}
|
||||
|
||||
@ -7619,6 +7623,8 @@ FindPreviousSibling(nsIPresShell* aPresShell,
|
||||
nsIContent* aContainer,
|
||||
PRInt32 aIndexInContainer)
|
||||
{
|
||||
NS_ASSERTION(aPresShell && aContainer, "null arguments");
|
||||
|
||||
ChildIterator first, iter;
|
||||
ChildIterator::Init(aContainer, &first, &iter);
|
||||
iter.seek(aIndexInContainer);
|
||||
@ -7658,6 +7664,11 @@ FindPreviousSibling(nsIPresShell* aPresShell,
|
||||
prevSibling = placeholderFrame;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
nsIFrame* containerFrame = nsnull;
|
||||
aPresShell->GetPrimaryFrameFor(aContainer, &containerFrame);
|
||||
NS_ASSERTION(prevSibling != containerFrame, "Previous Sibling is the Container's frame");
|
||||
#endif
|
||||
// Found a previous sibling, we're done!
|
||||
return prevSibling;
|
||||
}
|
||||
@ -7905,7 +7916,7 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext,
|
||||
nsIContent* item = nsCOMPtr<nsIContent>(*iter);
|
||||
if (item == child)
|
||||
// Call ContentInserted with this index.
|
||||
ContentInserted(aPresContext, aContainer, child, iter.index(), mTempFrameTreeState);
|
||||
ContentInserted(aPresContext, aContainer, child, iter.index(), mTempFrameTreeState, PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8302,7 +8313,8 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer,
|
||||
nsILayoutHistoryState* aFrameState)
|
||||
nsILayoutHistoryState* aFrameState,
|
||||
PRBool aInContentReplaced)
|
||||
{
|
||||
// XXXldb Do we need to re-resolve style to handle the CSS2 + combinator and
|
||||
// the :empty pseudo-class?
|
||||
@ -8586,7 +8598,9 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext,
|
||||
// If the frame we are manipulating is a special frame then do
|
||||
// something different instead of just inserting newly created
|
||||
// frames.
|
||||
if (IsFrameSpecial(parentFrame)) {
|
||||
// NOTE: if we are in ContentReplaced,
|
||||
// then do not reframe as we are already doing just that!
|
||||
if (IsFrameSpecial(parentFrame) && !aInContentReplaced) {
|
||||
// We are pretty harsh here (and definitely not optimal) -- we
|
||||
// wipe out the entire containing block and recreate it from
|
||||
// scratch. The reason is that because we know that a special
|
||||
@ -8832,10 +8846,11 @@ nsCSSFrameConstructor::ContentReplaced(nsIPresContext* aPresContext,
|
||||
{
|
||||
// XXX For now, do a brute force remove and insert.
|
||||
nsresult res = ContentRemoved(aPresContext, aContainer,
|
||||
aOldChild, aIndexInContainer);
|
||||
if (NS_OK == res) {
|
||||
aOldChild, aIndexInContainer, PR_TRUE);
|
||||
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
res = ContentInserted(aPresContext, aContainer,
|
||||
aNewChild, aIndexInContainer, nsnull);
|
||||
aNewChild, aIndexInContainer, nsnull, PR_TRUE);
|
||||
}
|
||||
|
||||
return res;
|
||||
@ -9169,7 +9184,8 @@ NS_IMETHODIMP
|
||||
nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer)
|
||||
PRInt32 aIndexInContainer,
|
||||
PRBool aInContentReplaced)
|
||||
{
|
||||
// XXXldb Do we need to re-resolve style to handle the CSS2 + combinator and
|
||||
// the :empty pseudo-class?
|
||||
@ -9340,7 +9356,9 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext,
|
||||
// If the frame we are manipulating is a special frame then do
|
||||
// something different instead of just inserting newly created
|
||||
// frames.
|
||||
if (IsFrameSpecial(childFrame)) {
|
||||
// NOTE: if we are in ContentReplaced,
|
||||
// then do not reframe as we are already doing just that!
|
||||
if (IsFrameSpecial(childFrame) && !aInContentReplaced) {
|
||||
// We are pretty harsh here (and definitely not optimal) -- we
|
||||
// wipe out the entire containing block and recreate it from
|
||||
// scratch. The reason is that because we know that a special
|
||||
@ -11751,7 +11769,7 @@ nsCSSFrameConstructor::RecreateFramesForContent(nsIPresContext* aPresContext,
|
||||
|
||||
// Remove the frames associated with the content object on which the
|
||||
// attribute change occurred.
|
||||
rv = ContentRemoved(aPresContext, container, aContent, indexInContainer);
|
||||
rv = ContentRemoved(aPresContext, container, aContent, indexInContainer, PR_FALSE);
|
||||
|
||||
// Now that the old frame is gone (and has stopped depending on obsolete style
|
||||
// data, we need to blow away our style information if this reframe happened as
|
||||
@ -11768,7 +11786,7 @@ nsCSSFrameConstructor::RecreateFramesForContent(nsIPresContext* aPresContext,
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Now, recreate the frames associated with this content object.
|
||||
rv = ContentInserted(aPresContext, container, aContent, indexInContainer, mTempFrameTreeState);
|
||||
rv = ContentInserted(aPresContext, container, aContent, indexInContainer, mTempFrameTreeState, PR_FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -13904,25 +13922,33 @@ nsresult
|
||||
nsCSSFrameConstructor::ReframeContainingBlock(nsIPresContext* aPresContext, nsIFrame* aFrame)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (gNoisyContentUpdates) {
|
||||
PRBool isAttinasi = PR_FALSE;
|
||||
#ifdef DEBUG_attinasi
|
||||
isAttinasi = PR_TRUE;
|
||||
#endif // DEBUG_attinasi
|
||||
|
||||
// ReframeContainingBlock is a NASTY routine, it causes terrible performance problems
|
||||
// so I want to see when it is happening! Unfortunately, it is happening way to often because
|
||||
// so much content on the web causes 'special' block-in-inline frame situations and we handle them
|
||||
// very poorly
|
||||
if (gNoisyContentUpdates || isAttinasi) {
|
||||
printf("nsCSSFrameConstructor::ReframeContainingBlock frame=%p\n",
|
||||
NS_STATIC_CAST(void*, aFrame));
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get the first "normal" ancestor of the target frame.
|
||||
nsIFrame* parentFrame = GetIBContainingBlockFor(aFrame);
|
||||
if (parentFrame) {
|
||||
nsIFrame* containingBlock = GetIBContainingBlockFor(aFrame);
|
||||
if (containingBlock) {
|
||||
// From here we look for the containing block in case the target
|
||||
// frame is already a block (which can happen when an inline frame
|
||||
// wraps some of its content in an anonymous block; see
|
||||
// ConstructInline)
|
||||
//
|
||||
// XXXwaterson I don't think this extra step is necessary: we
|
||||
// should just be able to recreate the frames starting from the IB
|
||||
// containing block.
|
||||
nsIFrame* containingBlock = GetFloaterContainingBlock(aPresContext, aFrame);
|
||||
if (containingBlock) {
|
||||
|
||||
// NOTE: We used to get the FloaterContainingBlock here, but it was often wrong.
|
||||
// GetIBContainingBlock works much better and provides the correct container in all cases
|
||||
// so GetFloaterContainingBlock(aPresContext, aFrame) has been removed
|
||||
|
||||
// And get the containingBlock's content
|
||||
nsCOMPtr<nsIContent> blockContent;
|
||||
containingBlock->GetContent(getter_AddRefs(blockContent));
|
||||
@ -13931,22 +13957,18 @@ nsCSSFrameConstructor::ReframeContainingBlock(nsIPresContext* aPresContext, nsIF
|
||||
nsCOMPtr<nsIContent> parentContainer;
|
||||
blockContent->GetParent(*getter_AddRefs(parentContainer));
|
||||
if (parentContainer) {
|
||||
|
||||
#ifdef DEBUG
|
||||
if (gNoisyContentUpdates) {
|
||||
printf(" ==> blockContent=%p, parentContainer=%p\n",
|
||||
NS_STATIC_CAST(void*, blockContent),
|
||||
NS_STATIC_CAST(void*, parentContainer));
|
||||
blockContent.get(), parentContainer.get());
|
||||
}
|
||||
#endif
|
||||
|
||||
PRInt32 ix;
|
||||
parentContainer->IndexOf(blockContent, ix);
|
||||
return ContentReplaced(aPresContext, parentContainer, blockContent, blockContent, ix);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we get here, we're screwed!
|
||||
return RecreateEntireFrameTree(aPresContext);
|
||||
|
@ -101,7 +101,8 @@ public:
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer,
|
||||
nsILayoutHistoryState* aFrameState);
|
||||
nsILayoutHistoryState* aFrameState,
|
||||
PRBool aInContentReplaced);
|
||||
|
||||
NS_IMETHOD ContentReplaced(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
@ -112,14 +113,17 @@ public:
|
||||
NS_IMETHOD ContentRemoved(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer);
|
||||
PRInt32 aIndexInContainer,
|
||||
PRBool aInContentReplaced);
|
||||
|
||||
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsISupports* aSubContent);
|
||||
|
||||
NS_IMETHOD ContentStatesChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent1,
|
||||
nsIContent* aContent2);
|
||||
|
||||
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
PRInt32 aNameSpaceID,
|
||||
@ -132,9 +136,11 @@ public:
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule,
|
||||
PRInt32 aHint); // See nsStyleConsts fot hint values
|
||||
|
||||
NS_IMETHOD StyleRuleAdded(nsIPresContext* aPresContext,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule);
|
||||
|
||||
NS_IMETHOD StyleRuleRemoved(nsIPresContext* aPresContext,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule);
|
||||
@ -747,7 +753,8 @@ protected:
|
||||
PRBool UseXBLForms();
|
||||
|
||||
nsresult RecreateFramesForContent(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent, PRBool aInlineStyle = PR_FALSE,
|
||||
nsIContent* aContent,
|
||||
PRBool aInlineStyle = PR_FALSE,
|
||||
nsIStyleRule* aRule = nsnull,
|
||||
nsIStyleContext* aContext = nsnull);
|
||||
|
||||
|
@ -117,6 +117,9 @@ public:
|
||||
* @param aChild the content node that was inserted
|
||||
* @param aNewIndexInContainer the index of aChild in aContainer
|
||||
* @param aFrameState the layout history object used to initialize the new frame(s)
|
||||
* @param aInContentReplaced PR_TRUE must be passed in if this is called from ContentReplaced
|
||||
* - this will prevent calling ReframeContainingBlock when a special
|
||||
* inline block situation is detected
|
||||
*
|
||||
* @return NS_OK
|
||||
* @see nsIDocumentObserver
|
||||
@ -125,7 +128,8 @@ public:
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer,
|
||||
nsILayoutHistoryState* aFrameState) = 0;
|
||||
nsILayoutHistoryState* aFrameState,
|
||||
PRBool aInContentReplaced) = 0;
|
||||
|
||||
/**
|
||||
* Notification that content was replaced in the content tree.
|
||||
@ -154,6 +158,9 @@ public:
|
||||
* @param aContainer the content node into which content was appended
|
||||
* @param aChild the content node that was inserted
|
||||
* @param aNewIndexInContainer the index of aChild in aContainer
|
||||
* @param aInContentReplaced PR_TRUE must be passed in if this is called from ContentReplaced
|
||||
* - this will prevent calling ReframeContainingBlock when a special
|
||||
* inline block situation is detected
|
||||
*
|
||||
* @return NS_OK
|
||||
* @see nsIDocumentObserver
|
||||
@ -161,7 +168,8 @@ public:
|
||||
NS_IMETHOD ContentRemoved(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer) = 0;
|
||||
PRInt32 aIndexInContainer,
|
||||
PRBool aInContentReplaced) = 0;
|
||||
|
||||
/**
|
||||
* Notification that content was changed in the content tree.
|
||||
|
@ -4925,6 +4925,8 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
|
||||
NS_ASSERTION(tmp == aDeletedFrame, "bad prevSibling");
|
||||
}
|
||||
#endif
|
||||
if (line == line_end)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Remove frame and all of its continuations
|
||||
while (nsnull != aDeletedFrame) {
|
||||
|
@ -4925,6 +4925,8 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext,
|
||||
NS_ASSERTION(tmp == aDeletedFrame, "bad prevSibling");
|
||||
}
|
||||
#endif
|
||||
if (line == line_end)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Remove frame and all of its continuations
|
||||
while (nsnull != aDeletedFrame) {
|
||||
|
@ -417,10 +417,10 @@ SetFrameIsSpecial(nsIFrameManager* aFrameManager, nsIFrame* aFrame, nsIFrame* aS
|
||||
static nsIFrame*
|
||||
GetIBContainingBlockFor(nsIFrame* aFrame)
|
||||
{
|
||||
// Get the first "normal" ancestor of the target frame.
|
||||
NS_PRECONDITION(IsFrameSpecial(aFrame),
|
||||
"GetIBContainingBlockFor() should only be called on known IB frames");
|
||||
|
||||
// Get the first "normal" ancestor of the target frame.
|
||||
nsIFrame* parentFrame;
|
||||
do {
|
||||
aFrame->GetParent(&parentFrame);
|
||||
@ -436,6 +436,10 @@ GetIBContainingBlockFor(nsIFrame* aFrame)
|
||||
aFrame = parentFrame;
|
||||
} while (1);
|
||||
|
||||
// post-conditions
|
||||
NS_ASSERTION(parentFrame, "no normal ancestor found for special frame in GetIBContainingBlockFor");
|
||||
NS_ASSERTION(parentFrame != aFrame, "parentFrame is actually the child frame - bogus reslt");
|
||||
|
||||
return parentFrame;
|
||||
}
|
||||
|
||||
@ -7619,6 +7623,8 @@ FindPreviousSibling(nsIPresShell* aPresShell,
|
||||
nsIContent* aContainer,
|
||||
PRInt32 aIndexInContainer)
|
||||
{
|
||||
NS_ASSERTION(aPresShell && aContainer, "null arguments");
|
||||
|
||||
ChildIterator first, iter;
|
||||
ChildIterator::Init(aContainer, &first, &iter);
|
||||
iter.seek(aIndexInContainer);
|
||||
@ -7658,6 +7664,11 @@ FindPreviousSibling(nsIPresShell* aPresShell,
|
||||
prevSibling = placeholderFrame;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
nsIFrame* containerFrame = nsnull;
|
||||
aPresShell->GetPrimaryFrameFor(aContainer, &containerFrame);
|
||||
NS_ASSERTION(prevSibling != containerFrame, "Previous Sibling is the Container's frame");
|
||||
#endif
|
||||
// Found a previous sibling, we're done!
|
||||
return prevSibling;
|
||||
}
|
||||
@ -7905,7 +7916,7 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext,
|
||||
nsIContent* item = nsCOMPtr<nsIContent>(*iter);
|
||||
if (item == child)
|
||||
// Call ContentInserted with this index.
|
||||
ContentInserted(aPresContext, aContainer, child, iter.index(), mTempFrameTreeState);
|
||||
ContentInserted(aPresContext, aContainer, child, iter.index(), mTempFrameTreeState, PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8302,7 +8313,8 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer,
|
||||
nsILayoutHistoryState* aFrameState)
|
||||
nsILayoutHistoryState* aFrameState,
|
||||
PRBool aInContentReplaced)
|
||||
{
|
||||
// XXXldb Do we need to re-resolve style to handle the CSS2 + combinator and
|
||||
// the :empty pseudo-class?
|
||||
@ -8586,7 +8598,9 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext,
|
||||
// If the frame we are manipulating is a special frame then do
|
||||
// something different instead of just inserting newly created
|
||||
// frames.
|
||||
if (IsFrameSpecial(parentFrame)) {
|
||||
// NOTE: if we are in ContentReplaced,
|
||||
// then do not reframe as we are already doing just that!
|
||||
if (IsFrameSpecial(parentFrame) && !aInContentReplaced) {
|
||||
// We are pretty harsh here (and definitely not optimal) -- we
|
||||
// wipe out the entire containing block and recreate it from
|
||||
// scratch. The reason is that because we know that a special
|
||||
@ -8832,10 +8846,11 @@ nsCSSFrameConstructor::ContentReplaced(nsIPresContext* aPresContext,
|
||||
{
|
||||
// XXX For now, do a brute force remove and insert.
|
||||
nsresult res = ContentRemoved(aPresContext, aContainer,
|
||||
aOldChild, aIndexInContainer);
|
||||
if (NS_OK == res) {
|
||||
aOldChild, aIndexInContainer, PR_TRUE);
|
||||
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
res = ContentInserted(aPresContext, aContainer,
|
||||
aNewChild, aIndexInContainer, nsnull);
|
||||
aNewChild, aIndexInContainer, nsnull, PR_TRUE);
|
||||
}
|
||||
|
||||
return res;
|
||||
@ -9169,7 +9184,8 @@ NS_IMETHODIMP
|
||||
nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer)
|
||||
PRInt32 aIndexInContainer,
|
||||
PRBool aInContentReplaced)
|
||||
{
|
||||
// XXXldb Do we need to re-resolve style to handle the CSS2 + combinator and
|
||||
// the :empty pseudo-class?
|
||||
@ -9340,7 +9356,9 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext,
|
||||
// If the frame we are manipulating is a special frame then do
|
||||
// something different instead of just inserting newly created
|
||||
// frames.
|
||||
if (IsFrameSpecial(childFrame)) {
|
||||
// NOTE: if we are in ContentReplaced,
|
||||
// then do not reframe as we are already doing just that!
|
||||
if (IsFrameSpecial(childFrame) && !aInContentReplaced) {
|
||||
// We are pretty harsh here (and definitely not optimal) -- we
|
||||
// wipe out the entire containing block and recreate it from
|
||||
// scratch. The reason is that because we know that a special
|
||||
@ -11751,7 +11769,7 @@ nsCSSFrameConstructor::RecreateFramesForContent(nsIPresContext* aPresContext,
|
||||
|
||||
// Remove the frames associated with the content object on which the
|
||||
// attribute change occurred.
|
||||
rv = ContentRemoved(aPresContext, container, aContent, indexInContainer);
|
||||
rv = ContentRemoved(aPresContext, container, aContent, indexInContainer, PR_FALSE);
|
||||
|
||||
// Now that the old frame is gone (and has stopped depending on obsolete style
|
||||
// data, we need to blow away our style information if this reframe happened as
|
||||
@ -11768,7 +11786,7 @@ nsCSSFrameConstructor::RecreateFramesForContent(nsIPresContext* aPresContext,
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Now, recreate the frames associated with this content object.
|
||||
rv = ContentInserted(aPresContext, container, aContent, indexInContainer, mTempFrameTreeState);
|
||||
rv = ContentInserted(aPresContext, container, aContent, indexInContainer, mTempFrameTreeState, PR_FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -13904,25 +13922,33 @@ nsresult
|
||||
nsCSSFrameConstructor::ReframeContainingBlock(nsIPresContext* aPresContext, nsIFrame* aFrame)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (gNoisyContentUpdates) {
|
||||
PRBool isAttinasi = PR_FALSE;
|
||||
#ifdef DEBUG_attinasi
|
||||
isAttinasi = PR_TRUE;
|
||||
#endif // DEBUG_attinasi
|
||||
|
||||
// ReframeContainingBlock is a NASTY routine, it causes terrible performance problems
|
||||
// so I want to see when it is happening! Unfortunately, it is happening way to often because
|
||||
// so much content on the web causes 'special' block-in-inline frame situations and we handle them
|
||||
// very poorly
|
||||
if (gNoisyContentUpdates || isAttinasi) {
|
||||
printf("nsCSSFrameConstructor::ReframeContainingBlock frame=%p\n",
|
||||
NS_STATIC_CAST(void*, aFrame));
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get the first "normal" ancestor of the target frame.
|
||||
nsIFrame* parentFrame = GetIBContainingBlockFor(aFrame);
|
||||
if (parentFrame) {
|
||||
nsIFrame* containingBlock = GetIBContainingBlockFor(aFrame);
|
||||
if (containingBlock) {
|
||||
// From here we look for the containing block in case the target
|
||||
// frame is already a block (which can happen when an inline frame
|
||||
// wraps some of its content in an anonymous block; see
|
||||
// ConstructInline)
|
||||
//
|
||||
// XXXwaterson I don't think this extra step is necessary: we
|
||||
// should just be able to recreate the frames starting from the IB
|
||||
// containing block.
|
||||
nsIFrame* containingBlock = GetFloaterContainingBlock(aPresContext, aFrame);
|
||||
if (containingBlock) {
|
||||
|
||||
// NOTE: We used to get the FloaterContainingBlock here, but it was often wrong.
|
||||
// GetIBContainingBlock works much better and provides the correct container in all cases
|
||||
// so GetFloaterContainingBlock(aPresContext, aFrame) has been removed
|
||||
|
||||
// And get the containingBlock's content
|
||||
nsCOMPtr<nsIContent> blockContent;
|
||||
containingBlock->GetContent(getter_AddRefs(blockContent));
|
||||
@ -13931,22 +13957,18 @@ nsCSSFrameConstructor::ReframeContainingBlock(nsIPresContext* aPresContext, nsIF
|
||||
nsCOMPtr<nsIContent> parentContainer;
|
||||
blockContent->GetParent(*getter_AddRefs(parentContainer));
|
||||
if (parentContainer) {
|
||||
|
||||
#ifdef DEBUG
|
||||
if (gNoisyContentUpdates) {
|
||||
printf(" ==> blockContent=%p, parentContainer=%p\n",
|
||||
NS_STATIC_CAST(void*, blockContent),
|
||||
NS_STATIC_CAST(void*, parentContainer));
|
||||
blockContent.get(), parentContainer.get());
|
||||
}
|
||||
#endif
|
||||
|
||||
PRInt32 ix;
|
||||
parentContainer->IndexOf(blockContent, ix);
|
||||
return ContentReplaced(aPresContext, parentContainer, blockContent, blockContent, ix);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we get here, we're screwed!
|
||||
return RecreateEntireFrameTree(aPresContext);
|
||||
|
@ -101,7 +101,8 @@ public:
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer,
|
||||
nsILayoutHistoryState* aFrameState);
|
||||
nsILayoutHistoryState* aFrameState,
|
||||
PRBool aInContentReplaced);
|
||||
|
||||
NS_IMETHOD ContentReplaced(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
@ -112,14 +113,17 @@ public:
|
||||
NS_IMETHOD ContentRemoved(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer);
|
||||
PRInt32 aIndexInContainer,
|
||||
PRBool aInContentReplaced);
|
||||
|
||||
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsISupports* aSubContent);
|
||||
|
||||
NS_IMETHOD ContentStatesChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent1,
|
||||
nsIContent* aContent2);
|
||||
|
||||
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
PRInt32 aNameSpaceID,
|
||||
@ -132,9 +136,11 @@ public:
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule,
|
||||
PRInt32 aHint); // See nsStyleConsts fot hint values
|
||||
|
||||
NS_IMETHOD StyleRuleAdded(nsIPresContext* aPresContext,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule);
|
||||
|
||||
NS_IMETHOD StyleRuleRemoved(nsIPresContext* aPresContext,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule);
|
||||
@ -747,7 +753,8 @@ protected:
|
||||
PRBool UseXBLForms();
|
||||
|
||||
nsresult RecreateFramesForContent(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent, PRBool aInlineStyle = PR_FALSE,
|
||||
nsIContent* aContent,
|
||||
PRBool aInlineStyle = PR_FALSE,
|
||||
nsIStyleRule* aRule = nsnull,
|
||||
nsIStyleContext* aContext = nsnull);
|
||||
|
||||
|
@ -1441,7 +1441,8 @@ NS_IMETHODIMP StyleSetImpl::ContentInserted(nsIPresContext* aPresContext,
|
||||
PRInt32 aIndexInContainer)
|
||||
{
|
||||
return mFrameConstructor->ContentInserted(aPresContext, aContainer,
|
||||
aChild, aIndexInContainer, nsnull);
|
||||
aChild, aIndexInContainer,
|
||||
nsnull, PR_FALSE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP StyleSetImpl::ContentReplaced(nsIPresContext* aPresContext,
|
||||
@ -1460,7 +1461,7 @@ NS_IMETHODIMP StyleSetImpl::ContentRemoved(nsIPresContext* aPresContext,
|
||||
PRInt32 aIndexInContainer)
|
||||
{
|
||||
return mFrameConstructor->ContentRemoved(aPresContext, aContainer,
|
||||
aChild, aIndexInContainer);
|
||||
aChild, aIndexInContainer, PR_FALSE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
Loading…
x
Reference in New Issue
Block a user