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:
attinasi%netscape.com 2002-01-14 22:05:26 +00:00
Родитель e4742bb5be
Коммит c4ce5b9e2e
9 изменённых файлов: 472 добавлений и 400 удалений

Просмотреть файл

@ -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);
@ -435,6 +435,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);
}
}
@ -8298,11 +8309,12 @@ nsCSSFrameConstructor::RemoveDummyFrameFromSelect(nsIPresContext* aPresContext,
}
NS_IMETHODIMP
nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer,
nsILayoutHistoryState* aFrameState)
nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer,
nsILayoutHistoryState* aFrameState,
PRBool aInContentReplaced)
{
// XXXldb Do we need to re-resolve style to handle the CSS2 + combinator and
// the :empty pseudo-class?
@ -8585,8 +8597,10 @@ 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)) {
// frames.
// 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;
@ -8891,7 +8906,7 @@ DoDeletingFrameSubtree(nsIPresContext* aPresContext,
nsIFrame* aFrame)
{
NS_PRECONDITION(aFrameManager, "no frame manager");
// Remove the mapping from the content object to its frame
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
@ -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,46 +13922,50 @@ 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) {
// And get the containingBlock's content
nsCOMPtr<nsIContent> blockContent;
containingBlock->GetContent(getter_AddRefs(blockContent));
if (blockContent) {
// Now find the containingBlock's content's parent
nsCOMPtr<nsIContent> parentContainer;
blockContent->GetParent(*getter_AddRefs(parentContainer));
if (parentContainer) {
// 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));
if (blockContent) {
// Now find the containingBlock's content's parent
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));
}
#endif
PRInt32 ix;
parentContainer->IndexOf(blockContent, ix);
return ContentReplaced(aPresContext, parentContainer, blockContent, blockContent, ix);
if (gNoisyContentUpdates) {
printf(" ==> blockContent=%p, parentContainer=%p\n",
blockContent.get(), parentContainer.get());
}
#endif
PRInt32 ix;
parentContainer->IndexOf(blockContent, ix);
return ContentReplaced(aPresContext, parentContainer, blockContent, blockContent, ix);
}
}
}

Просмотреть файл

@ -86,7 +86,7 @@ public:
NS_IMETHOD Init(nsIDocument* aDocument);
// nsIStyleFrameConstruction API
NS_IMETHOD ConstructRootFrame(nsIPresShell* aPresShell,
NS_IMETHOD ConstructRootFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIContent* aDocElement,
nsIFrame*& aNewFrame);
@ -97,11 +97,12 @@ public:
nsIContent* aContainer,
PRInt32 aNewIndexInContainer);
NS_IMETHOD ContentInserted(nsIPresContext* aPresContext,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer,
nsILayoutHistoryState* aFrameState);
NS_IMETHOD ContentInserted(nsIPresContext* aPresContext,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer,
nsILayoutHistoryState* aFrameState,
PRBool aInContentReplaced);
NS_IMETHOD ContentReplaced(nsIPresContext* aPresContext,
nsIContent* aContainer,
@ -112,43 +113,48 @@ 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);
nsIContent* aContent,
nsISupports* aSubContent);
NS_IMETHOD ContentStatesChanged(nsIPresContext* aPresContext,
nsIContent* aContent1,
nsIContent* aContent2);
nsIContent* aContent1,
nsIContent* aContent2);
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aContent,
PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType,
PRInt32 aHint);
nsIContent* aContent,
PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType,
PRInt32 aHint);
// Style change notifications
NS_IMETHOD StyleRuleChanged(nsIPresContext* aPresContext,
nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule,
PRInt32 aHint); // See nsStyleConsts fot hint values
nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule,
PRInt32 aHint); // See nsStyleConsts fot hint values
NS_IMETHOD StyleRuleAdded(nsIPresContext* aPresContext,
nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule);
nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule);
NS_IMETHOD StyleRuleRemoved(nsIPresContext* aPresContext,
nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule);
nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule);
NS_IMETHOD ProcessRestyledFrames(nsStyleChangeList& aRestyleArray,
nsIPresContext* aPresContext);
nsIPresContext* aPresContext);
// Notification that we were unable to render a replaced element.
NS_IMETHOD CantRenderReplacedElement(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame* aFrame);
NS_IMETHOD CantRenderReplacedElement(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame* aFrame);
// Request to create a continuing frame
NS_IMETHOD CreateContinuingFrame(nsIPresShell* aPresShell,
NS_IMETHOD CreateContinuingFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsIFrame* aParentFrame,
@ -170,13 +176,13 @@ public:
nsIFrame** aInsertionPoint,
PRBool* aMultiple = nsnull);
NS_IMETHOD CreateTreeWidgetContent(nsIPresContext* aPresContext,
nsIFrame* aParentFrame,
nsIFrame* aPrevFrame,
nsIContent* aChild,
nsIFrame** aResult,
PRBool aIsAppend,
PRBool aIsScrollbar,
NS_IMETHOD CreateTreeWidgetContent(nsIPresContext* aPresContext,
nsIFrame* aParentFrame,
nsIFrame* aPrevFrame,
nsIContent* aChild,
nsIFrame** aResult,
PRBool aIsAppend,
PRBool aIsScrollbar,
nsILayoutHistoryState* aFrameState);
NS_IMETHOD CreateListBoxContent(nsIPresContext* aPresContext,
@ -188,8 +194,8 @@ public:
PRBool aIsScrollbar,
nsILayoutHistoryState* aFrameState);
NS_IMETHOD RemoveMappingsForFrameSubtree(nsIPresContext* aParentFrame,
nsIFrame* aRemovedFrame,
NS_IMETHOD RemoveMappingsForFrameSubtree(nsIPresContext* aParentFrame,
nsIFrame* aRemovedFrame,
nsILayoutHistoryState* aFrameState);
protected:
@ -214,7 +220,7 @@ protected:
nsIFrame* aParentFrame,
nsFrameItems& aFrameItems);
nsresult ConstructDocElementFrame(nsIPresShell* aPresShell,
nsresult ConstructDocElementFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aDocElement,
@ -222,11 +228,11 @@ protected:
nsIStyleContext* aParentStyleContext,
nsIFrame*& aNewFrame);
nsresult ConstructDocElementTableFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIContent* aDocElement,
nsIFrame* aParentFrame,
nsIFrame*& aNewTableFrame,
nsresult ConstructDocElementTableFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIContent* aDocElement,
nsIFrame* aParentFrame,
nsIFrame*& aNewTableFrame,
nsILayoutHistoryState* aFrameState);
nsresult CreateGeneratedFrameFor(nsIPresContext* aPresContext,
@ -238,15 +244,15 @@ protected:
PRUint32 aContentIndex,
nsIFrame** aFrame);
PRBool CreateGeneratedContentFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
PRBool CreateGeneratedContentFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIFrame* aFrame,
nsIContent* aContent,
nsIStyleContext* aStyleContext,
nsIAtom* aPseudoElement,
PRBool aForBlock,
nsIFrame** aResult);
nsIFrame* aFrame,
nsIContent* aContent,
nsIStyleContext* aStyleContext,
nsIAtom* aPseudoElement,
PRBool aForBlock,
nsIFrame** aResult);
nsresult AppendFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
@ -452,7 +458,7 @@ protected:
// END TABLE SECTION
nsresult CreatePlaceholderFrameFor(nsIPresShell* aPresShell,
nsresult CreatePlaceholderFrameFor(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrameManager* aFrameManager,
nsIContent* aContent,
@ -461,17 +467,17 @@ protected:
nsIFrame* aParentFrame,
nsIFrame** aPlaceholderFrame);
nsresult ConstructAlternateFrame(nsIPresShell* aPresShell,
nsresult ConstructAlternateFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext,
nsIFrame* aParentFrame,
nsIFrame*& aFrame);
nsWidgetRendering GetFormElementRenderingMode(nsIPresContext* aPresContext,
nsWidgetType aWidgetType);
nsWidgetRendering GetFormElementRenderingMode(nsIPresContext* aPresContext,
nsWidgetType aWidgetType);
nsresult ConstructRadioControlFrame(nsIPresShell* aPresShell,
nsresult ConstructRadioControlFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame*& aNewFrame,
nsIContent* aContent,
@ -483,17 +489,17 @@ protected:
nsIContent* aContent,
nsIStyleContext* aStyleContext);
nsresult ConstructButtonControlFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame*& aNewFrame);
nsresult ConstructButtonControlFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame*& aNewFrame);
nsresult ConstructTextControlFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame*& aNewFrame,
nsIContent* aContent);
nsresult ConstructTextControlFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame*& aNewFrame,
nsIContent* aContent);
nsresult ConstructSelectFrame(nsIPresShell* aPresShell,
nsresult ConstructSelectFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aContent,
@ -507,7 +513,7 @@ protected:
PRBool aIsFixedPositioned,
nsFrameItems& aFrameItems);
nsresult ConstructFieldSetFrame(nsIPresShell* aPresShell,
nsresult ConstructFieldSetFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aContent,
@ -549,8 +555,8 @@ protected:
nsFrameItems& aFrameItems,
PRBool aXBLBaseTag);
nsresult CreateAnonymousFrames(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsresult CreateAnonymousFrames(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIAtom* aTag,
nsFrameConstructorState& aState,
nsIContent* aParent,
@ -558,7 +564,7 @@ protected:
nsFrameItems& aChildItems,
PRBool aIsRoot = PR_FALSE);
nsresult CreateAnonymousFrames(nsIPresShell* aPresShell,
nsresult CreateAnonymousFrames(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aParent,
@ -580,7 +586,7 @@ protected:
#endif
#ifdef INCLUDE_XUL
nsresult ConstructXULFrame(nsIPresShell* aPresShell,
nsresult ConstructXULFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aContent,
@ -596,7 +602,7 @@ protected:
// SVG - rods
#ifdef MOZ_SVG
nsresult ConstructSVGFrame(nsIPresShell* aPresShell,
nsresult ConstructSVGFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aContent,
@ -607,7 +613,7 @@ protected:
nsFrameItems& aFrameItems);
#endif
nsresult ConstructFrameByDisplayType(nsIPresShell* aPresShell,
nsresult ConstructFrameByDisplayType(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
const nsStyleDisplay* aDisplay,
@ -622,7 +628,7 @@ protected:
nsIFrame*& aNewParentFrame);
nsresult ProcessChildren(nsIPresShell* aPresShell,
nsresult ProcessChildren(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aContent,
@ -638,20 +644,20 @@ protected:
nsIFrame*& aFrame,
nsIStyleContext* aStyleContext);
nsresult AddDummyFrameToSelect(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsresult AddDummyFrameToSelect(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsFrameConstructorState& aState,
nsIFrame* aListFrame,
nsIFrame* aParentFrame,
nsFrameItems* aChildItems,
nsIContent* aContainer,
nsIFrame* aListFrame,
nsIFrame* aParentFrame,
nsFrameItems* aChildItems,
nsIContent* aContainer,
nsIDOMHTMLSelectElement* aSelectElement);
nsresult RemoveDummyFrameFromSelect(nsIPresContext* aPresContext,
nsIPresShell * aPresShell,
nsIContent* aContainer,
nsIContent* aChild,
nsIDOMHTMLSelectElement * aSelectElement);
nsresult RemoveDummyFrameFromSelect(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIContent* aContainer,
nsIContent* aChild,
nsIDOMHTMLSelectElement* aSelectElement);
PRBool IsScrollable(nsIPresContext* aPresContext, const nsStyleDisplay* aDisplay);
@ -746,16 +752,17 @@ protected:
// cache the "nglayout.debug.enable_xbl_forms" pref
PRBool UseXBLForms();
nsresult RecreateFramesForContent(nsIPresContext* aPresContext,
nsIContent* aContent, PRBool aInlineStyle = PR_FALSE,
nsIStyleRule* aRule = nsnull,
nsresult RecreateFramesForContent(nsIPresContext* aPresContext,
nsIContent* aContent,
PRBool aInlineStyle = PR_FALSE,
nsIStyleRule* aRule = nsnull,
nsIStyleContext* aContext = nsnull);
nsresult RecreateFramesOnAttributeChange(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIAtom* aAttribute);
nsIContent* aContent,
nsIAtom* aAttribute);
nsresult CreateContinuingOuterTableFrame(nsIPresShell* aPresShell,
nsresult CreateContinuingOuterTableFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsIFrame* aParentFrame,
@ -763,7 +770,7 @@ protected:
nsIStyleContext* aStyleContext,
nsIFrame** aContinuingFrame);
nsresult CreateContinuingTableFrame(nsIPresShell* aPresShell,
nsresult CreateContinuingTableFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsIFrame* aParentFrame,
@ -775,33 +782,33 @@ protected:
// Methods support creating block frames and their children
static nsIStyleContext* GetFirstLetterStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
static nsIStyleContext* GetFirstLetterStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext);
static nsIStyleContext* GetFirstLineStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
static nsIStyleContext* GetFirstLineStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext);
static PRBool HaveFirstLetterStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
static PRBool HaveFirstLetterStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext);
static PRBool HaveFirstLineStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
static PRBool HaveFirstLineStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext);
static void HaveSpecialBlockStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
static void HaveSpecialBlockStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext,
PRBool* aHaveFirstLetterStyle,
PRBool* aHaveFirstLineStyle);
PRBool* aHaveFirstLetterStyle,
PRBool* aHaveFirstLineStyle);
PRBool ShouldCreateFirstLetterFrame(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIFrame* aFrame);
nsIContent* aContent,
nsIFrame* aFrame);
nsresult ConstructBlock(nsIPresShell* aPresShell,
nsresult ConstructBlock(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
const nsStyleDisplay* aDisplay,
@ -810,7 +817,7 @@ protected:
nsIStyleContext* aStyleContext,
nsIFrame* aNewFrame);
nsresult ProcessBlockChildren(nsIPresShell* aPresShell,
nsresult ProcessBlockChildren(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aContent,
@ -819,7 +826,7 @@ protected:
nsFrameItems& aFrameItems,
PRBool aParentIsBlock);
nsresult ConstructInline(nsIPresShell* aPresShell,
nsresult ConstructInline(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
const nsStyleDisplay* aDisplay,
@ -831,7 +838,7 @@ protected:
nsIFrame** aNewBlockFrame,
nsIFrame** aNextInlineFrame);
nsresult ProcessInlineChildren(nsIPresShell* aPresShell,
nsresult ProcessInlineChildren(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aContent,
@ -842,19 +849,19 @@ protected:
PRBool AreAllKidsInline(nsIFrame* aFrameList);
PRBool WipeContainingBlock(nsIPresContext* aPresContext,
PRBool WipeContainingBlock(nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* blockContent,
nsIFrame* aFrame,
nsIFrame* aFrameList);
nsIContent* blockContent,
nsIFrame* aFrame,
nsIFrame* aFrameList);
nsresult SplitToContainingBlock(nsIPresContext* aPresContext,
nsresult SplitToContainingBlock(nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIFrame* aFrame,
nsIFrame* aLeftInlineChildFrame,
nsIFrame* aBlockChildFrame,
nsIFrame* aRightInlineChildFrame,
PRBool aTransfer);
nsIFrame* aFrame,
nsIFrame* aLeftInlineChildFrame,
nsIFrame* aBlockChildFrame,
nsIFrame* aRightInlineChildFrame,
PRBool aTransfer);
nsresult ReframeContainingBlock(nsIPresContext* aPresContext, nsIFrame* aFrame);
@ -882,35 +889,35 @@ protected:
// Methods support :first-letter style
nsIContent* FindBlockFor(nsIPresContext* aPresContext,
nsIContent* FindBlockFor(nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aContainer);
nsIContent* aContainer);
void CreateFloatingLetterFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
void CreateFloatingLetterFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aTextContent,
nsIFrame* aTextFrame,
nsIContent* aBlockContent,
nsIFrame* aParentFrame,
nsIStyleContext* aStyleContext,
nsFrameItems& aResult);
nsIContent* aTextContent,
nsIFrame* aTextFrame,
nsIContent* aBlockContent,
nsIFrame* aParentFrame,
nsIStyleContext* aStyleContext,
nsFrameItems& aResult);
nsresult CreateLetterFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsresult CreateLetterFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aTextContent,
nsIFrame* aParentFrame,
nsFrameItems& aResult);
nsIContent* aTextContent,
nsIFrame* aParentFrame,
nsFrameItems& aResult);
nsresult WrapFramesInFirstLetterFrame(nsIPresShell* aPresShell,
nsresult WrapFramesInFirstLetterFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aBlockContent,
nsIFrame* aBlockFrame,
nsFrameItems& aBlockFrames);
nsresult WrapFramesInFirstLetterFrame(nsIPresShell* aPresShell,
nsresult WrapFramesInFirstLetterFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIFrame* aParentFrame,
@ -921,30 +928,30 @@ protected:
nsFrameItems& aLetterFrame,
PRBool* aStopLooking);
nsresult RecoverLetterFrames(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsresult RecoverLetterFrames(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIFrame* aBlockFrame);
nsIFrame* aBlockFrame);
//
nsresult RemoveLetterFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsresult RemoveLetterFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsIFrame* aBlockFrame);
nsIFrame* aBlockFrame);
// Recursive helper for RemoveLetterFrames
nsresult RemoveFirstLetterFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsresult RemoveFirstLetterFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsIFrame* aFrame,
PRBool* aStopLooking);
nsIFrame* aFrame,
PRBool* aStopLooking);
// Special remove method for those pesky floating first-letter frames
nsresult RemoveFloatingFirstLetterFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsresult RemoveFloatingFirstLetterFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsIFrame* aBlockFrame,
PRBool* aStopLooking);
nsIFrame* aBlockFrame,
PRBool* aStopLooking);
// Capture state for the frame tree rooted at the frame associated with the
// content object, aContent
@ -953,22 +960,22 @@ protected:
nsILayoutHistoryState* aHistoryState);
// Capture state for the frame tree rooted at aFrame.
nsresult CaptureStateFor(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsresult CaptureStateFor(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsILayoutHistoryState* aHistoryState);
//----------------------------------------
// Methods support :first-line style
nsresult WrapFramesInFirstLineFrame(nsIPresShell* aPresShell,
nsresult WrapFramesInFirstLineFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aContent,
nsIFrame* aFrame,
nsFrameItems& aFrameItems);
nsresult AppendFirstLineFrames(nsIPresShell* aPresShell,
nsresult AppendFirstLineFrames(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aContent,

Просмотреть файл

@ -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);
@ -435,6 +435,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);
}
}
@ -8298,11 +8309,12 @@ nsCSSFrameConstructor::RemoveDummyFrameFromSelect(nsIPresContext* aPresContext,
}
NS_IMETHODIMP
nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer,
nsILayoutHistoryState* aFrameState)
nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer,
nsILayoutHistoryState* aFrameState,
PRBool aInContentReplaced)
{
// XXXldb Do we need to re-resolve style to handle the CSS2 + combinator and
// the :empty pseudo-class?
@ -8585,8 +8597,10 @@ 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)) {
// frames.
// 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;
@ -8891,7 +8906,7 @@ DoDeletingFrameSubtree(nsIPresContext* aPresContext,
nsIFrame* aFrame)
{
NS_PRECONDITION(aFrameManager, "no frame manager");
// Remove the mapping from the content object to its frame
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
@ -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,46 +13922,50 @@ 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) {
// And get the containingBlock's content
nsCOMPtr<nsIContent> blockContent;
containingBlock->GetContent(getter_AddRefs(blockContent));
if (blockContent) {
// Now find the containingBlock's content's parent
nsCOMPtr<nsIContent> parentContainer;
blockContent->GetParent(*getter_AddRefs(parentContainer));
if (parentContainer) {
// 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));
if (blockContent) {
// Now find the containingBlock's content's parent
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));
}
#endif
PRInt32 ix;
parentContainer->IndexOf(blockContent, ix);
return ContentReplaced(aPresContext, parentContainer, blockContent, blockContent, ix);
if (gNoisyContentUpdates) {
printf(" ==> blockContent=%p, parentContainer=%p\n",
blockContent.get(), parentContainer.get());
}
#endif
PRInt32 ix;
parentContainer->IndexOf(blockContent, ix);
return ContentReplaced(aPresContext, parentContainer, blockContent, blockContent, ix);
}
}
}

Просмотреть файл

@ -86,7 +86,7 @@ public:
NS_IMETHOD Init(nsIDocument* aDocument);
// nsIStyleFrameConstruction API
NS_IMETHOD ConstructRootFrame(nsIPresShell* aPresShell,
NS_IMETHOD ConstructRootFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIContent* aDocElement,
nsIFrame*& aNewFrame);
@ -97,11 +97,12 @@ public:
nsIContent* aContainer,
PRInt32 aNewIndexInContainer);
NS_IMETHOD ContentInserted(nsIPresContext* aPresContext,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer,
nsILayoutHistoryState* aFrameState);
NS_IMETHOD ContentInserted(nsIPresContext* aPresContext,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer,
nsILayoutHistoryState* aFrameState,
PRBool aInContentReplaced);
NS_IMETHOD ContentReplaced(nsIPresContext* aPresContext,
nsIContent* aContainer,
@ -112,43 +113,48 @@ 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);
nsIContent* aContent,
nsISupports* aSubContent);
NS_IMETHOD ContentStatesChanged(nsIPresContext* aPresContext,
nsIContent* aContent1,
nsIContent* aContent2);
nsIContent* aContent1,
nsIContent* aContent2);
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aContent,
PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType,
PRInt32 aHint);
nsIContent* aContent,
PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType,
PRInt32 aHint);
// Style change notifications
NS_IMETHOD StyleRuleChanged(nsIPresContext* aPresContext,
nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule,
PRInt32 aHint); // See nsStyleConsts fot hint values
nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule,
PRInt32 aHint); // See nsStyleConsts fot hint values
NS_IMETHOD StyleRuleAdded(nsIPresContext* aPresContext,
nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule);
nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule);
NS_IMETHOD StyleRuleRemoved(nsIPresContext* aPresContext,
nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule);
nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule);
NS_IMETHOD ProcessRestyledFrames(nsStyleChangeList& aRestyleArray,
nsIPresContext* aPresContext);
nsIPresContext* aPresContext);
// Notification that we were unable to render a replaced element.
NS_IMETHOD CantRenderReplacedElement(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame* aFrame);
NS_IMETHOD CantRenderReplacedElement(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame* aFrame);
// Request to create a continuing frame
NS_IMETHOD CreateContinuingFrame(nsIPresShell* aPresShell,
NS_IMETHOD CreateContinuingFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsIFrame* aParentFrame,
@ -170,13 +176,13 @@ public:
nsIFrame** aInsertionPoint,
PRBool* aMultiple = nsnull);
NS_IMETHOD CreateTreeWidgetContent(nsIPresContext* aPresContext,
nsIFrame* aParentFrame,
nsIFrame* aPrevFrame,
nsIContent* aChild,
nsIFrame** aResult,
PRBool aIsAppend,
PRBool aIsScrollbar,
NS_IMETHOD CreateTreeWidgetContent(nsIPresContext* aPresContext,
nsIFrame* aParentFrame,
nsIFrame* aPrevFrame,
nsIContent* aChild,
nsIFrame** aResult,
PRBool aIsAppend,
PRBool aIsScrollbar,
nsILayoutHistoryState* aFrameState);
NS_IMETHOD CreateListBoxContent(nsIPresContext* aPresContext,
@ -188,8 +194,8 @@ public:
PRBool aIsScrollbar,
nsILayoutHistoryState* aFrameState);
NS_IMETHOD RemoveMappingsForFrameSubtree(nsIPresContext* aParentFrame,
nsIFrame* aRemovedFrame,
NS_IMETHOD RemoveMappingsForFrameSubtree(nsIPresContext* aParentFrame,
nsIFrame* aRemovedFrame,
nsILayoutHistoryState* aFrameState);
protected:
@ -214,7 +220,7 @@ protected:
nsIFrame* aParentFrame,
nsFrameItems& aFrameItems);
nsresult ConstructDocElementFrame(nsIPresShell* aPresShell,
nsresult ConstructDocElementFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aDocElement,
@ -222,11 +228,11 @@ protected:
nsIStyleContext* aParentStyleContext,
nsIFrame*& aNewFrame);
nsresult ConstructDocElementTableFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIContent* aDocElement,
nsIFrame* aParentFrame,
nsIFrame*& aNewTableFrame,
nsresult ConstructDocElementTableFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIContent* aDocElement,
nsIFrame* aParentFrame,
nsIFrame*& aNewTableFrame,
nsILayoutHistoryState* aFrameState);
nsresult CreateGeneratedFrameFor(nsIPresContext* aPresContext,
@ -238,15 +244,15 @@ protected:
PRUint32 aContentIndex,
nsIFrame** aFrame);
PRBool CreateGeneratedContentFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
PRBool CreateGeneratedContentFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIFrame* aFrame,
nsIContent* aContent,
nsIStyleContext* aStyleContext,
nsIAtom* aPseudoElement,
PRBool aForBlock,
nsIFrame** aResult);
nsIFrame* aFrame,
nsIContent* aContent,
nsIStyleContext* aStyleContext,
nsIAtom* aPseudoElement,
PRBool aForBlock,
nsIFrame** aResult);
nsresult AppendFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
@ -452,7 +458,7 @@ protected:
// END TABLE SECTION
nsresult CreatePlaceholderFrameFor(nsIPresShell* aPresShell,
nsresult CreatePlaceholderFrameFor(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrameManager* aFrameManager,
nsIContent* aContent,
@ -461,17 +467,17 @@ protected:
nsIFrame* aParentFrame,
nsIFrame** aPlaceholderFrame);
nsresult ConstructAlternateFrame(nsIPresShell* aPresShell,
nsresult ConstructAlternateFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext,
nsIFrame* aParentFrame,
nsIFrame*& aFrame);
nsWidgetRendering GetFormElementRenderingMode(nsIPresContext* aPresContext,
nsWidgetType aWidgetType);
nsWidgetRendering GetFormElementRenderingMode(nsIPresContext* aPresContext,
nsWidgetType aWidgetType);
nsresult ConstructRadioControlFrame(nsIPresShell* aPresShell,
nsresult ConstructRadioControlFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame*& aNewFrame,
nsIContent* aContent,
@ -483,17 +489,17 @@ protected:
nsIContent* aContent,
nsIStyleContext* aStyleContext);
nsresult ConstructButtonControlFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame*& aNewFrame);
nsresult ConstructButtonControlFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame*& aNewFrame);
nsresult ConstructTextControlFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame*& aNewFrame,
nsIContent* aContent);
nsresult ConstructTextControlFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame*& aNewFrame,
nsIContent* aContent);
nsresult ConstructSelectFrame(nsIPresShell* aPresShell,
nsresult ConstructSelectFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aContent,
@ -507,7 +513,7 @@ protected:
PRBool aIsFixedPositioned,
nsFrameItems& aFrameItems);
nsresult ConstructFieldSetFrame(nsIPresShell* aPresShell,
nsresult ConstructFieldSetFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aContent,
@ -549,8 +555,8 @@ protected:
nsFrameItems& aFrameItems,
PRBool aXBLBaseTag);
nsresult CreateAnonymousFrames(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsresult CreateAnonymousFrames(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIAtom* aTag,
nsFrameConstructorState& aState,
nsIContent* aParent,
@ -558,7 +564,7 @@ protected:
nsFrameItems& aChildItems,
PRBool aIsRoot = PR_FALSE);
nsresult CreateAnonymousFrames(nsIPresShell* aPresShell,
nsresult CreateAnonymousFrames(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aParent,
@ -580,7 +586,7 @@ protected:
#endif
#ifdef INCLUDE_XUL
nsresult ConstructXULFrame(nsIPresShell* aPresShell,
nsresult ConstructXULFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aContent,
@ -596,7 +602,7 @@ protected:
// SVG - rods
#ifdef MOZ_SVG
nsresult ConstructSVGFrame(nsIPresShell* aPresShell,
nsresult ConstructSVGFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aContent,
@ -607,7 +613,7 @@ protected:
nsFrameItems& aFrameItems);
#endif
nsresult ConstructFrameByDisplayType(nsIPresShell* aPresShell,
nsresult ConstructFrameByDisplayType(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
const nsStyleDisplay* aDisplay,
@ -622,7 +628,7 @@ protected:
nsIFrame*& aNewParentFrame);
nsresult ProcessChildren(nsIPresShell* aPresShell,
nsresult ProcessChildren(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aContent,
@ -638,20 +644,20 @@ protected:
nsIFrame*& aFrame,
nsIStyleContext* aStyleContext);
nsresult AddDummyFrameToSelect(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsresult AddDummyFrameToSelect(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsFrameConstructorState& aState,
nsIFrame* aListFrame,
nsIFrame* aParentFrame,
nsFrameItems* aChildItems,
nsIContent* aContainer,
nsIFrame* aListFrame,
nsIFrame* aParentFrame,
nsFrameItems* aChildItems,
nsIContent* aContainer,
nsIDOMHTMLSelectElement* aSelectElement);
nsresult RemoveDummyFrameFromSelect(nsIPresContext* aPresContext,
nsIPresShell * aPresShell,
nsIContent* aContainer,
nsIContent* aChild,
nsIDOMHTMLSelectElement * aSelectElement);
nsresult RemoveDummyFrameFromSelect(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIContent* aContainer,
nsIContent* aChild,
nsIDOMHTMLSelectElement* aSelectElement);
PRBool IsScrollable(nsIPresContext* aPresContext, const nsStyleDisplay* aDisplay);
@ -746,16 +752,17 @@ protected:
// cache the "nglayout.debug.enable_xbl_forms" pref
PRBool UseXBLForms();
nsresult RecreateFramesForContent(nsIPresContext* aPresContext,
nsIContent* aContent, PRBool aInlineStyle = PR_FALSE,
nsIStyleRule* aRule = nsnull,
nsresult RecreateFramesForContent(nsIPresContext* aPresContext,
nsIContent* aContent,
PRBool aInlineStyle = PR_FALSE,
nsIStyleRule* aRule = nsnull,
nsIStyleContext* aContext = nsnull);
nsresult RecreateFramesOnAttributeChange(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIAtom* aAttribute);
nsIContent* aContent,
nsIAtom* aAttribute);
nsresult CreateContinuingOuterTableFrame(nsIPresShell* aPresShell,
nsresult CreateContinuingOuterTableFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsIFrame* aParentFrame,
@ -763,7 +770,7 @@ protected:
nsIStyleContext* aStyleContext,
nsIFrame** aContinuingFrame);
nsresult CreateContinuingTableFrame(nsIPresShell* aPresShell,
nsresult CreateContinuingTableFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsIFrame* aParentFrame,
@ -775,33 +782,33 @@ protected:
// Methods support creating block frames and their children
static nsIStyleContext* GetFirstLetterStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
static nsIStyleContext* GetFirstLetterStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext);
static nsIStyleContext* GetFirstLineStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
static nsIStyleContext* GetFirstLineStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext);
static PRBool HaveFirstLetterStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
static PRBool HaveFirstLetterStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext);
static PRBool HaveFirstLineStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
static PRBool HaveFirstLineStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext);
static void HaveSpecialBlockStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
static void HaveSpecialBlockStyle(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIStyleContext* aStyleContext,
PRBool* aHaveFirstLetterStyle,
PRBool* aHaveFirstLineStyle);
PRBool* aHaveFirstLetterStyle,
PRBool* aHaveFirstLineStyle);
PRBool ShouldCreateFirstLetterFrame(nsIPresContext* aPresContext,
nsIContent* aContent,
nsIFrame* aFrame);
nsIContent* aContent,
nsIFrame* aFrame);
nsresult ConstructBlock(nsIPresShell* aPresShell,
nsresult ConstructBlock(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
const nsStyleDisplay* aDisplay,
@ -810,7 +817,7 @@ protected:
nsIStyleContext* aStyleContext,
nsIFrame* aNewFrame);
nsresult ProcessBlockChildren(nsIPresShell* aPresShell,
nsresult ProcessBlockChildren(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aContent,
@ -819,7 +826,7 @@ protected:
nsFrameItems& aFrameItems,
PRBool aParentIsBlock);
nsresult ConstructInline(nsIPresShell* aPresShell,
nsresult ConstructInline(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
const nsStyleDisplay* aDisplay,
@ -831,7 +838,7 @@ protected:
nsIFrame** aNewBlockFrame,
nsIFrame** aNextInlineFrame);
nsresult ProcessInlineChildren(nsIPresShell* aPresShell,
nsresult ProcessInlineChildren(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aContent,
@ -842,19 +849,19 @@ protected:
PRBool AreAllKidsInline(nsIFrame* aFrameList);
PRBool WipeContainingBlock(nsIPresContext* aPresContext,
PRBool WipeContainingBlock(nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* blockContent,
nsIFrame* aFrame,
nsIFrame* aFrameList);
nsIContent* blockContent,
nsIFrame* aFrame,
nsIFrame* aFrameList);
nsresult SplitToContainingBlock(nsIPresContext* aPresContext,
nsresult SplitToContainingBlock(nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIFrame* aFrame,
nsIFrame* aLeftInlineChildFrame,
nsIFrame* aBlockChildFrame,
nsIFrame* aRightInlineChildFrame,
PRBool aTransfer);
nsIFrame* aFrame,
nsIFrame* aLeftInlineChildFrame,
nsIFrame* aBlockChildFrame,
nsIFrame* aRightInlineChildFrame,
PRBool aTransfer);
nsresult ReframeContainingBlock(nsIPresContext* aPresContext, nsIFrame* aFrame);
@ -882,35 +889,35 @@ protected:
// Methods support :first-letter style
nsIContent* FindBlockFor(nsIPresContext* aPresContext,
nsIContent* FindBlockFor(nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aContainer);
nsIContent* aContainer);
void CreateFloatingLetterFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
void CreateFloatingLetterFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aTextContent,
nsIFrame* aTextFrame,
nsIContent* aBlockContent,
nsIFrame* aParentFrame,
nsIStyleContext* aStyleContext,
nsFrameItems& aResult);
nsIContent* aTextContent,
nsIFrame* aTextFrame,
nsIContent* aBlockContent,
nsIFrame* aParentFrame,
nsIStyleContext* aStyleContext,
nsFrameItems& aResult);
nsresult CreateLetterFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsresult CreateLetterFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aTextContent,
nsIFrame* aParentFrame,
nsFrameItems& aResult);
nsIContent* aTextContent,
nsIFrame* aParentFrame,
nsFrameItems& aResult);
nsresult WrapFramesInFirstLetterFrame(nsIPresShell* aPresShell,
nsresult WrapFramesInFirstLetterFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aBlockContent,
nsIFrame* aBlockFrame,
nsFrameItems& aBlockFrames);
nsresult WrapFramesInFirstLetterFrame(nsIPresShell* aPresShell,
nsresult WrapFramesInFirstLetterFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIFrame* aParentFrame,
@ -921,30 +928,30 @@ protected:
nsFrameItems& aLetterFrame,
PRBool* aStopLooking);
nsresult RecoverLetterFrames(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsresult RecoverLetterFrames(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIFrame* aBlockFrame);
nsIFrame* aBlockFrame);
//
nsresult RemoveLetterFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsresult RemoveLetterFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsIFrame* aBlockFrame);
nsIFrame* aBlockFrame);
// Recursive helper for RemoveLetterFrames
nsresult RemoveFirstLetterFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsresult RemoveFirstLetterFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsIFrame* aFrame,
PRBool* aStopLooking);
nsIFrame* aFrame,
PRBool* aStopLooking);
// Special remove method for those pesky floating first-letter frames
nsresult RemoveFloatingFirstLetterFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsresult RemoveFloatingFirstLetterFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsIFrame* aBlockFrame,
PRBool* aStopLooking);
nsIFrame* aBlockFrame,
PRBool* aStopLooking);
// Capture state for the frame tree rooted at the frame associated with the
// content object, aContent
@ -953,22 +960,22 @@ protected:
nsILayoutHistoryState* aHistoryState);
// Capture state for the frame tree rooted at aFrame.
nsresult CaptureStateFor(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsresult CaptureStateFor(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsILayoutHistoryState* aHistoryState);
//----------------------------------------
// Methods support :first-line style
nsresult WrapFramesInFirstLineFrame(nsIPresShell* aPresShell,
nsresult WrapFramesInFirstLineFrame(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aContent,
nsIFrame* aFrame,
nsFrameItems& aFrameItems);
nsresult AppendFirstLineFrames(nsIPresShell* aPresShell,
nsresult AppendFirstLineFrames(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsFrameConstructorState& aState,
nsIContent* aContent,

Просмотреть файл

@ -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