Bug 301313 : Remove mPresContext in /layout/forms/, patch by Andreas Lange <mozilla@lange.cx>, r+sr=roc

This commit is contained in:
gavin%gavinsharp.com 2005-08-16 12:20:58 +00:00
Родитель 74b5cbfdaa
Коммит 0b638620e3
10 изменённых файлов: 15 добавлений и 53 удалений

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

@ -322,7 +322,6 @@ if (aReflowState.mComputedWidth != NS_UNCONSTRAINEDSIZE) { \
nsComboboxControlFrame::nsComboboxControlFrame()
: nsAreaFrame()
{
mPresContext = nsnull;
mListControlFrame = nsnull;
mDroppedDown = PR_FALSE;
mDisplayFrame = nsnull;
@ -357,8 +356,6 @@ nsComboboxControlFrame::nsComboboxControlFrame()
nsComboboxControlFrame::~nsComboboxControlFrame()
{
REFLOW_COUNTER_DUMP("nsCCF");
NS_IF_RELEASE(mPresContext);
}
//--------------------------------------------------------------
@ -404,7 +401,7 @@ NS_IMETHODIMP nsComboboxControlFrame::GetAccessible(nsIAccessible** aAccessible)
if (accService) {
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent);
return accService->CreateHTMLComboboxAccessible(node, mPresContext->PresShell(), aAccessible);
return accService->CreateHTMLComboboxAccessible(node, GetPresContext()->PresShell(), aAccessible);
}
return NS_ERROR_FAILURE;
@ -420,11 +417,6 @@ nsComboboxControlFrame::Init(nsPresContext* aPresContext,
nsStyleContext* aContext,
nsIFrame* aPrevInFlow)
{
// Need to hold on the pres context because it is used later in methods
// which don't have it passed in.
mPresContext = aPresContext;
NS_ADDREF(mPresContext);
mEventQueueService = do_GetService(kEventQueueServiceCID);
//-------------------------------
@ -571,7 +563,7 @@ nsComboboxControlFrame::ShowPopup(PRBool aShowPopup)
NS_XUL_POPUP_SHOWING : NS_XUL_POPUP_HIDING, nsnull,
nsMouseEvent::eReal);
nsIPresShell *shell = mPresContext->GetPresShell();
nsIPresShell *shell = GetPresContext()->GetPresShell();
if (shell)
shell->HandleDOMEventWithTarget(mContent, &event, &status);
}
@ -1698,10 +1690,10 @@ nsComboboxControlFrame::ShowDropDown(PRBool aDoDropDown)
if (mListControlFrame) {
mListControlFrame->SyncViewWithFrame();
}
ToggleList(mPresContext);
ToggleList(GetPresContext());
return NS_OK;
} else if (mDroppedDown && !aDoDropDown) {
ToggleList(mPresContext);
ToggleList(GetPresContext());
return NS_OK;
}
@ -1748,8 +1740,8 @@ nsComboboxControlFrame::AbsolutelyPositionDropDown()
nsRect absoluteTwips;
nsRect absolutePixels;
if (NS_SUCCEEDED(nsFormControlFrame::GetAbsoluteFramePosition(mPresContext, this, absoluteTwips, absolutePixels))) {
PositionDropdown(mPresContext, GetRect().height, absoluteTwips, absolutePixels);
if (NS_SUCCEEDED(nsFormControlFrame::GetAbsoluteFramePosition(GetPresContext(), this, absoluteTwips, absolutePixels))) {
PositionDropdown(GetPresContext(), GetRect().height, absoluteTwips, absolutePixels);
}
return NS_OK;
}
@ -1758,7 +1750,7 @@ NS_IMETHODIMP
nsComboboxControlFrame::GetAbsoluteRect(nsRect* aRect)
{
nsRect absoluteTwips;
return nsFormControlFrame::GetAbsoluteFramePosition(mPresContext, this, absoluteTwips, *aRect);
return nsFormControlFrame::GetAbsoluteFramePosition(GetPresContext(), this, absoluteTwips, *aRect);
}
///////////////////////////////////////////////////////////////
@ -2226,7 +2218,7 @@ nsComboboxControlFrame::Destroy(nsPresContext* aPresContext)
}
}
nsFormControlFrame::RegUnRegAccessKey(mPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_FALSE);
nsFormControlFrame::RegUnRegAccessKey(GetPresContext(), NS_STATIC_CAST(nsIFrame*, this), PR_FALSE);
if (mDroppedDown) {
// Get parent view
@ -2328,7 +2320,7 @@ nsComboboxControlFrame::Rollup()
if (mDroppedDown) {
mListControlFrame->AboutToRollup();
ShowDropDown(PR_FALSE);
mListControlFrame->CaptureMouseEvents(mPresContext, PR_FALSE);
mListControlFrame->CaptureMouseEvents(GetPresContext(), PR_FALSE);
}
return NS_OK;
}
@ -2477,7 +2469,7 @@ void nsComboboxControlFrame::FireValueChangeEvent()
mContent->GetListenerManager(getter_AddRefs(manager));
nsPresContext* presContext = GetPresContext();
if (manager &&
NS_SUCCEEDED(manager->CreateEvent(presContext, nsnull, NS_LITERAL_STRING("Events"), getter_AddRefs(event)))) {
NS_SUCCEEDED(manager->CreateEvent(presContext, nsnull, NS_LITERAL_CSTRING("Events"), getter_AddRefs(event)))) {
event->InitEvent(NS_LITERAL_STRING("ValueChange"), PR_TRUE, PR_TRUE);
nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(event));

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

@ -262,7 +262,6 @@ protected:
PRBool aCheckHeight = PR_FALSE);
nsFrameList mPopupFrames; // additional named child list
nsPresContext* mPresContext; // XXX: Remove the need to cache the pres context.
nsCOMPtr<nsITextContent> mDisplayContent; // Anonymous content used to display the current selection
nsIFrame* mDisplayFrame; // frame to display selection
nsIFrame* mButtonFrame; // button frame

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

@ -265,7 +265,7 @@ nsFileControlFrame::SetFocus(PRBool aOn, PRBool aRepaint)
if (mTextFrame) {
nsIContent* content = mTextFrame->GetContent();
if (content) {
content->SetFocus(mPresContext);
content->SetFocus(GetPresContext());
}
}
}
@ -378,7 +378,8 @@ nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent)
nsAutoString unicodePath;
result = localFile->GetPath(unicodePath);
if (!unicodePath.IsEmpty()) {
mTextFrame->SetProperty(mPresContext, nsHTMLAtoms::value, unicodePath);
mTextFrame->SetProperty(GetPresContext(), nsHTMLAtoms::value,
unicodePath);
// May need to fire an onchange here
mTextFrame->CheckFireOnChange();
return NS_OK;

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

@ -65,7 +65,6 @@ public:
nsIFrame* aParent,
nsStyleContext* aContext,
nsIFrame* aPrevInFlow) {
mPresContext = aPresContext;
return nsAreaFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
}
@ -192,11 +191,6 @@ protected:
* file frame is there but the input frame is not.
*/
nsString* mCachedState;
/**
* The current pres context.
* XXX Hack: pres context needed by function MouseClick() and SetFocus()
*/
nsPresContext* mPresContext; // weak reference
private:
/**

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

@ -110,7 +110,6 @@ nsFormControlFrame::nsFormControlFrame()
mDidInit = PR_FALSE;
mSuggestedWidth = NS_FORMSIZE_NOTSET;
mSuggestedHeight = NS_FORMSIZE_NOTSET;
mPresContext = nsnull;
// Reflow Optimization
mCacheSize.width = kSizeNotSet;
@ -531,7 +530,6 @@ nsFormControlFrame::Reflow(nsPresContext* aPresContext,
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
if (!mDidInit) {
mPresContext = aPresContext;
InitializeControl(aPresContext);
mDidInit = PR_TRUE;
}

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

@ -307,8 +307,6 @@ protected:
nscoord mSuggestedWidth;
nscoord mSuggestedHeight;
nsPresContext * mPresContext;
// Reflow Optimization
nsSize mCacheSize;
nscoord mCachedAscent;

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

@ -198,7 +198,7 @@ void
nsIsIndexFrame::SetFocus(PRBool aOn, PRBool aRepaint)
{
nsIFormControlFrame* frame = nsnull;
GetInputFrame(mPresContext, &frame);
GetInputFrame(GetPresContext(), &frame);
if (frame) {
frame->SetFocus(aOn, aRepaint);
}
@ -341,7 +341,7 @@ nsIsIndexFrame::KeyPress(nsIDOMEvent* aEvent)
keyEvent->GetCharCode(&code);
}
if (nsIDOMKeyEvent::DOM_VK_RETURN == code) {
OnSubmit(mPresContext);
OnSubmit(GetPresContext());
aEvent->PreventDefault(); // XXX Needed?
}
}

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

@ -72,7 +72,6 @@ public:
nsIFrame* aParent,
nsStyleContext* aContext,
nsIFrame* aPrevInFlow) {
mPresContext = aPresContext;
return nsAreaFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
}
@ -136,9 +135,6 @@ protected:
nsCOMPtr<nsITextContent> mTextContent;
nsCOMPtr<nsIContent> mInputContent;
// XXX Hack: pres context needed by function KeyPress() and SetFocus()
nsPresContext* mPresContext; // weak reference
private:
NS_IMETHOD UpdatePromptLabel();
NS_IMETHOD GetInputFrame(nsPresContext* aPresContext, nsIFormControlFrame** oFrame);

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

@ -70,16 +70,6 @@ NS_NewLegendFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
return NS_OK;
}
nsLegendFrame::nsLegendFrame()
: nsAreaFrame()
{
mPresContext = nsnull;
}
nsLegendFrame::~nsLegendFrame()
{
}
nsIAtom*
nsLegendFrame::GetType() const
{
@ -117,7 +107,6 @@ nsLegendFrame::Reflow(nsPresContext* aPresContext,
DO_GLOBAL_REFLOW_COUNT("nsLegendFrame", aReflowState.reason);
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
if (eReflowReason_Initial == aReflowState.reason) {
mPresContext = aPresContext;
nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_TRUE);
}
return nsAreaFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);

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

@ -55,9 +55,6 @@ struct nsRect;
class nsLegendFrame : public nsAreaFrame {
public:
nsLegendFrame();
virtual ~nsLegendFrame();
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
NS_IMETHOD Reflow(nsPresContext* aPresContext,
@ -80,8 +77,6 @@ public:
#endif
PRInt32 GetAlign();
nsPresContext * mPresContext;
};