From a7ee8e11dd4139c9caca0af00187345eeda8bdc6 Mon Sep 17 00:00:00 2001 From: "mjudge%netscape.com" Date: Wed, 7 Jun 2000 01:21:20 +0000 Subject: [PATCH] bug=34896 fixing reflow reason from nsFileControlFrame to send resize when resizing its input field. fixing mouseclick to not be so hardcoded so that the ender-lite text field still works for the "browse" button. a=beppe r=hyatt git-svn-id: svn://10.0.0.236/trunk@71683 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/forms/nsFileControlFrame.cpp | 21 +++++++++++-------- .../html/forms/src/nsFileControlFrame.cpp | 21 +++++++++++-------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/mozilla/layout/forms/nsFileControlFrame.cpp b/mozilla/layout/forms/nsFileControlFrame.cpp index 6c09311d600..0bd04cbc721 100644 --- a/mozilla/layout/forms/nsFileControlFrame.cpp +++ b/mozilla/layout/forms/nsFileControlFrame.cpp @@ -245,14 +245,22 @@ nsresult nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent) { nsIView* textView; + nsIView* parentView; + nsresult result = NS_OK; +#ifdef ENDER_LITE + nsIFrame *parentWithView; + if (NS_SUCCEEDED(mTextFrame->GetParentWithView(mPresContext, &parentWithView)) && parentWithView) + { + parentWithView->GetView(mPresContext,&parentView); + } +#else mTextFrame->GetView(mPresContext, &textView); if (nsnull == textView) { return NS_OK; } - - nsresult result = NS_OK; - nsIView* parentView; textView->GetParent(parentView); +#endif + nsIWidget* parentWidget = GetWindowTemp(parentView); nsIFileWidget *fileWidget = nsnull; @@ -328,6 +336,7 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext* aPresContext, nsSize txtAvailSize(aDesiredSize.width - buttonRect.width, aDesiredSize.height); nsHTMLReflowMetrics txtKidSize(&txtAvailSize); nsHTMLReflowState txtKidReflowState(aPresContext, aReflowState, mTextFrame, txtAvailSize); + txtKidReflowState.reason = eReflowReason_Resize; txtKidReflowState.mComputedWidth = txtAvailSize.width; txtKidReflowState.mComputedHeight = txtAvailSize.height; mTextFrame->WillReflow(aPresContext); @@ -374,7 +383,6 @@ nsNewFrame* nsFileControlFrame::GetTextControlFrame(nsIPresContext* aPresContext, nsIFrame* aStart) { nsNewFrame* result = nsnull; -#ifndef DEBUG_NEWFRAME // find the text control frame. nsIFrame* childFrame = nsnull; aStart->FirstChild(aPresContext, nsnull, &childFrame); @@ -410,9 +418,6 @@ nsFileControlFrame::GetTextControlFrame(nsIPresContext* aPresContext, nsIFrame* } return result; -#else - return nsnull; -#endif } PRIntn @@ -505,7 +510,6 @@ nsFileControlFrame::GetFrameForPoint(nsIPresContext* aPresContext, nsFramePaintLayer aWhichLayer, nsIFrame** aFrame) { -#ifndef DEBUG_NEWFRAME if ( nsFormFrame::GetDisabled(this) && mRect.Contains(aPoint) ) { const nsStyleDisplay* disp = (const nsStyleDisplay*) mStyleContext->GetStyleData(eStyleStruct_Display); @@ -516,7 +520,6 @@ nsFileControlFrame::GetFrameForPoint(nsIPresContext* aPresContext, } else { return nsAreaFrame::GetFrameForPoint(aPresContext, aPoint, aWhichLayer, aFrame); } -#endif return NS_OK; } diff --git a/mozilla/layout/html/forms/src/nsFileControlFrame.cpp b/mozilla/layout/html/forms/src/nsFileControlFrame.cpp index 6c09311d600..0bd04cbc721 100644 --- a/mozilla/layout/html/forms/src/nsFileControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFileControlFrame.cpp @@ -245,14 +245,22 @@ nsresult nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent) { nsIView* textView; + nsIView* parentView; + nsresult result = NS_OK; +#ifdef ENDER_LITE + nsIFrame *parentWithView; + if (NS_SUCCEEDED(mTextFrame->GetParentWithView(mPresContext, &parentWithView)) && parentWithView) + { + parentWithView->GetView(mPresContext,&parentView); + } +#else mTextFrame->GetView(mPresContext, &textView); if (nsnull == textView) { return NS_OK; } - - nsresult result = NS_OK; - nsIView* parentView; textView->GetParent(parentView); +#endif + nsIWidget* parentWidget = GetWindowTemp(parentView); nsIFileWidget *fileWidget = nsnull; @@ -328,6 +336,7 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext* aPresContext, nsSize txtAvailSize(aDesiredSize.width - buttonRect.width, aDesiredSize.height); nsHTMLReflowMetrics txtKidSize(&txtAvailSize); nsHTMLReflowState txtKidReflowState(aPresContext, aReflowState, mTextFrame, txtAvailSize); + txtKidReflowState.reason = eReflowReason_Resize; txtKidReflowState.mComputedWidth = txtAvailSize.width; txtKidReflowState.mComputedHeight = txtAvailSize.height; mTextFrame->WillReflow(aPresContext); @@ -374,7 +383,6 @@ nsNewFrame* nsFileControlFrame::GetTextControlFrame(nsIPresContext* aPresContext, nsIFrame* aStart) { nsNewFrame* result = nsnull; -#ifndef DEBUG_NEWFRAME // find the text control frame. nsIFrame* childFrame = nsnull; aStart->FirstChild(aPresContext, nsnull, &childFrame); @@ -410,9 +418,6 @@ nsFileControlFrame::GetTextControlFrame(nsIPresContext* aPresContext, nsIFrame* } return result; -#else - return nsnull; -#endif } PRIntn @@ -505,7 +510,6 @@ nsFileControlFrame::GetFrameForPoint(nsIPresContext* aPresContext, nsFramePaintLayer aWhichLayer, nsIFrame** aFrame) { -#ifndef DEBUG_NEWFRAME if ( nsFormFrame::GetDisabled(this) && mRect.Contains(aPoint) ) { const nsStyleDisplay* disp = (const nsStyleDisplay*) mStyleContext->GetStyleData(eStyleStruct_Display); @@ -516,7 +520,6 @@ nsFileControlFrame::GetFrameForPoint(nsIPresContext* aPresContext, } else { return nsAreaFrame::GetFrameForPoint(aPresContext, aPoint, aWhichLayer, aFrame); } -#endif return NS_OK; }