зеркало из https://github.com/mozilla/gecko-dev.git
Bug 217201. Make nsTextControlFrame::InitEditor() happen outside of reflow, to prevent content notification flushes and reentrancy. r+rs=dbaron
This commit is contained in:
Родитель
cf19954e71
Коммит
d0615f9350
|
@ -5149,6 +5149,8 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsIPresShell* aPresShell
|
|||
// create the frame and attach it to our frame
|
||||
ConstructFrame(aPresShell, aPresContext, aState, content, aParentFrame, aChildItems);
|
||||
}
|
||||
|
||||
creator->PostCreateFrames();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1526,13 +1526,16 @@ nsTextControlFrame::CalculateSizeStandard(nsIPresContext* aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
void nsTextControlFrame::PostCreateFrames() {
|
||||
InitEditor();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextControlFrame::CreateFrameFor(nsIPresContext* aPresContext,
|
||||
nsIContent * aContent,
|
||||
nsIFrame** aFrame)
|
||||
{
|
||||
aContent = nsnull;
|
||||
*aFrame = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -1951,8 +1954,6 @@ nsTextControlFrame::Reflow(nsIPresContext* aPresContext,
|
|||
DO_GLOBAL_REFLOW_COUNT("nsTextControlFrame", aReflowState.reason);
|
||||
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
||||
|
||||
InitEditor();
|
||||
|
||||
// make sure the the form registers itself on the initial/first reflow
|
||||
if (mState & NS_FRAME_FIRST_REFLOW) {
|
||||
nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_TRUE);
|
||||
|
@ -2045,8 +2046,6 @@ nsTextControlFrame::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize)
|
|||
if (!reflowState)
|
||||
return NS_OK;
|
||||
|
||||
InitEditor();
|
||||
|
||||
if (mState & NS_FRAME_FIRST_REFLOW)
|
||||
mNotifyOnInput = PR_TRUE; //its ok to notify now. all has been prepared.
|
||||
|
||||
|
|
|
@ -122,6 +122,10 @@ public:
|
|||
// from nsIAnonymousContentCreator
|
||||
NS_IMETHOD CreateAnonymousContent(nsIPresContext* aPresContext,
|
||||
nsISupportsArray& aChildList);
|
||||
NS_IMETHOD CreateFrameFor(nsIPresContext* aPresContext,
|
||||
nsIContent * aContent,
|
||||
nsIFrame** aFrame);
|
||||
virtual void PostCreateFrames();
|
||||
|
||||
// Utility methods to set current widget state
|
||||
void SetValue(const nsAString& aValue);
|
||||
|
@ -279,10 +283,6 @@ protected:
|
|||
nsSize& aDesiredSize,
|
||||
nsSize& aMinSize);
|
||||
|
||||
NS_IMETHOD CreateFrameFor(nsIPresContext* aPresContext,
|
||||
nsIContent * aContent,
|
||||
nsIFrame** aFrame);
|
||||
|
||||
PRInt32 GetWidthInCharacters() const;
|
||||
|
||||
// nsIScrollableViewProvider
|
||||
|
|
|
@ -64,11 +64,15 @@ public:
|
|||
NS_IMETHOD CreateAnonymousContent(nsIPresContext* aPresContext,
|
||||
nsISupportsArray& aAnonymousItems)=0;
|
||||
|
||||
// If the creator doesn't want to create special fframe ro frame hierarchy
|
||||
// then it should null out the style content arg and return NS_ERROR_FAILURE
|
||||
// If the creator doesn't want to create a special frame or frame hierarchy
|
||||
// then it should null out aFrame and return NS_ERROR_FAILURE
|
||||
NS_IMETHOD CreateFrameFor(nsIPresContext* aPresContext,
|
||||
nsIContent * aContent,
|
||||
nsIFrame** aFrame)=0;
|
||||
|
||||
// This gets called after the frames for the anonymous content have been
|
||||
// created and added to the frame tree. By default it does nothing.
|
||||
virtual void PostCreateFrames() {}
|
||||
};
|
||||
|
||||
nsresult NS_CreateAnonymousNode(nsIContent* aParent, nsIAtom* aTag, PRInt32 aNameSpaceId, nsCOMPtr<nsIContent>& aNewNode);
|
||||
|
|
|
@ -64,11 +64,15 @@ public:
|
|||
NS_IMETHOD CreateAnonymousContent(nsIPresContext* aPresContext,
|
||||
nsISupportsArray& aAnonymousItems)=0;
|
||||
|
||||
// If the creator doesn't want to create special fframe ro frame hierarchy
|
||||
// then it should null out the style content arg and return NS_ERROR_FAILURE
|
||||
// If the creator doesn't want to create a special frame or frame hierarchy
|
||||
// then it should null out aFrame and return NS_ERROR_FAILURE
|
||||
NS_IMETHOD CreateFrameFor(nsIPresContext* aPresContext,
|
||||
nsIContent * aContent,
|
||||
nsIFrame** aFrame)=0;
|
||||
|
||||
// This gets called after the frames for the anonymous content have been
|
||||
// created and added to the frame tree. By default it does nothing.
|
||||
virtual void PostCreateFrames() {}
|
||||
};
|
||||
|
||||
nsresult NS_CreateAnonymousNode(nsIContent* aParent, nsIAtom* aTag, PRInt32 aNameSpaceId, nsCOMPtr<nsIContent>& aNewNode);
|
||||
|
|
|
@ -1526,13 +1526,16 @@ nsTextControlFrame::CalculateSizeStandard(nsIPresContext* aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
void nsTextControlFrame::PostCreateFrames() {
|
||||
InitEditor();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextControlFrame::CreateFrameFor(nsIPresContext* aPresContext,
|
||||
nsIContent * aContent,
|
||||
nsIFrame** aFrame)
|
||||
{
|
||||
aContent = nsnull;
|
||||
*aFrame = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -1951,8 +1954,6 @@ nsTextControlFrame::Reflow(nsIPresContext* aPresContext,
|
|||
DO_GLOBAL_REFLOW_COUNT("nsTextControlFrame", aReflowState.reason);
|
||||
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
||||
|
||||
InitEditor();
|
||||
|
||||
// make sure the the form registers itself on the initial/first reflow
|
||||
if (mState & NS_FRAME_FIRST_REFLOW) {
|
||||
nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_TRUE);
|
||||
|
@ -2045,8 +2046,6 @@ nsTextControlFrame::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize)
|
|||
if (!reflowState)
|
||||
return NS_OK;
|
||||
|
||||
InitEditor();
|
||||
|
||||
if (mState & NS_FRAME_FIRST_REFLOW)
|
||||
mNotifyOnInput = PR_TRUE; //its ok to notify now. all has been prepared.
|
||||
|
||||
|
|
|
@ -122,6 +122,10 @@ public:
|
|||
// from nsIAnonymousContentCreator
|
||||
NS_IMETHOD CreateAnonymousContent(nsIPresContext* aPresContext,
|
||||
nsISupportsArray& aChildList);
|
||||
NS_IMETHOD CreateFrameFor(nsIPresContext* aPresContext,
|
||||
nsIContent * aContent,
|
||||
nsIFrame** aFrame);
|
||||
virtual void PostCreateFrames();
|
||||
|
||||
// Utility methods to set current widget state
|
||||
void SetValue(const nsAString& aValue);
|
||||
|
@ -279,10 +283,6 @@ protected:
|
|||
nsSize& aDesiredSize,
|
||||
nsSize& aMinSize);
|
||||
|
||||
NS_IMETHOD CreateFrameFor(nsIPresContext* aPresContext,
|
||||
nsIContent * aContent,
|
||||
nsIFrame** aFrame);
|
||||
|
||||
PRInt32 GetWidthInCharacters() const;
|
||||
|
||||
// nsIScrollableViewProvider
|
||||
|
|
|
@ -5149,6 +5149,8 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsIPresShell* aPresShell
|
|||
// create the frame and attach it to our frame
|
||||
ConstructFrame(aPresShell, aPresContext, aState, content, aParentFrame, aChildItems);
|
||||
}
|
||||
|
||||
creator->PostCreateFrames();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче