Remove nsFormFrame forever. bug 125578, r=alexsavulov@netscape.com, sr=jst@netscape.com
git-svn-id: svn://10.0.0.236/trunk@122617 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
6c6de45f44
commit
0c2a8f4e96
@ -38,7 +38,6 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIForm.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsIFormManager.h"
|
||||
#include "nsIFormSubmission.h"
|
||||
#include "nsIDOMHTMLFormElement.h"
|
||||
#include "nsIDOMNSHTMLFormElement.h"
|
||||
@ -228,11 +227,14 @@ protected:
|
||||
nsCOMPtr<nsIRequest> mSubmittingRequest;
|
||||
|
||||
protected:
|
||||
// Detection of first form to notify observers
|
||||
/** Detection of first form to notify observers */
|
||||
static PRBool gFirstFormSubmitted;
|
||||
/** Detection of first password input to initialize the password manager */
|
||||
static PRBool gPasswordManagerInitialized;
|
||||
};
|
||||
|
||||
PRBool nsHTMLFormElement::gFirstFormSubmitted = PR_FALSE;
|
||||
PRBool nsHTMLFormElement::gPasswordManagerInitialized = PR_FALSE;
|
||||
|
||||
|
||||
// nsFormControlList
|
||||
@ -500,17 +502,16 @@ nsHTMLFormElement::Submit()
|
||||
// original code added in bug 76694)
|
||||
rv = DoSubmitOrReset(presContext, nsnull, NS_FORM_SUBMIT);
|
||||
} else {
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
presContext->GetShell(getter_AddRefs(presShell));
|
||||
if (presShell) {
|
||||
nsFormEvent event;
|
||||
event.eventStructType = NS_FORM_EVENT;
|
||||
event.message = NS_FORM_SUBMIT;
|
||||
event.originator = nsnull;
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
presShell->HandleEventWithTarget(&event, nsnull, this,
|
||||
NS_EVENT_FLAG_INIT, &status);
|
||||
}
|
||||
// Calling HandleDOMEvent() directly so that submit() will work even if
|
||||
// the frame does not exist. This does not have an effect right now, but
|
||||
// If PresShell::HandleEventWithTarget() ever starts to work for elements
|
||||
// without frames, that should be called instead.
|
||||
nsFormEvent event;
|
||||
event.eventStructType = NS_FORM_EVENT;
|
||||
event.message = NS_FORM_SUBMIT;
|
||||
event.originator = nsnull;
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
HandleDOMEvent(presContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
@ -524,17 +525,16 @@ nsHTMLFormElement::Reset()
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
GetPresContext(this, getter_AddRefs(presContext));
|
||||
if (presContext) {
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
presContext->GetShell(getter_AddRefs(presShell));
|
||||
if (presShell) {
|
||||
nsFormEvent event;
|
||||
event.eventStructType = NS_FORM_EVENT;
|
||||
event.message = NS_FORM_RESET;
|
||||
event.originator = nsnull;
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
presShell->HandleEventWithTarget(&event, nsnull, this,
|
||||
NS_EVENT_FLAG_INIT, &status);
|
||||
}
|
||||
// Calling HandleDOMEvent() directly so that reset() will work even if
|
||||
// the frame does not exist. This does not have an effect right now, but
|
||||
// If PresShell::HandleEventWithTarget() ever starts to work for elements
|
||||
// without frames, that should be called instead.
|
||||
nsFormEvent event;
|
||||
event.eventStructType = NS_FORM_EVENT;
|
||||
event.message = NS_FORM_RESET;
|
||||
event.originator = nsnull;
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
HandleDOMEvent(presContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
@ -1122,6 +1122,18 @@ nsHTMLFormElement::AddElement(nsIFormControl* aChild)
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
//
|
||||
// If it is a password control, and the password manager has not yet been
|
||||
// initialized, initialize the password manager
|
||||
//
|
||||
if (!gPasswordManagerInitialized && type == NS_FORM_INPUT_PASSWORD) {
|
||||
// Initialize the password manager category
|
||||
gPasswordManagerInitialized = PR_TRUE;
|
||||
NS_CreateServicesFromCategory(NS_PASSWORDMANAGER_CATEGORY,
|
||||
nsnull,
|
||||
NS_PASSWORDMANAGER_CATEGORY);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -82,7 +82,6 @@
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsICheckboxControlFrame.h"
|
||||
#include "nsIFormManager.h"
|
||||
#include "nsIImageControlFrame.h"
|
||||
#include "nsLinebreakConverter.h" //to strip out carriage returns
|
||||
#include "nsReadableUtils.h"
|
||||
@ -1517,7 +1516,85 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
} // case
|
||||
} // switch
|
||||
}
|
||||
} break;// NS_KEY_PRESS || NS_KEY_UP
|
||||
|
||||
/*
|
||||
* If this is input type=text, and the user hit enter, fire onChange and
|
||||
* submit the form (if we are in one)
|
||||
*
|
||||
* Bug 99920 and bug 109463:
|
||||
* (a) if there is only one text input in the form, submit using JS
|
||||
* form.submit()
|
||||
* (b) if there is more than one text input, submit by sending a click
|
||||
* to the first submit button in the form.
|
||||
* (c) if there is more than one text input and no submit buttons, do
|
||||
* not submit, period.
|
||||
*/
|
||||
|
||||
if (aEvent->message == NS_KEY_PRESS &&
|
||||
(keyEvent->keyCode == NS_VK_RETURN ||
|
||||
keyEvent->keyCode == NS_VK_ENTER) &&
|
||||
(type == NS_FORM_INPUT_TEXT || type == NS_FORM_INPUT_PASSWORD)) {
|
||||
|
||||
if (mForm) {
|
||||
nsIFrame* primaryFrame = GetPrimaryFrame(PR_FALSE);
|
||||
if (primaryFrame) {
|
||||
nsIGfxTextControlFrame2* textFrame = nsnull;
|
||||
CallQueryInterface(primaryFrame, &textFrame);
|
||||
|
||||
// Fire onChange (if necessary)
|
||||
if (textFrame) {
|
||||
textFrame->CheckFireOnChange();
|
||||
}
|
||||
}
|
||||
|
||||
// Find the nearest submit control in elements[]
|
||||
// and also check how many text controls we have in the form
|
||||
nsCOMPtr<nsIContent> submitControl;
|
||||
PRInt32 numTextControlsFound = 0;
|
||||
|
||||
nsCOMPtr<nsIFormControl> currentControl;
|
||||
PRUint32 count = 0;
|
||||
mForm->GetElementCount(&count);
|
||||
for (PRUint32 i=0; i < count; i++) {
|
||||
mForm->GetElementAt(i, getter_AddRefs(currentControl));
|
||||
if (currentControl) {
|
||||
PRInt32 type;
|
||||
currentControl->GetType(&type);
|
||||
if (!submitControl &&
|
||||
(type == NS_FORM_INPUT_SUBMIT ||
|
||||
type == NS_FORM_BUTTON_SUBMIT ||
|
||||
type == NS_FORM_INPUT_IMAGE)) {
|
||||
submitControl = do_QueryInterface(currentControl);
|
||||
} else if (type == NS_FORM_INPUT_TEXT ||
|
||||
type == NS_FORM_INPUT_PASSWORD) {
|
||||
numTextControlsFound++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (submitControl && numTextControlsFound > 1) {
|
||||
// IE actually fires the button's onclick handler. Dispatch
|
||||
// the click event and let the button handle submitting the
|
||||
// form.
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
if (shell) {
|
||||
nsGUIEvent event;
|
||||
event.eventStructType = NS_MOUSE_EVENT;
|
||||
event.message = NS_MOUSE_LEFT_CLICK;
|
||||
event.widget = nsnull;
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
shell->HandleDOMEventWithTarget(submitControl, &event, &status);
|
||||
}
|
||||
} else if (numTextControlsFound == 1) {
|
||||
// If there's only one text control, just call submit()
|
||||
nsCOMPtr<nsIDOMHTMLFormElement> form = do_QueryInterface(mForm);
|
||||
form->Submit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} break; // NS_KEY_PRESS || NS_KEY_UP
|
||||
|
||||
// cancel all of these events for buttons
|
||||
case NS_MOUSE_MIDDLE_BUTTON_DOWN:
|
||||
|
||||
@ -40,7 +40,6 @@
|
||||
#include "nsComboboxControlFrame.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIFrameManager.h"
|
||||
#include "nsFormFrame.h"
|
||||
#include "nsFormControlFrame.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
@ -284,7 +283,6 @@ nsComboboxControlFrame::nsComboboxControlFrame()
|
||||
: nsAreaFrame()
|
||||
{
|
||||
mPresContext = nsnull;
|
||||
mFormFrame = nsnull;
|
||||
mListControlFrame = nsnull;
|
||||
mDroppedDown = PR_FALSE;
|
||||
mDisplayFrame = nsnull;
|
||||
@ -319,11 +317,6 @@ nsComboboxControlFrame::~nsComboboxControlFrame()
|
||||
{
|
||||
REFLOW_COUNTER_DUMP("nsCCF");
|
||||
|
||||
if (mFormFrame) {
|
||||
mFormFrame->RemoveFormControlFrame(*this);
|
||||
mFormFrame = nsnull;
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(mPresContext);
|
||||
}
|
||||
|
||||
@ -1262,9 +1255,7 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// add ourself to the form control
|
||||
if (!mFormFrame && (eReflowReason_Initial == aReflowState.reason)) {
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *NS_STATIC_CAST(nsIFrame*,this));
|
||||
if (eReflowReason_Initial == aReflowState.reason) {
|
||||
if (NS_FAILED(CreateDisplayFrame(aPresContext))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -1816,7 +1807,7 @@ nsComboboxControlFrame::GetFrameName(nsAString& aResult) const
|
||||
NS_IMETHODIMP
|
||||
nsComboboxControlFrame::ShowDropDown(PRBool aDoDropDown)
|
||||
{
|
||||
if (nsFormFrame::GetDisabled(this)) {
|
||||
if (nsFormControlHelper::GetDisabled(mContent)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -2103,7 +2094,7 @@ nsComboboxControlFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
if (nsEventStatus_eConsumeNoDefault == *aEventStatus) {
|
||||
return NS_OK;
|
||||
}
|
||||
if (nsFormFrame::GetDisabled(this)) {
|
||||
if (nsFormControlHelper::GetDisabled(mContent)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -2565,7 +2556,7 @@ nsComboboxControlFrame::Paint(nsIPresContext* aPresContext,
|
||||
nsCOMPtr<nsIEventStateManager> stateManager;
|
||||
nsresult rv = mPresContext->GetEventStateManager(getter_AddRefs(stateManager));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (NS_SUCCEEDED(rv) && !nsFormFrame::GetDisabled(this) && mFocused == this) {
|
||||
if (!nsFormControlHelper::GetDisabled(mContent) && mFocused == this) {
|
||||
aRenderingContext.SetLineStyle(nsLineStyle_kDotted);
|
||||
aRenderingContext.SetColor(0);
|
||||
} else {
|
||||
|
||||
@ -65,7 +65,6 @@
|
||||
#include "nsIScrollableViewProvider.h"
|
||||
#include "nsIStatefulFrame.h"
|
||||
|
||||
class nsFormFrame;
|
||||
class nsIView;
|
||||
class nsStyleContext;
|
||||
class nsIHTMLContent;
|
||||
@ -152,7 +151,6 @@ public:
|
||||
void SetFocus(PRBool aOn, PRBool aRepaint);
|
||||
void ScrollIntoView(nsIPresContext* aPresContext);
|
||||
virtual void InitializeControl(nsIPresContext* aPresContext);
|
||||
virtual void SetFormFrame(nsFormFrame* aFormFrame) { mFormFrame = aFormFrame; }
|
||||
NS_IMETHOD OnContentReset();
|
||||
|
||||
NS_IMETHOD GetFont(nsIPresContext* aPresContext,
|
||||
@ -271,7 +269,6 @@ protected:
|
||||
|
||||
nsFrameList mPopupFrames; // additional named child list
|
||||
nsIPresContext* mPresContext; // XXX: Remove the need to cache the pres context.
|
||||
nsFormFrame* mFormFrame; // Parent Form Frame
|
||||
nsCOMPtr<nsITextContent> mDisplayContent; // Anonymous content used to display the current selection
|
||||
nsIFrame* mDisplayFrame; // frame to display selection
|
||||
nsIFrame* mButtonFrame; // button frame
|
||||
|
||||
@ -36,7 +36,6 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsFileControlFrame.h"
|
||||
#include "nsFormFrame.h"
|
||||
|
||||
|
||||
#include "nsIElementFactory.h"
|
||||
@ -70,6 +69,7 @@
|
||||
#include "nsINodeInfo.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsILocalFile.h"
|
||||
|
||||
#include "nsContentCID.h"
|
||||
static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID);
|
||||
@ -91,7 +91,6 @@ NS_NewFileControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
|
||||
nsFileControlFrame::nsFileControlFrame():
|
||||
mTextFrame(nsnull),
|
||||
mFormFrame(nsnull),
|
||||
mTextContent(nsnull),
|
||||
mCachedState(nsnull)
|
||||
{
|
||||
@ -113,10 +112,6 @@ nsFileControlFrame::~nsFileControlFrame()
|
||||
delete mCachedState;
|
||||
mCachedState = nsnull;
|
||||
}
|
||||
if (mFormFrame) {
|
||||
mFormFrame->RemoveFormControlFrame(*this);
|
||||
mFormFrame = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -149,7 +144,7 @@ nsFileControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
|
||||
mTextContent->SetAttr(kNameSpaceID_None, nsHTMLAtoms::type, NS_LITERAL_STRING("text"), PR_FALSE);
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> textControl = do_QueryInterface(mTextContent);
|
||||
if (textControl) {
|
||||
textControl->SetDisabled(nsFormFrame::GetDisabled(this));
|
||||
textControl->SetDisabled(nsFormControlHelper::GetDisabled(mContent));
|
||||
// Initialize value when we create the content in case the value was set
|
||||
// before we got here
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> fileContent = do_QueryInterface(mContent);
|
||||
@ -356,9 +351,7 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext* aPresContext,
|
||||
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
|
||||
if (mFormFrame == nsnull && eReflowReason_Initial == aReflowState.reason) {
|
||||
// add ourself as an nsIFormControlFrame
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *NS_STATIC_CAST(nsIFrame*, this));
|
||||
if (eReflowReason_Initial == aReflowState.reason) {
|
||||
mTextFrame = GetTextControlFrame(aPresContext, this);
|
||||
if (!mTextFrame) return NS_ERROR_UNEXPECTED;
|
||||
if (mCachedState) {
|
||||
@ -537,14 +530,14 @@ nsFileControlFrame::AttributeChanged(nsIPresContext* aPresContext,
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> textControl = do_QueryInterface(mTextContent);
|
||||
if (textControl)
|
||||
{
|
||||
textControl->SetDisabled(nsFormFrame::GetDisabled(this));
|
||||
textControl->SetDisabled(nsFormControlHelper::GetDisabled(mContent));
|
||||
}
|
||||
} else if (nsHTMLAtoms::size == aAttribute) {
|
||||
nsString value;
|
||||
if (nsnull != mTextContent && NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::size, value)) {
|
||||
mTextContent->SetAttr(kNameSpaceID_None, nsHTMLAtoms::size, value, PR_TRUE);
|
||||
if (aHint != NS_STYLE_HINT_REFLOW) {
|
||||
nsFormFrame::StyleChangeReflow(aPresContext, this);
|
||||
nsFormControlHelper::StyleChangeReflow(aPresContext, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -559,7 +552,7 @@ nsFileControlFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
||||
nsIFrame** aFrame)
|
||||
{
|
||||
#ifndef DEBUG_NEWFRAME
|
||||
if ( nsFormFrame::GetDisabled(this) && mRect.Contains(aPoint) ) {
|
||||
if ( nsFormControlHelper::GetDisabled(mContent) && mRect.Contains(aPoint) ) {
|
||||
const nsStyleVisibility* vis =
|
||||
(const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
|
||||
|
||||
|
||||
@ -50,7 +50,6 @@
|
||||
typedef nsGfxTextControlFrame2 nsNewFrame;
|
||||
|
||||
class nsIPresState;
|
||||
class nsFormFrame;
|
||||
class nsISupportsArray;
|
||||
|
||||
class nsFileControlFrame : public nsAreaFrame,
|
||||
@ -73,8 +72,6 @@ public:
|
||||
}
|
||||
|
||||
virtual void MouseClicked(nsIPresContext* aPresContext) {}
|
||||
virtual void SetFormFrame(nsFormFrame* aFormFrame) { mFormFrame = aFormFrame; }
|
||||
virtual nsFormFrame* GetFromFrame() { return mFormFrame; }
|
||||
|
||||
NS_IMETHOD Paint(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
@ -184,7 +181,6 @@ protected:
|
||||
virtual PRIntn GetSkipSides() const;
|
||||
|
||||
nsNewFrame* mTextFrame;
|
||||
nsFormFrame* mFormFrame;
|
||||
nsIHTMLContent* mTextContent;
|
||||
nsCOMPtr<nsIHTMLContent> mBrowse;
|
||||
nsString* mCachedState;
|
||||
|
||||
@ -62,7 +62,6 @@
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsUnitConversion.h"
|
||||
#include "nsStyleUtil.h"
|
||||
#include "nsFormFrame.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsStyleUtil.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
@ -112,7 +111,6 @@ nsFormControlFrame::nsFormControlFrame()
|
||||
: nsLeafFrame()
|
||||
{
|
||||
mDidInit = PR_FALSE;
|
||||
mFormFrame = nsnull;
|
||||
mSuggestedWidth = NS_FORMSIZE_NOTSET;
|
||||
mSuggestedHeight = NS_FORMSIZE_NOTSET;
|
||||
mPresContext = nsnull;
|
||||
@ -126,10 +124,6 @@ nsFormControlFrame::nsFormControlFrame()
|
||||
|
||||
nsFormControlFrame::~nsFormControlFrame()
|
||||
{
|
||||
if (mFormFrame) {
|
||||
mFormFrame->RemoveFormControlFrame(*this);
|
||||
mFormFrame = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -550,11 +544,6 @@ nsFormControlFrame::Reflow(nsIPresContext* aPresContext,
|
||||
mDidInit = PR_TRUE;
|
||||
}
|
||||
|
||||
// add ourself as an nsIFormControlFrame
|
||||
if (!mFormFrame && (eReflowReason_Initial == aReflowState.reason)) {
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *NS_STATIC_CAST(nsIFrame*, this));
|
||||
}
|
||||
|
||||
#if 0
|
||||
nsresult skiprv = SkipResizeReflow(mCacheSize, mCachedMaxElementSize, aPresContext,
|
||||
aDesiredSize, aReflowState, aStatus);
|
||||
|
||||
@ -40,7 +40,6 @@
|
||||
|
||||
#include "nsIFormControlFrame.h"
|
||||
#include "nsFormControlHelper.h"
|
||||
#include "nsIFormManager.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsLeafFrame.h"
|
||||
@ -52,7 +51,6 @@
|
||||
class nsIView;
|
||||
class nsIPresContext;
|
||||
class nsStyleCoord;
|
||||
class nsFormFrame;
|
||||
|
||||
#define CSS_NOTSET -1
|
||||
#define ATTR_NOTSET -1
|
||||
@ -199,8 +197,6 @@ public:
|
||||
NS_IMETHOD GetMaxLength(PRInt32* aSize);
|
||||
|
||||
virtual void SetClickPoint(nscoord aX, nscoord aY);
|
||||
nsFormFrame* GetFormFrame() { return mFormFrame; }
|
||||
virtual void SetFormFrame(nsFormFrame* aFormFrame) { mFormFrame = aFormFrame; }
|
||||
|
||||
NS_IMETHOD GetFont(nsIPresContext* aPresContext,
|
||||
const nsFont*& aFont);
|
||||
@ -326,7 +322,6 @@ protected:
|
||||
nsSize mWidgetSize;
|
||||
PRBool mDidInit;
|
||||
nsPoint mLastClickPoint;
|
||||
nsFormFrame* mFormFrame;
|
||||
nscoord mSuggestedWidth;
|
||||
nscoord mSuggestedHeight;
|
||||
|
||||
|
||||
@ -62,7 +62,6 @@
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsUnitConversion.h"
|
||||
#include "nsStyleUtil.h"
|
||||
#include "nsFormFrame.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsStyleUtil.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
@ -714,44 +713,6 @@ nsFormControlHelper::GetName(nsIContent* aContent, nsAString* aResult)
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsFormControlHelper::GetValue(nsIContent* aContent, nsAString* aResult)
|
||||
{
|
||||
nsresult result = NS_FORM_NOTOK;
|
||||
|
||||
nsCOMPtr<nsIHTMLContent> formControl(do_QueryInterface(aContent));
|
||||
|
||||
if (formControl) {
|
||||
nsHTMLValue value;
|
||||
result = formControl->GetHTMLAttribute(nsHTMLAtoms::value, value);
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == result) {
|
||||
if (eHTMLUnit_String == value.GetUnit()) {
|
||||
value.GetStringValue(*aResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFormControlHelper::GetInputElementValue(nsIContent* aContent, nsString* aText, PRBool aInitialValue)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
nsIDOMHTMLInputElement* inputElem = nsnull;
|
||||
result = aContent->QueryInterface(NS_GET_IID(nsIDOMHTMLInputElement), (void**)&inputElem);
|
||||
if ((NS_OK == result) && inputElem) {
|
||||
if (PR_TRUE == aInitialValue) {
|
||||
result = inputElem->GetDefaultValue(*aText);
|
||||
}
|
||||
else {
|
||||
result = inputElem->GetValue(*aText);
|
||||
}
|
||||
|
||||
NS_RELEASE(inputElem);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Return localised string for resource string (e.g. "Submit" -> "Submit Query")
|
||||
// This code is derived from nsBookmarksService::Init() and cookie_Localize()
|
||||
@ -783,91 +744,6 @@ nsFormControlHelper::GetLocalizedString(const char * aPropFileName, const PRUnic
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Return value of disabled attribute or PR_FALSE if none set
|
||||
nsresult
|
||||
nsFormControlHelper::GetDisabled(nsIContent* aContent, PRBool* oIsDisabled)
|
||||
{
|
||||
nsCOMPtr<nsIHTMLContent> formControl = do_QueryInterface(aContent);
|
||||
nsHTMLValue value;
|
||||
nsresult result = formControl->GetHTMLAttribute(nsHTMLAtoms::disabled, value);
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == result) {
|
||||
if (eHTMLUnit_Empty == value.GetUnit()) {
|
||||
*oIsDisabled = PR_TRUE;
|
||||
} else {
|
||||
*oIsDisabled = PR_FALSE;
|
||||
}
|
||||
} else {
|
||||
*oIsDisabled = PR_FALSE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// manual submission helper method
|
||||
// aPresShell - If the PresShell is null then the PresContext will
|
||||
// get its own and use itstatic nsresult
|
||||
// aFormFrame - The HTML Form's frame
|
||||
// aFormControlFrame - The form controls frame that is calling this
|
||||
// it can be null
|
||||
// aDoSubmit - Submit = TRUE, Reset = FALSE
|
||||
// Indicates whether to do DOM Processing of the event or to do regular frame processing
|
||||
nsresult
|
||||
nsFormControlHelper::DoManualSubmitOrReset(nsIPresContext* aPresContext,
|
||||
nsIPresShell* aPresShell,
|
||||
nsIFrame* aFormFrame,
|
||||
nsIFrame* aFormControlFrame,
|
||||
PRBool aDoSubmit,
|
||||
PRBool aDoDOMEvent)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPresContext);
|
||||
NS_ENSURE_ARG_POINTER(aFormFrame);
|
||||
|
||||
nsresult result = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIContent> formContent;
|
||||
aFormFrame->GetContent(getter_AddRefs(formContent));
|
||||
|
||||
// Here we save a pointer to the form control content
|
||||
// so we can get its frame again after the Shell has processed the event.
|
||||
//
|
||||
// Control's Frame may get destroyed during the processing of the event (by the Shell)
|
||||
// meaning: aFormControlFrame becomes invalid, so instead of using aFormControlFrame
|
||||
// we use the saved content and the shell to go back and get the frame and
|
||||
// use it only if it isn't null
|
||||
nsCOMPtr<nsIContent> controlContent;
|
||||
if (aDoSubmit && aFormControlFrame != nsnull) {
|
||||
aFormControlFrame->GetContent(getter_AddRefs(controlContent));
|
||||
}
|
||||
|
||||
if (formContent) {
|
||||
//Either use the PresShell passed in or go get it from the PresContext
|
||||
nsCOMPtr<nsIPresShell> shell; // this will do our clean up
|
||||
if (aPresShell == nsnull) {
|
||||
result = aPresContext->GetShell(getter_AddRefs(shell));
|
||||
aPresShell = shell.get(); // not AddRefing because shell will clean up
|
||||
}
|
||||
|
||||
// With a valid PreShell handle the event
|
||||
if (NS_SUCCEEDED(result) && nsnull != aPresShell) {
|
||||
|
||||
// Get originator for event (failure is non-fatal)
|
||||
nsCOMPtr<nsIContent> formControl;
|
||||
aFormControlFrame->GetContent(getter_AddRefs(formControl));
|
||||
|
||||
nsFormEvent event;
|
||||
event.eventStructType = NS_FORM_EVENT;
|
||||
event.message = aDoSubmit?NS_FORM_SUBMIT:NS_FORM_RESET;
|
||||
event.originator = formControl;
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
if (aDoDOMEvent) {
|
||||
aPresShell->HandleDOMEventWithTarget(formContent, &event, &status);
|
||||
} else {
|
||||
aPresShell->HandleEventWithTarget(&event, nsnull, formContent, NS_EVENT_FLAG_INIT, &status);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFormControlHelper::Reset(nsIFrame* aFrame, nsIPresContext* aPresContext)
|
||||
{
|
||||
@ -883,3 +759,19 @@ nsFormControlHelper::Reset(nsIFrame* aFrame, nsIPresContext* aPresContext)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
void
|
||||
nsFormControlHelper::StyleChangeReflow(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
|
||||
nsHTMLReflowCommand* reflowCmd;
|
||||
nsresult rv = NS_NewHTMLReflowCommand(&reflowCmd, aFrame,
|
||||
eReflowType_StyleChanged);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
shell->AppendReflowCommand(reflowCmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -39,20 +39,18 @@
|
||||
#define nsFormControlHelper_h___
|
||||
|
||||
#include "nsIFormControlFrame.h"
|
||||
#include "nsIFormManager.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsLeafFrame.h"
|
||||
#include "nsCoord.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
||||
class nsIView;
|
||||
//class nsIPresContext;
|
||||
class nsIPresContext;
|
||||
class nsStyleCoord;
|
||||
class nsFormFrame;
|
||||
class nsIPresState;
|
||||
//class nsIStyleContext;
|
||||
class nsIStyleContext;
|
||||
|
||||
#define CSS_NOTSET -1
|
||||
#define ATTR_NOTSET -1
|
||||
@ -156,27 +154,43 @@ public:
|
||||
// Map platform line endings (CR, CRLF, LF) to DOM line endings (LF)
|
||||
static void PlatformToDOMLineBreaks(nsString &aString);
|
||||
|
||||
static nsresult GetValue(nsIContent* aContent, nsAString* aResult);
|
||||
/**
|
||||
* Get whether a form control is disabled
|
||||
* @param aContent the content of the form control in question
|
||||
* @return whether the form control is disabled
|
||||
*/
|
||||
static PRBool GetDisabled(nsIContent* aContent) {
|
||||
return aContent->HasAttr(kNameSpaceID_None, nsHTMLAtoms::disabled);
|
||||
};
|
||||
/**
|
||||
* Get the name of the form control
|
||||
* @param aContent the content to get the name of
|
||||
* @param aResult the returned name of the form control [OUT]
|
||||
* @return NS_CONTENT_ATTR_HAS_VALUE if things go well
|
||||
* @return NS_CONTENT_ATTR_NOT_THERE if the name attribute is undefined
|
||||
* @return NS_FORM_NOTOK if aContent is null or is not HTML content
|
||||
*/
|
||||
static nsresult GetName(nsIContent* aContent, nsAString* aResult);
|
||||
static nsresult GetInputElementValue(nsIContent* aContent, nsString* aText, PRBool aInitialValue);
|
||||
/**
|
||||
* Cause the form control to reset its value
|
||||
* @param aFrame the frame who owns the form control
|
||||
* @param aPresContext the pres context
|
||||
*/
|
||||
static nsresult Reset(nsIFrame* aFrame, nsIPresContext* aPresContext);
|
||||
|
||||
/**
|
||||
* Utility to convert a string to a PRBool
|
||||
* @param aValue string to convert to a PRBool
|
||||
* @returns PR_TRUE if aValue = "1", PR_FALSE otherwise
|
||||
*/
|
||||
|
||||
/**
|
||||
* Utility to convert a string to a PRBool
|
||||
* @param aValue string to convert to a PRBool
|
||||
* @returns PR_TRUE if aValue = "1", PR_FALSE otherwise
|
||||
*/
|
||||
static PRBool GetBool(const nsAString& aValue);
|
||||
|
||||
/**
|
||||
* Utility to convert a PRBool to a string
|
||||
* @param aValue Boolean value to convert to string.
|
||||
* @param aResult string to hold the boolean value. It is set to "1"
|
||||
* if aValue equals PR_TRUE, "0" if aValue equals PR_FALSE.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* Utility to convert a PRBool to a string
|
||||
* @param aValue Boolean value to convert to string.
|
||||
* @param aResult string to hold the boolean value. It is set to "1"
|
||||
* if aValue equals PR_TRUE, "0" if aValue equals PR_FALSE.
|
||||
*/
|
||||
static void GetBoolString(const PRBool aValue, nsAString& aResult);
|
||||
|
||||
static void GetRepChars(char& char1, char& char2) {
|
||||
@ -202,16 +216,6 @@ public:
|
||||
static nsresult GetLocalizedString(const char * aPropFileName, const PRUnichar* aKey, nsString& oVal);
|
||||
static const char * GetHTMLPropertiesFileName() { return FORM_PROPERTIES; }
|
||||
|
||||
static nsresult GetDisabled(nsIContent* aContent, PRBool* oIsDisabled);
|
||||
|
||||
// If the PresShell is null then the PresContext will get its own and use it
|
||||
static nsresult DoManualSubmitOrReset(nsIPresContext* aPresContext,
|
||||
nsIPresShell* aPresShell,
|
||||
nsIFrame* aFormFrame,
|
||||
nsIFrame* aFormControlFrame,
|
||||
PRBool aDoSubmit, // Submit = TRUE, Reset = FALSE
|
||||
PRBool aDoDOMEvent);
|
||||
|
||||
//
|
||||
//-------------------------------------------------------------------------------------
|
||||
// Utility methods for managing checkboxes and radiobuttons
|
||||
@ -355,6 +359,9 @@ public:
|
||||
nsIStyleContext* aStyleContext, nsString& aLabel,
|
||||
nsIFrame* aForFrame);
|
||||
|
||||
static void StyleChangeReflow(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame);
|
||||
|
||||
protected:
|
||||
nsFormControlHelper();
|
||||
virtual ~nsFormControlHelper();
|
||||
|
||||
@ -49,6 +49,7 @@
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsReflowPath.h"
|
||||
// MouseEvent suppression in PP
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
@ -538,13 +539,7 @@ nsGfxButtonControlFrame::Reflow(nsIPresContext* aPresContext,
|
||||
DO_GLOBAL_REFLOW_COUNT("nsGfxButtonControlFrame", aReflowState.reason);
|
||||
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
||||
|
||||
// The mFormFrame is set in the initial reflow within nsHTMLButtonControlFrame
|
||||
nsresult rv = NS_OK;
|
||||
if (eReflowReason_Initial == aReflowState.reason) {
|
||||
if (!mFormFrame) {
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *NS_STATIC_CAST(nsIFrame*, this));
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
nsresult skiprv = nsFormControlFrame::SkipResizeReflow(mCacheSize, mCachedMaxElementSize, aPresContext,
|
||||
|
||||
@ -39,7 +39,6 @@
|
||||
#include "nsICheckButton.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsHTMLParts.h"
|
||||
#include "nsFormFrame.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIComponentManager.h"
|
||||
@ -54,6 +53,7 @@
|
||||
#endif
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
|
||||
|
||||
//------------------------------------------------------------
|
||||
|
||||
@ -38,7 +38,6 @@
|
||||
#include "nsGfxRadioControlFrame.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsHTMLParts.h"
|
||||
#include "nsFormFrame.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
|
||||
@ -43,7 +43,6 @@
|
||||
#include "nsIFormControlFrame.h"
|
||||
#include "nsHTMLParts.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsFormFrame.h"
|
||||
|
||||
#include "nsIRenderingContext.h"
|
||||
#include "nsIPresContext.h"
|
||||
@ -68,6 +67,8 @@
|
||||
#include "nsFormControlFrame.h"
|
||||
#include "nsIFrameManager.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsReflowPath.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsIAccessibilityService.h"
|
||||
#endif
|
||||
@ -114,10 +115,6 @@ NS_IMETHODIMP
|
||||
nsHTMLButtonControlFrame::Destroy(nsIPresContext *aPresContext)
|
||||
{
|
||||
nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_FALSE);
|
||||
if (mFormFrame) {
|
||||
mFormFrame->RemoveFormControlFrame(*this);
|
||||
mFormFrame = nsnull;
|
||||
}
|
||||
return nsHTMLContainerFrame::Destroy(aPresContext);
|
||||
}
|
||||
|
||||
@ -373,9 +370,6 @@ nsHTMLButtonControlFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
{
|
||||
// add ourself as an nsIFormControlFrame
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *NS_STATIC_CAST(nsIFrame*, this));
|
||||
|
||||
// get the frame manager and the style context of the new parent frame
|
||||
// this is used whent he children are reparented below
|
||||
// NOTE: the whole reparenting should not need to happen: see bugzilla bug 51767
|
||||
@ -500,9 +494,8 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext,
|
||||
DO_GLOBAL_REFLOW_COUNT("nsHTMLButtonControlFrame", aReflowState.reason);
|
||||
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
||||
|
||||
if (!mFormFrame && (eReflowReason_Initial == aReflowState.reason)) {
|
||||
if (eReflowReason_Initial == aReflowState.reason) {
|
||||
nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_TRUE);
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *NS_STATIC_CAST(nsIFrame*, this));
|
||||
}
|
||||
|
||||
#if 0
|
||||
@ -604,8 +597,10 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext,
|
||||
0, aStatus);
|
||||
|
||||
// calculate the min internal size so the contents gets centered correctly
|
||||
nscoord minInternalWidth = aReflowState.mComputedMinWidth == 0?0:aReflowState.mComputedMinWidth -
|
||||
(aReflowState.mComputedBorderPadding.left + aReflowState.mComputedBorderPadding.right);
|
||||
// minInternalWidth is not being used at all and causes a warning--commenting
|
||||
// out until someone wants it.
|
||||
// nscoord minInternalWidth = aReflowState.mComputedMinWidth == 0?0:aReflowState.mComputedMinWidth -
|
||||
// (aReflowState.mComputedBorderPadding.left + aReflowState.mComputedBorderPadding.right);
|
||||
nscoord minInternalHeight = aReflowState.mComputedMinHeight == 0?0:aReflowState.mComputedMinHeight -
|
||||
(aReflowState.mComputedBorderPadding.top + aReflowState.mComputedBorderPadding.bottom);
|
||||
|
||||
|
||||
@ -44,7 +44,6 @@
|
||||
#include "nsIFormControlFrame.h"
|
||||
#include "nsHTMLParts.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsFormFrame.h"
|
||||
|
||||
#include "nsIRenderingContext.h"
|
||||
#include "nsIPresContext.h"
|
||||
@ -132,7 +131,6 @@ public:
|
||||
NS_IMETHOD GetName(nsAString* aName);
|
||||
NS_IMETHOD GetValue(nsAString* aName);
|
||||
virtual void MouseClicked(nsIPresContext* aPresContext);
|
||||
virtual void SetFormFrame(nsFormFrame* aFormFrame) { mFormFrame = aFormFrame; }
|
||||
NS_IMETHOD OnContentReset();
|
||||
|
||||
void SetFocus(PRBool aOn, PRBool aRepaint);
|
||||
@ -168,7 +166,6 @@ protected:
|
||||
|
||||
PRIntn GetSkipSides() const;
|
||||
PRBool mInline;
|
||||
nsFormFrame* mFormFrame;
|
||||
nsCursor mPreviousCursor;
|
||||
nsRect mTranslatedRect;
|
||||
PRBool mDidInit;
|
||||
|
||||
@ -41,7 +41,6 @@
|
||||
#include "nsISupports.h"
|
||||
#include "nsFont.h"
|
||||
|
||||
class nsFormFrame;
|
||||
class nsIPresContext;
|
||||
class nsString;
|
||||
class nsIContent;
|
||||
|
||||
@ -40,7 +40,6 @@
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsFont.h"
|
||||
class nsFormFrame;
|
||||
class nsIPresContext;
|
||||
class nsAString;
|
||||
class nsIContent;
|
||||
@ -71,8 +70,6 @@ public:
|
||||
|
||||
virtual void MouseClicked(nsIPresContext* aPresContext) = 0;
|
||||
|
||||
virtual void SetFormFrame(nsFormFrame* aFrame) = 0;
|
||||
|
||||
/**
|
||||
* Set the suggested size for the form element.
|
||||
* This is used to control the size of the element during reflow if it hasn't had it's size
|
||||
|
||||
@ -40,7 +40,6 @@
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsFont.h"
|
||||
class nsFormFrame;
|
||||
class nsIPresContext;
|
||||
class nsAString;
|
||||
class nsIContent;
|
||||
|
||||
@ -73,6 +73,11 @@ public:
|
||||
|
||||
NS_IMETHOD GetTextLength(PRInt32* aTextLength) = 0;
|
||||
|
||||
/**
|
||||
* Fire onChange if the value has changed since it was focused or since it
|
||||
* was last fired.
|
||||
*/
|
||||
NS_IMETHOD CheckFireOnChange() = 0;
|
||||
NS_IMETHOD SetSelectionStart(PRInt32 aSelectionStart) = 0;
|
||||
NS_IMETHOD SetSelectionEnd(PRInt32 aSelectionEnd) = 0;
|
||||
|
||||
|
||||
@ -57,10 +57,10 @@
|
||||
#include "nsIImage.h"
|
||||
#include "nsStyleUtil.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsFormFrame.h"
|
||||
#include "nsFormControlFrame.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsIAccessibilityService.h"
|
||||
#endif
|
||||
@ -121,8 +121,6 @@ public:
|
||||
|
||||
virtual void MouseClicked(nsIPresContext* aPresContext);
|
||||
|
||||
virtual void SetFormFrame(nsFormFrame* aFormFrame) { mFormFrame = aFormFrame; }
|
||||
|
||||
NS_IMETHOD GetType(PRInt32* aType) const;
|
||||
|
||||
NS_IMETHOD GetName(nsAString* aName);
|
||||
@ -159,7 +157,6 @@ protected:
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
|
||||
nsFormFrame* mFormFrame;
|
||||
nsMouseState mLastMouseState;
|
||||
nsPoint mLastClickPoint;
|
||||
nsCursor mPreviousCursor;
|
||||
@ -176,7 +173,6 @@ nsImageControlFrame::nsImageControlFrame()
|
||||
mPreviousCursor = eCursor_standard;
|
||||
mTranslatedRect = nsRect(0,0,0,0);
|
||||
mGotFocus = PR_FALSE;
|
||||
mFormFrame = nsnull;
|
||||
}
|
||||
|
||||
nsImageControlFrame::~nsImageControlFrame()
|
||||
@ -188,10 +184,6 @@ nsImageControlFrame::Destroy(nsIPresContext *aPresContext)
|
||||
{
|
||||
nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_FALSE);
|
||||
|
||||
if (mFormFrame) {
|
||||
mFormFrame->RemoveFormControlFrame(*this);
|
||||
mFormFrame = nsnull;
|
||||
}
|
||||
return nsImageControlFrameSuper::Destroy(aPresContext);
|
||||
}
|
||||
|
||||
@ -313,10 +305,8 @@ nsImageControlFrame::Reflow(nsIPresContext* aPresContext,
|
||||
{
|
||||
DO_GLOBAL_REFLOW_COUNT("nsImageControlFrame", aReflowState.reason);
|
||||
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
||||
if (!mFormFrame && (eReflowReason_Initial == aReflowState.reason)) {
|
||||
if (aReflowState.reason == eReflowReason_Initial) {
|
||||
nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_TRUE);
|
||||
// add ourself as an nsIFormControlFrame
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *NS_STATIC_CAST(nsIFrame*, this));
|
||||
}
|
||||
return nsImageControlFrameSuper::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
|
||||
}
|
||||
@ -339,7 +329,7 @@ nsImageControlFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE || uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED)
|
||||
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
|
||||
if (nsFormFrame::GetDisabled(this)) { // XXX cache disabled
|
||||
if (nsFormControlHelper::GetDisabled(mContent)) { // XXX cache disabled
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -414,7 +404,7 @@ nsImageControlFrame::GetName(nsAString* aResult)
|
||||
if (nsnull == aResult) {
|
||||
return NS_OK;
|
||||
} else {
|
||||
return nsFormFrame::GetName(this, *aResult);
|
||||
return nsFormControlHelper::GetName(mContent, aResult);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +54,6 @@
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
#include "nsIComboboxControlFrame.h"
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsFormFrame.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsIDOMHTMLOptGroupElement.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
@ -77,6 +76,7 @@
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsIAccessibilityService.h"
|
||||
#endif
|
||||
@ -84,6 +84,7 @@
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsILookAndFeel.h"
|
||||
#include "nsReflowPath.h"
|
||||
|
||||
// Timer Includes
|
||||
#include "nsITimer.h"
|
||||
@ -393,7 +394,6 @@ nsListControlFrame::nsListControlFrame()
|
||||
: mWeakReferent(this)
|
||||
{
|
||||
mComboboxFrame = nsnull;
|
||||
mFormFrame = nsnull;
|
||||
mButtonDown = PR_FALSE;
|
||||
mMaxWidth = 0;
|
||||
mMaxHeight = 0;
|
||||
@ -433,10 +433,6 @@ nsListControlFrame::~nsListControlFrame()
|
||||
}
|
||||
|
||||
mComboboxFrame = nsnull;
|
||||
if (mFormFrame) {
|
||||
mFormFrame->RemoveFormControlFrame(*this);
|
||||
mFormFrame = nsnull;
|
||||
}
|
||||
NS_IF_RELEASE(mPresContext);
|
||||
}
|
||||
|
||||
@ -920,9 +916,8 @@ nsListControlFrame::Reflow(nsIPresContext* aPresContext,
|
||||
|
||||
// Add the list frame as a child of the form
|
||||
if (eReflowReason_Initial == aReflowState.reason) {
|
||||
if (IsInDropDownMode() == PR_FALSE && !mFormFrame) {
|
||||
if (!IsInDropDownMode()) {
|
||||
nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_TRUE);
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *NS_STATIC_CAST(nsIFrame*, this));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1604,7 +1599,7 @@ nsListControlFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE || uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED)
|
||||
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
|
||||
if (nsFormFrame::GetDisabled(this))
|
||||
if (nsFormControlHelper::GetDisabled(mContent))
|
||||
return NS_OK;
|
||||
|
||||
switch (aEvent->message) {
|
||||
@ -1929,13 +1924,6 @@ nsListControlFrame::GetType(PRInt32* aType) const
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
void
|
||||
nsListControlFrame::SetFormFrame(nsFormFrame* aFormFrame)
|
||||
{
|
||||
mFormFrame = aFormFrame;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------
|
||||
void
|
||||
@ -2742,7 +2730,7 @@ nsListControlFrame::MouseUp(nsIDOMEvent* aMouseEvent)
|
||||
|
||||
mButtonDown = PR_FALSE;
|
||||
|
||||
if (nsFormFrame::GetDisabled(this)) {
|
||||
if (nsFormControlHelper::GetDisabled(mContent)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -2927,7 +2915,7 @@ nsListControlFrame::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
|
||||
mButtonDown = PR_TRUE;
|
||||
|
||||
if (nsFormFrame::GetDisabled(this)) {
|
||||
if (nsFormControlHelper::GetDisabled(mContent)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -3250,7 +3238,7 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
|
||||
{
|
||||
NS_ASSERTION(aKeyEvent != nsnull, "keyEvent is null.");
|
||||
|
||||
if (nsFormFrame::GetDisabled(this))
|
||||
if (nsFormControlHelper::GetDisabled(mContent))
|
||||
return NS_OK;
|
||||
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
@ -242,7 +242,6 @@ public:
|
||||
virtual void SetFocus(PRBool aOn = PR_TRUE, PRBool aRepaint = PR_FALSE);
|
||||
virtual void ScrollIntoView(nsIPresContext* aPresContext);
|
||||
virtual void MouseClicked(nsIPresContext* aPresContext);
|
||||
virtual void SetFormFrame(nsFormFrame* aFrame);
|
||||
virtual nscoord GetVerticalInsidePadding(nsIPresContext* aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerHeight) const;
|
||||
@ -381,8 +380,6 @@ protected:
|
||||
void ItemsHaveBeenRemoved(nsIPresContext * aPresContext);
|
||||
|
||||
// Data Members
|
||||
nsFormFrame* mFormFrame;
|
||||
|
||||
PRInt32 mStartSelectionIndex;
|
||||
PRInt32 mEndSelectionIndex;
|
||||
PRPackedBool mChangesSinceDragStart;
|
||||
|
||||
@ -29,7 +29,6 @@ include $(DEPTH)/config/autoconf.mk
|
||||
MODULE = layout
|
||||
|
||||
EXPORTS = \
|
||||
nsIFormManager.h \
|
||||
nsIListControlFrame.h \
|
||||
nsIImageControlFrame.h \
|
||||
nsIComboboxControlFrame.h \
|
||||
|
||||
@ -21,8 +21,7 @@
|
||||
|
||||
DEPTH=..\..\..\..
|
||||
|
||||
EXPORTS=nsIFormManager.h \
|
||||
nsIListControlFrame.h \
|
||||
EXPORTS=nsIListControlFrame.h \
|
||||
nsIImageControlFrame.h \
|
||||
nsIComboboxControlFrame.h \
|
||||
nsIRadioControlFrame.h \
|
||||
|
||||
@ -41,7 +41,6 @@
|
||||
#include "nsISupports.h"
|
||||
#include "nsFont.h"
|
||||
|
||||
class nsFormFrame;
|
||||
class nsIPresContext;
|
||||
class nsString;
|
||||
class nsIContent;
|
||||
|
||||
@ -40,7 +40,6 @@
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsFont.h"
|
||||
class nsFormFrame;
|
||||
class nsIPresContext;
|
||||
class nsAString;
|
||||
class nsIContent;
|
||||
@ -71,8 +70,6 @@ public:
|
||||
|
||||
virtual void MouseClicked(nsIPresContext* aPresContext) = 0;
|
||||
|
||||
virtual void SetFormFrame(nsFormFrame* aFrame) = 0;
|
||||
|
||||
/**
|
||||
* Set the suggested size for the form element.
|
||||
* This is used to control the size of the element during reflow if it hasn't had it's size
|
||||
|
||||
@ -73,6 +73,11 @@ public:
|
||||
|
||||
NS_IMETHOD GetTextLength(PRInt32* aTextLength) = 0;
|
||||
|
||||
/**
|
||||
* Fire onChange if the value has changed since it was focused or since it
|
||||
* was last fired.
|
||||
*/
|
||||
NS_IMETHOD CheckFireOnChange() = 0;
|
||||
NS_IMETHOD SetSelectionStart(PRInt32 aSelectionStart) = 0;
|
||||
NS_IMETHOD SetSelectionEnd(PRInt32 aSelectionEnd) = 0;
|
||||
|
||||
|
||||
@ -40,7 +40,6 @@
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsFont.h"
|
||||
class nsFormFrame;
|
||||
class nsIPresContext;
|
||||
class nsAString;
|
||||
class nsIContent;
|
||||
|
||||
@ -73,6 +73,11 @@ public:
|
||||
|
||||
NS_IMETHOD GetTextLength(PRInt32* aTextLength) = 0;
|
||||
|
||||
/**
|
||||
* Fire onChange if the value has changed since it was focused or since it
|
||||
* was last fired.
|
||||
*/
|
||||
NS_IMETHOD CheckFireOnChange() = 0;
|
||||
NS_IMETHOD SetSelectionStart(PRInt32 aSelectionStart) = 0;
|
||||
NS_IMETHOD SetSelectionEnd(PRInt32 aSelectionEnd) = 0;
|
||||
|
||||
|
||||
@ -62,7 +62,6 @@ CPPSRCS = \
|
||||
nsFileControlFrame.cpp \
|
||||
nsFormControlFrame.cpp \
|
||||
nsFormControlHelper.cpp \
|
||||
nsFormFrame.cpp \
|
||||
nsGfxButtonControlFrame.cpp \
|
||||
nsGfxCheckboxControlFrame.cpp \
|
||||
nsGfxRadioControlFrame.cpp \
|
||||
|
||||
@ -55,7 +55,6 @@ CPP_OBJS= \
|
||||
.\$(OBJDIR)\nsFormControlHelper.obj \
|
||||
.\$(OBJDIR)\nsComboboxControlFrame.obj \
|
||||
.\$(OBJDIR)\nsListControlFrame.obj \
|
||||
.\$(OBJDIR)\nsFormFrame.obj \
|
||||
.\$(OBJDIR)\nsFormControlFrame.obj \
|
||||
.\$(OBJDIR)\nsFileControlFrame.obj \
|
||||
.\$(OBJDIR)\nsGfxTextControlFrame2.obj \
|
||||
|
||||
@ -40,7 +40,6 @@
|
||||
#include "nsComboboxControlFrame.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIFrameManager.h"
|
||||
#include "nsFormFrame.h"
|
||||
#include "nsFormControlFrame.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
@ -284,7 +283,6 @@ nsComboboxControlFrame::nsComboboxControlFrame()
|
||||
: nsAreaFrame()
|
||||
{
|
||||
mPresContext = nsnull;
|
||||
mFormFrame = nsnull;
|
||||
mListControlFrame = nsnull;
|
||||
mDroppedDown = PR_FALSE;
|
||||
mDisplayFrame = nsnull;
|
||||
@ -319,11 +317,6 @@ nsComboboxControlFrame::~nsComboboxControlFrame()
|
||||
{
|
||||
REFLOW_COUNTER_DUMP("nsCCF");
|
||||
|
||||
if (mFormFrame) {
|
||||
mFormFrame->RemoveFormControlFrame(*this);
|
||||
mFormFrame = nsnull;
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(mPresContext);
|
||||
}
|
||||
|
||||
@ -1262,9 +1255,7 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// add ourself to the form control
|
||||
if (!mFormFrame && (eReflowReason_Initial == aReflowState.reason)) {
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *NS_STATIC_CAST(nsIFrame*,this));
|
||||
if (eReflowReason_Initial == aReflowState.reason) {
|
||||
if (NS_FAILED(CreateDisplayFrame(aPresContext))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -1816,7 +1807,7 @@ nsComboboxControlFrame::GetFrameName(nsAString& aResult) const
|
||||
NS_IMETHODIMP
|
||||
nsComboboxControlFrame::ShowDropDown(PRBool aDoDropDown)
|
||||
{
|
||||
if (nsFormFrame::GetDisabled(this)) {
|
||||
if (nsFormControlHelper::GetDisabled(mContent)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -2103,7 +2094,7 @@ nsComboboxControlFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
if (nsEventStatus_eConsumeNoDefault == *aEventStatus) {
|
||||
return NS_OK;
|
||||
}
|
||||
if (nsFormFrame::GetDisabled(this)) {
|
||||
if (nsFormControlHelper::GetDisabled(mContent)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -2565,7 +2556,7 @@ nsComboboxControlFrame::Paint(nsIPresContext* aPresContext,
|
||||
nsCOMPtr<nsIEventStateManager> stateManager;
|
||||
nsresult rv = mPresContext->GetEventStateManager(getter_AddRefs(stateManager));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (NS_SUCCEEDED(rv) && !nsFormFrame::GetDisabled(this) && mFocused == this) {
|
||||
if (!nsFormControlHelper::GetDisabled(mContent) && mFocused == this) {
|
||||
aRenderingContext.SetLineStyle(nsLineStyle_kDotted);
|
||||
aRenderingContext.SetColor(0);
|
||||
} else {
|
||||
|
||||
@ -65,7 +65,6 @@
|
||||
#include "nsIScrollableViewProvider.h"
|
||||
#include "nsIStatefulFrame.h"
|
||||
|
||||
class nsFormFrame;
|
||||
class nsIView;
|
||||
class nsStyleContext;
|
||||
class nsIHTMLContent;
|
||||
@ -152,7 +151,6 @@ public:
|
||||
void SetFocus(PRBool aOn, PRBool aRepaint);
|
||||
void ScrollIntoView(nsIPresContext* aPresContext);
|
||||
virtual void InitializeControl(nsIPresContext* aPresContext);
|
||||
virtual void SetFormFrame(nsFormFrame* aFormFrame) { mFormFrame = aFormFrame; }
|
||||
NS_IMETHOD OnContentReset();
|
||||
|
||||
NS_IMETHOD GetFont(nsIPresContext* aPresContext,
|
||||
@ -271,7 +269,6 @@ protected:
|
||||
|
||||
nsFrameList mPopupFrames; // additional named child list
|
||||
nsIPresContext* mPresContext; // XXX: Remove the need to cache the pres context.
|
||||
nsFormFrame* mFormFrame; // Parent Form Frame
|
||||
nsCOMPtr<nsITextContent> mDisplayContent; // Anonymous content used to display the current selection
|
||||
nsIFrame* mDisplayFrame; // frame to display selection
|
||||
nsIFrame* mButtonFrame; // button frame
|
||||
|
||||
@ -36,7 +36,6 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsFileControlFrame.h"
|
||||
#include "nsFormFrame.h"
|
||||
|
||||
|
||||
#include "nsIElementFactory.h"
|
||||
@ -70,6 +69,7 @@
|
||||
#include "nsINodeInfo.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsILocalFile.h"
|
||||
|
||||
#include "nsContentCID.h"
|
||||
static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID);
|
||||
@ -91,7 +91,6 @@ NS_NewFileControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
|
||||
nsFileControlFrame::nsFileControlFrame():
|
||||
mTextFrame(nsnull),
|
||||
mFormFrame(nsnull),
|
||||
mTextContent(nsnull),
|
||||
mCachedState(nsnull)
|
||||
{
|
||||
@ -113,10 +112,6 @@ nsFileControlFrame::~nsFileControlFrame()
|
||||
delete mCachedState;
|
||||
mCachedState = nsnull;
|
||||
}
|
||||
if (mFormFrame) {
|
||||
mFormFrame->RemoveFormControlFrame(*this);
|
||||
mFormFrame = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -149,7 +144,7 @@ nsFileControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
|
||||
mTextContent->SetAttr(kNameSpaceID_None, nsHTMLAtoms::type, NS_LITERAL_STRING("text"), PR_FALSE);
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> textControl = do_QueryInterface(mTextContent);
|
||||
if (textControl) {
|
||||
textControl->SetDisabled(nsFormFrame::GetDisabled(this));
|
||||
textControl->SetDisabled(nsFormControlHelper::GetDisabled(mContent));
|
||||
// Initialize value when we create the content in case the value was set
|
||||
// before we got here
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> fileContent = do_QueryInterface(mContent);
|
||||
@ -356,9 +351,7 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext* aPresContext,
|
||||
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
|
||||
if (mFormFrame == nsnull && eReflowReason_Initial == aReflowState.reason) {
|
||||
// add ourself as an nsIFormControlFrame
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *NS_STATIC_CAST(nsIFrame*, this));
|
||||
if (eReflowReason_Initial == aReflowState.reason) {
|
||||
mTextFrame = GetTextControlFrame(aPresContext, this);
|
||||
if (!mTextFrame) return NS_ERROR_UNEXPECTED;
|
||||
if (mCachedState) {
|
||||
@ -537,14 +530,14 @@ nsFileControlFrame::AttributeChanged(nsIPresContext* aPresContext,
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> textControl = do_QueryInterface(mTextContent);
|
||||
if (textControl)
|
||||
{
|
||||
textControl->SetDisabled(nsFormFrame::GetDisabled(this));
|
||||
textControl->SetDisabled(nsFormControlHelper::GetDisabled(mContent));
|
||||
}
|
||||
} else if (nsHTMLAtoms::size == aAttribute) {
|
||||
nsString value;
|
||||
if (nsnull != mTextContent && NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::size, value)) {
|
||||
mTextContent->SetAttr(kNameSpaceID_None, nsHTMLAtoms::size, value, PR_TRUE);
|
||||
if (aHint != NS_STYLE_HINT_REFLOW) {
|
||||
nsFormFrame::StyleChangeReflow(aPresContext, this);
|
||||
nsFormControlHelper::StyleChangeReflow(aPresContext, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -559,7 +552,7 @@ nsFileControlFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
||||
nsIFrame** aFrame)
|
||||
{
|
||||
#ifndef DEBUG_NEWFRAME
|
||||
if ( nsFormFrame::GetDisabled(this) && mRect.Contains(aPoint) ) {
|
||||
if ( nsFormControlHelper::GetDisabled(mContent) && mRect.Contains(aPoint) ) {
|
||||
const nsStyleVisibility* vis =
|
||||
(const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility);
|
||||
|
||||
|
||||
@ -50,7 +50,6 @@
|
||||
typedef nsGfxTextControlFrame2 nsNewFrame;
|
||||
|
||||
class nsIPresState;
|
||||
class nsFormFrame;
|
||||
class nsISupportsArray;
|
||||
|
||||
class nsFileControlFrame : public nsAreaFrame,
|
||||
@ -73,8 +72,6 @@ public:
|
||||
}
|
||||
|
||||
virtual void MouseClicked(nsIPresContext* aPresContext) {}
|
||||
virtual void SetFormFrame(nsFormFrame* aFormFrame) { mFormFrame = aFormFrame; }
|
||||
virtual nsFormFrame* GetFromFrame() { return mFormFrame; }
|
||||
|
||||
NS_IMETHOD Paint(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
@ -184,7 +181,6 @@ protected:
|
||||
virtual PRIntn GetSkipSides() const;
|
||||
|
||||
nsNewFrame* mTextFrame;
|
||||
nsFormFrame* mFormFrame;
|
||||
nsIHTMLContent* mTextContent;
|
||||
nsCOMPtr<nsIHTMLContent> mBrowse;
|
||||
nsString* mCachedState;
|
||||
|
||||
@ -62,7 +62,6 @@
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsUnitConversion.h"
|
||||
#include "nsStyleUtil.h"
|
||||
#include "nsFormFrame.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsStyleUtil.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
@ -112,7 +111,6 @@ nsFormControlFrame::nsFormControlFrame()
|
||||
: nsLeafFrame()
|
||||
{
|
||||
mDidInit = PR_FALSE;
|
||||
mFormFrame = nsnull;
|
||||
mSuggestedWidth = NS_FORMSIZE_NOTSET;
|
||||
mSuggestedHeight = NS_FORMSIZE_NOTSET;
|
||||
mPresContext = nsnull;
|
||||
@ -126,10 +124,6 @@ nsFormControlFrame::nsFormControlFrame()
|
||||
|
||||
nsFormControlFrame::~nsFormControlFrame()
|
||||
{
|
||||
if (mFormFrame) {
|
||||
mFormFrame->RemoveFormControlFrame(*this);
|
||||
mFormFrame = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -550,11 +544,6 @@ nsFormControlFrame::Reflow(nsIPresContext* aPresContext,
|
||||
mDidInit = PR_TRUE;
|
||||
}
|
||||
|
||||
// add ourself as an nsIFormControlFrame
|
||||
if (!mFormFrame && (eReflowReason_Initial == aReflowState.reason)) {
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *NS_STATIC_CAST(nsIFrame*, this));
|
||||
}
|
||||
|
||||
#if 0
|
||||
nsresult skiprv = SkipResizeReflow(mCacheSize, mCachedMaxElementSize, aPresContext,
|
||||
aDesiredSize, aReflowState, aStatus);
|
||||
|
||||
@ -40,7 +40,6 @@
|
||||
|
||||
#include "nsIFormControlFrame.h"
|
||||
#include "nsFormControlHelper.h"
|
||||
#include "nsIFormManager.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsLeafFrame.h"
|
||||
@ -52,7 +51,6 @@
|
||||
class nsIView;
|
||||
class nsIPresContext;
|
||||
class nsStyleCoord;
|
||||
class nsFormFrame;
|
||||
|
||||
#define CSS_NOTSET -1
|
||||
#define ATTR_NOTSET -1
|
||||
@ -199,8 +197,6 @@ public:
|
||||
NS_IMETHOD GetMaxLength(PRInt32* aSize);
|
||||
|
||||
virtual void SetClickPoint(nscoord aX, nscoord aY);
|
||||
nsFormFrame* GetFormFrame() { return mFormFrame; }
|
||||
virtual void SetFormFrame(nsFormFrame* aFormFrame) { mFormFrame = aFormFrame; }
|
||||
|
||||
NS_IMETHOD GetFont(nsIPresContext* aPresContext,
|
||||
const nsFont*& aFont);
|
||||
@ -326,7 +322,6 @@ protected:
|
||||
nsSize mWidgetSize;
|
||||
PRBool mDidInit;
|
||||
nsPoint mLastClickPoint;
|
||||
nsFormFrame* mFormFrame;
|
||||
nscoord mSuggestedWidth;
|
||||
nscoord mSuggestedHeight;
|
||||
|
||||
|
||||
@ -62,7 +62,6 @@
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsUnitConversion.h"
|
||||
#include "nsStyleUtil.h"
|
||||
#include "nsFormFrame.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsStyleUtil.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
@ -714,44 +713,6 @@ nsFormControlHelper::GetName(nsIContent* aContent, nsAString* aResult)
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsFormControlHelper::GetValue(nsIContent* aContent, nsAString* aResult)
|
||||
{
|
||||
nsresult result = NS_FORM_NOTOK;
|
||||
|
||||
nsCOMPtr<nsIHTMLContent> formControl(do_QueryInterface(aContent));
|
||||
|
||||
if (formControl) {
|
||||
nsHTMLValue value;
|
||||
result = formControl->GetHTMLAttribute(nsHTMLAtoms::value, value);
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == result) {
|
||||
if (eHTMLUnit_String == value.GetUnit()) {
|
||||
value.GetStringValue(*aResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFormControlHelper::GetInputElementValue(nsIContent* aContent, nsString* aText, PRBool aInitialValue)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
nsIDOMHTMLInputElement* inputElem = nsnull;
|
||||
result = aContent->QueryInterface(NS_GET_IID(nsIDOMHTMLInputElement), (void**)&inputElem);
|
||||
if ((NS_OK == result) && inputElem) {
|
||||
if (PR_TRUE == aInitialValue) {
|
||||
result = inputElem->GetDefaultValue(*aText);
|
||||
}
|
||||
else {
|
||||
result = inputElem->GetValue(*aText);
|
||||
}
|
||||
|
||||
NS_RELEASE(inputElem);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Return localised string for resource string (e.g. "Submit" -> "Submit Query")
|
||||
// This code is derived from nsBookmarksService::Init() and cookie_Localize()
|
||||
@ -783,91 +744,6 @@ nsFormControlHelper::GetLocalizedString(const char * aPropFileName, const PRUnic
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Return value of disabled attribute or PR_FALSE if none set
|
||||
nsresult
|
||||
nsFormControlHelper::GetDisabled(nsIContent* aContent, PRBool* oIsDisabled)
|
||||
{
|
||||
nsCOMPtr<nsIHTMLContent> formControl = do_QueryInterface(aContent);
|
||||
nsHTMLValue value;
|
||||
nsresult result = formControl->GetHTMLAttribute(nsHTMLAtoms::disabled, value);
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == result) {
|
||||
if (eHTMLUnit_Empty == value.GetUnit()) {
|
||||
*oIsDisabled = PR_TRUE;
|
||||
} else {
|
||||
*oIsDisabled = PR_FALSE;
|
||||
}
|
||||
} else {
|
||||
*oIsDisabled = PR_FALSE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// manual submission helper method
|
||||
// aPresShell - If the PresShell is null then the PresContext will
|
||||
// get its own and use itstatic nsresult
|
||||
// aFormFrame - The HTML Form's frame
|
||||
// aFormControlFrame - The form controls frame that is calling this
|
||||
// it can be null
|
||||
// aDoSubmit - Submit = TRUE, Reset = FALSE
|
||||
// Indicates whether to do DOM Processing of the event or to do regular frame processing
|
||||
nsresult
|
||||
nsFormControlHelper::DoManualSubmitOrReset(nsIPresContext* aPresContext,
|
||||
nsIPresShell* aPresShell,
|
||||
nsIFrame* aFormFrame,
|
||||
nsIFrame* aFormControlFrame,
|
||||
PRBool aDoSubmit,
|
||||
PRBool aDoDOMEvent)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPresContext);
|
||||
NS_ENSURE_ARG_POINTER(aFormFrame);
|
||||
|
||||
nsresult result = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIContent> formContent;
|
||||
aFormFrame->GetContent(getter_AddRefs(formContent));
|
||||
|
||||
// Here we save a pointer to the form control content
|
||||
// so we can get its frame again after the Shell has processed the event.
|
||||
//
|
||||
// Control's Frame may get destroyed during the processing of the event (by the Shell)
|
||||
// meaning: aFormControlFrame becomes invalid, so instead of using aFormControlFrame
|
||||
// we use the saved content and the shell to go back and get the frame and
|
||||
// use it only if it isn't null
|
||||
nsCOMPtr<nsIContent> controlContent;
|
||||
if (aDoSubmit && aFormControlFrame != nsnull) {
|
||||
aFormControlFrame->GetContent(getter_AddRefs(controlContent));
|
||||
}
|
||||
|
||||
if (formContent) {
|
||||
//Either use the PresShell passed in or go get it from the PresContext
|
||||
nsCOMPtr<nsIPresShell> shell; // this will do our clean up
|
||||
if (aPresShell == nsnull) {
|
||||
result = aPresContext->GetShell(getter_AddRefs(shell));
|
||||
aPresShell = shell.get(); // not AddRefing because shell will clean up
|
||||
}
|
||||
|
||||
// With a valid PreShell handle the event
|
||||
if (NS_SUCCEEDED(result) && nsnull != aPresShell) {
|
||||
|
||||
// Get originator for event (failure is non-fatal)
|
||||
nsCOMPtr<nsIContent> formControl;
|
||||
aFormControlFrame->GetContent(getter_AddRefs(formControl));
|
||||
|
||||
nsFormEvent event;
|
||||
event.eventStructType = NS_FORM_EVENT;
|
||||
event.message = aDoSubmit?NS_FORM_SUBMIT:NS_FORM_RESET;
|
||||
event.originator = formControl;
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
if (aDoDOMEvent) {
|
||||
aPresShell->HandleDOMEventWithTarget(formContent, &event, &status);
|
||||
} else {
|
||||
aPresShell->HandleEventWithTarget(&event, nsnull, formContent, NS_EVENT_FLAG_INIT, &status);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFormControlHelper::Reset(nsIFrame* aFrame, nsIPresContext* aPresContext)
|
||||
{
|
||||
@ -883,3 +759,19 @@ nsFormControlHelper::Reset(nsIFrame* aFrame, nsIPresContext* aPresContext)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
void
|
||||
nsFormControlHelper::StyleChangeReflow(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
|
||||
nsHTMLReflowCommand* reflowCmd;
|
||||
nsresult rv = NS_NewHTMLReflowCommand(&reflowCmd, aFrame,
|
||||
eReflowType_StyleChanged);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
shell->AppendReflowCommand(reflowCmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -39,20 +39,18 @@
|
||||
#define nsFormControlHelper_h___
|
||||
|
||||
#include "nsIFormControlFrame.h"
|
||||
#include "nsIFormManager.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsLeafFrame.h"
|
||||
#include "nsCoord.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
||||
class nsIView;
|
||||
//class nsIPresContext;
|
||||
class nsIPresContext;
|
||||
class nsStyleCoord;
|
||||
class nsFormFrame;
|
||||
class nsIPresState;
|
||||
//class nsIStyleContext;
|
||||
class nsIStyleContext;
|
||||
|
||||
#define CSS_NOTSET -1
|
||||
#define ATTR_NOTSET -1
|
||||
@ -156,27 +154,43 @@ public:
|
||||
// Map platform line endings (CR, CRLF, LF) to DOM line endings (LF)
|
||||
static void PlatformToDOMLineBreaks(nsString &aString);
|
||||
|
||||
static nsresult GetValue(nsIContent* aContent, nsAString* aResult);
|
||||
/**
|
||||
* Get whether a form control is disabled
|
||||
* @param aContent the content of the form control in question
|
||||
* @return whether the form control is disabled
|
||||
*/
|
||||
static PRBool GetDisabled(nsIContent* aContent) {
|
||||
return aContent->HasAttr(kNameSpaceID_None, nsHTMLAtoms::disabled);
|
||||
};
|
||||
/**
|
||||
* Get the name of the form control
|
||||
* @param aContent the content to get the name of
|
||||
* @param aResult the returned name of the form control [OUT]
|
||||
* @return NS_CONTENT_ATTR_HAS_VALUE if things go well
|
||||
* @return NS_CONTENT_ATTR_NOT_THERE if the name attribute is undefined
|
||||
* @return NS_FORM_NOTOK if aContent is null or is not HTML content
|
||||
*/
|
||||
static nsresult GetName(nsIContent* aContent, nsAString* aResult);
|
||||
static nsresult GetInputElementValue(nsIContent* aContent, nsString* aText, PRBool aInitialValue);
|
||||
/**
|
||||
* Cause the form control to reset its value
|
||||
* @param aFrame the frame who owns the form control
|
||||
* @param aPresContext the pres context
|
||||
*/
|
||||
static nsresult Reset(nsIFrame* aFrame, nsIPresContext* aPresContext);
|
||||
|
||||
/**
|
||||
* Utility to convert a string to a PRBool
|
||||
* @param aValue string to convert to a PRBool
|
||||
* @returns PR_TRUE if aValue = "1", PR_FALSE otherwise
|
||||
*/
|
||||
|
||||
/**
|
||||
* Utility to convert a string to a PRBool
|
||||
* @param aValue string to convert to a PRBool
|
||||
* @returns PR_TRUE if aValue = "1", PR_FALSE otherwise
|
||||
*/
|
||||
static PRBool GetBool(const nsAString& aValue);
|
||||
|
||||
/**
|
||||
* Utility to convert a PRBool to a string
|
||||
* @param aValue Boolean value to convert to string.
|
||||
* @param aResult string to hold the boolean value. It is set to "1"
|
||||
* if aValue equals PR_TRUE, "0" if aValue equals PR_FALSE.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* Utility to convert a PRBool to a string
|
||||
* @param aValue Boolean value to convert to string.
|
||||
* @param aResult string to hold the boolean value. It is set to "1"
|
||||
* if aValue equals PR_TRUE, "0" if aValue equals PR_FALSE.
|
||||
*/
|
||||
static void GetBoolString(const PRBool aValue, nsAString& aResult);
|
||||
|
||||
static void GetRepChars(char& char1, char& char2) {
|
||||
@ -202,16 +216,6 @@ public:
|
||||
static nsresult GetLocalizedString(const char * aPropFileName, const PRUnichar* aKey, nsString& oVal);
|
||||
static const char * GetHTMLPropertiesFileName() { return FORM_PROPERTIES; }
|
||||
|
||||
static nsresult GetDisabled(nsIContent* aContent, PRBool* oIsDisabled);
|
||||
|
||||
// If the PresShell is null then the PresContext will get its own and use it
|
||||
static nsresult DoManualSubmitOrReset(nsIPresContext* aPresContext,
|
||||
nsIPresShell* aPresShell,
|
||||
nsIFrame* aFormFrame,
|
||||
nsIFrame* aFormControlFrame,
|
||||
PRBool aDoSubmit, // Submit = TRUE, Reset = FALSE
|
||||
PRBool aDoDOMEvent);
|
||||
|
||||
//
|
||||
//-------------------------------------------------------------------------------------
|
||||
// Utility methods for managing checkboxes and radiobuttons
|
||||
@ -355,6 +359,9 @@ public:
|
||||
nsIStyleContext* aStyleContext, nsString& aLabel,
|
||||
nsIFrame* aForFrame);
|
||||
|
||||
static void StyleChangeReflow(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame);
|
||||
|
||||
protected:
|
||||
nsFormControlHelper();
|
||||
virtual ~nsFormControlHelper();
|
||||
|
||||
@ -49,6 +49,7 @@
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsReflowPath.h"
|
||||
// MouseEvent suppression in PP
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
@ -538,13 +539,7 @@ nsGfxButtonControlFrame::Reflow(nsIPresContext* aPresContext,
|
||||
DO_GLOBAL_REFLOW_COUNT("nsGfxButtonControlFrame", aReflowState.reason);
|
||||
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
||||
|
||||
// The mFormFrame is set in the initial reflow within nsHTMLButtonControlFrame
|
||||
nsresult rv = NS_OK;
|
||||
if (eReflowReason_Initial == aReflowState.reason) {
|
||||
if (!mFormFrame) {
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *NS_STATIC_CAST(nsIFrame*, this));
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
nsresult skiprv = nsFormControlFrame::SkipResizeReflow(mCacheSize, mCachedMaxElementSize, aPresContext,
|
||||
|
||||
@ -39,7 +39,6 @@
|
||||
#include "nsICheckButton.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsHTMLParts.h"
|
||||
#include "nsFormFrame.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIComponentManager.h"
|
||||
@ -54,6 +53,7 @@
|
||||
#endif
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
|
||||
|
||||
//------------------------------------------------------------
|
||||
|
||||
@ -38,7 +38,6 @@
|
||||
#include "nsGfxRadioControlFrame.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsHTMLParts.h"
|
||||
#include "nsFormFrame.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
|
||||
@ -58,7 +58,6 @@
|
||||
#include "nsIEditorController.h"
|
||||
#include "nsIElementFactory.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsFormFrame.h"
|
||||
#include "nsIEditorIMESupport.h"
|
||||
#include "nsIEditorObserver.h"
|
||||
#include "nsIDOMHTMLTextAreaElement.h"
|
||||
@ -228,7 +227,6 @@ protected:
|
||||
protected:
|
||||
|
||||
nsGfxTextControlFrame2* mFrame; // weak reference
|
||||
nsString mFocusedValue;
|
||||
|
||||
PRPackedBool mSelectionWasCollapsed;
|
||||
PRPackedBool mKnowSelectionCollapsed;
|
||||
@ -317,33 +315,6 @@ nsTextInputListener::KeyPress(nsIDOMEvent* aKeyEvent)
|
||||
|
||||
mFrame->SetValueChanged(PR_TRUE);
|
||||
|
||||
if (mFrame && mFrame->IsSingleLineTextControl())
|
||||
{
|
||||
PRUint32 keyCode;
|
||||
keyEvent->GetKeyCode(&keyCode);
|
||||
|
||||
if (nsIDOMKeyEvent::DOM_VK_RETURN==keyCode ||
|
||||
nsIDOMKeyEvent::DOM_VK_ENTER==keyCode)
|
||||
{
|
||||
nsAutoString curValue;
|
||||
mFrame->GetText(&curValue);
|
||||
|
||||
// If the text control's contents have changed, fire
|
||||
// off an onChange().
|
||||
|
||||
if (!mFocusedValue.Equals(curValue))
|
||||
{
|
||||
mFocusedValue = curValue;
|
||||
mFrame->CallOnChange();
|
||||
}
|
||||
|
||||
// Now try to submit the form. Be sure to check mFrame again
|
||||
// since CallOnChange() may have caused the deletion of mFrame.
|
||||
|
||||
if (mFrame)
|
||||
mFrame->SubmitAttempt();
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -427,38 +398,26 @@ nsTextInputListener::Focus(nsIDOMEvent* aEvent)
|
||||
if (!mFrame) return NS_OK;
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
mFrame->GetEditor(getter_AddRefs(editor));
|
||||
if (editor)
|
||||
{
|
||||
if (editor) {
|
||||
editor->AddEditorObserver(this);
|
||||
}
|
||||
|
||||
nsresult rv = mFrame->GetText(&mFocusedValue);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return NS_OK;
|
||||
return mFrame->InitFocusedValue();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsTextInputListener::Blur (nsIDOMEvent* aEvent)
|
||||
nsTextInputListener::Blur(nsIDOMEvent* aEvent)
|
||||
{
|
||||
if (!mFrame)
|
||||
return NS_OK;
|
||||
|
||||
nsAutoString blurValue;
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
mFrame->GetEditor(getter_AddRefs(editor));
|
||||
if (editor)
|
||||
{
|
||||
if (editor) {
|
||||
editor->RemoveEditorObserver(this);
|
||||
|
||||
}
|
||||
mFrame->GetText(&blurValue);
|
||||
if (!mFocusedValue.Equals(blurValue))//different fire onchange
|
||||
{
|
||||
mFocusedValue = blurValue;
|
||||
mFrame->CallOnChange();
|
||||
}
|
||||
return NS_OK;
|
||||
|
||||
return mFrame->CheckFireOnChange();
|
||||
}
|
||||
//END focuslistener
|
||||
|
||||
@ -1357,7 +1316,6 @@ nsGfxTextControlFrame2::nsGfxTextControlFrame2(nsIPresShell* aShell):nsStackFram
|
||||
mUseEditor = PR_FALSE;
|
||||
mIsProcessing = PR_FALSE;
|
||||
mNotifyOnInput = PR_FALSE;
|
||||
mFormFrame = nsnull;
|
||||
mSuggestedWidth = NS_FORMSIZE_NOTSET;
|
||||
mSuggestedHeight = NS_FORMSIZE_NOTSET;
|
||||
mScrollableView = nsnull;
|
||||
@ -1475,12 +1433,6 @@ nsGfxTextControlFrame2::PreDestroy(nsIPresContext* aPresContext)
|
||||
//unregister self from content
|
||||
mTextListener->SetFrame(nsnull);
|
||||
nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_FALSE);
|
||||
if (mFormFrame)
|
||||
{
|
||||
mFormFrame->RemoveFormControlFrame(*this);
|
||||
mFormFrame = nsnull;
|
||||
mTextListener->SetFrame(nsnull);
|
||||
}
|
||||
if (mTextListener)
|
||||
{
|
||||
nsCOMPtr<nsIDOMEventReceiver> erP = do_QueryInterface(mContent);
|
||||
@ -1804,7 +1756,7 @@ nsGfxTextControlFrame2::CreateFrameFor(nsIPresContext* aPresContext,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGfxTextControlFrame2::SetInitialValue()
|
||||
nsGfxTextControlFrame2::InitEditor()
|
||||
{
|
||||
// This method must be called during/after the text
|
||||
// control frame's initial reflow to avoid any unintened
|
||||
@ -2241,12 +2193,11 @@ nsGfxTextControlFrame2::Reflow(nsIPresContext* aPresContext,
|
||||
DO_GLOBAL_REFLOW_COUNT("nsGfxTextControlFrame2", aReflowState.reason);
|
||||
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
||||
|
||||
SetInitialValue();
|
||||
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);
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *NS_STATIC_CAST(nsIFrame*, this));
|
||||
mNotifyOnInput = PR_TRUE;//its ok to notify now. all has been prepared.
|
||||
}
|
||||
|
||||
@ -2341,7 +2292,7 @@ nsGfxTextControlFrame2::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||
if (!aReflowState)
|
||||
return NS_OK;
|
||||
|
||||
SetInitialValue();
|
||||
InitEditor();
|
||||
|
||||
if (mState & NS_FRAME_FIRST_REFLOW)
|
||||
mNotifyOnInput = PR_TRUE;//its ok to notify now. all has been prepared.
|
||||
@ -2410,12 +2361,6 @@ nsGfxTextControlFrame2::GetAscent(nsBoxLayoutState& aState, nscoord& aAscent)
|
||||
return rv;
|
||||
}
|
||||
|
||||
PRIntn
|
||||
nsGfxTextControlFrame2::GetSkipSides() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//IMPLEMENTING NS_IFORMCONTROLFRAME
|
||||
NS_IMETHODIMP
|
||||
nsGfxTextControlFrame2::GetName(nsAString* aResult)
|
||||
@ -2522,13 +2467,6 @@ nsGfxTextControlFrame2::GetHorizontalInsidePadding(nsIPresContext* aPresContext,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsGfxTextControlFrame2::SetFormFrame(nsFormFrame* aFormFrame)
|
||||
{
|
||||
mFormFrame = aFormFrame;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGfxTextControlFrame2::SetSuggestedSize(nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
@ -2961,7 +2899,7 @@ nsGfxTextControlFrame2::AttributeChanged(nsIPresContext* aPresContext,
|
||||
// XXX If this should happen when value= attribute is set, shouldn't it
|
||||
// happen when .value is set too?
|
||||
if (aHint != NS_STYLE_HINT_REFLOW)
|
||||
nsFormFrame::StyleChangeReflow(aPresContext, this);
|
||||
nsFormControlHelper::StyleChangeReflow(aPresContext, this);
|
||||
}
|
||||
else if (nsHTMLAtoms::maxlength == aAttribute)
|
||||
{
|
||||
@ -3041,7 +2979,7 @@ nsGfxTextControlFrame2::AttributeChanged(nsIPresContext* aPresContext,
|
||||
// but it appears there are some problems when you hold down the return key
|
||||
mPrefSize.width = -1;
|
||||
mPrefSize.height = -1;
|
||||
nsFormFrame::StyleChangeReflow(aPresContext, this);
|
||||
nsFormControlHelper::StyleChangeReflow(aPresContext, this);
|
||||
}
|
||||
// Allow the base class to handle common attributes supported
|
||||
// by all form elements...
|
||||
@ -3090,7 +3028,7 @@ void nsGfxTextControlFrame2::RemoveNewlines(nsString &aString)
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsGfxTextControlFrame2::GetMaxLength(PRInt32* aSize)
|
||||
{
|
||||
*aSize = -1;
|
||||
@ -3108,7 +3046,7 @@ nsGfxTextControlFrame2::GetMaxLength(PRInt32* aSize)
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsGfxTextControlFrame2::DoesAttributeExist(nsIAtom *aAtt)
|
||||
{
|
||||
nsresult rv = NS_CONTENT_ATTR_NOT_THERE;
|
||||
@ -3122,57 +3060,6 @@ nsGfxTextControlFrame2::DoesAttributeExist(nsIAtom *aAtt)
|
||||
return rv;
|
||||
}
|
||||
|
||||
void
|
||||
nsGfxTextControlFrame2::SubmitAttempt()
|
||||
{
|
||||
// Submit the form
|
||||
PRInt32 type;
|
||||
GetType(&type);
|
||||
if (mFormFrame && mTextSelImpl && NS_FORM_TEXTAREA != type) {
|
||||
nsWeakPtr &shell = mTextSelImpl->GetPresShell();
|
||||
nsCOMPtr<nsIPresShell> presShell = do_QueryReferent(shell);
|
||||
if (!presShell) return;
|
||||
{
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
if (NS_SUCCEEDED(presShell->GetPresContext(getter_AddRefs(context))) && context)
|
||||
{
|
||||
/*
|
||||
* We got here because somebody pressed <return> in a text
|
||||
* input.
|
||||
*
|
||||
* Bug 99920 and bug 109463 -- Find the first submit button
|
||||
* and how many text inputs there are. If there is only one
|
||||
* text input, submit the form but do _not_ send the submit
|
||||
* button value (if any). If there are multiple text inputs,
|
||||
* we must have a submit button to submit and we want to
|
||||
* trigger a click event on the submit button. Triggering
|
||||
* this click eevent will fire the button's onclick handler
|
||||
* and submit the form.
|
||||
*/
|
||||
PRInt32 inputTxtCnt;
|
||||
nsIFrame* submitBtn = mFormFrame->GetFirstSubmitButtonAndTxtCnt(inputTxtCnt);
|
||||
if (submitBtn && inputTxtCnt > 1) {
|
||||
// IE actually fires the button's onclick handler. Dispatch
|
||||
// the click event and let the button handle submitting the
|
||||
// form.
|
||||
nsCOMPtr<nsIContent> buttonContent;
|
||||
submitBtn->GetContent(getter_AddRefs(buttonContent));
|
||||
nsGUIEvent event;
|
||||
event.eventStructType = NS_MOUSE_EVENT;
|
||||
event.message = NS_MOUSE_LEFT_CLICK;
|
||||
event.widget = nsnull;
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
presShell->HandleDOMEventWithTarget(buttonContent, &event, &status);
|
||||
} else if (inputTxtCnt == 1) {
|
||||
// do Submit & Frame processing of event
|
||||
nsFormControlHelper::DoManualSubmitOrReset(context, presShell, mFormFrame,
|
||||
this, PR_TRUE, PR_FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// this is where we propagate a content changed event
|
||||
NS_IMETHODIMP
|
||||
nsGfxTextControlFrame2::InternalContentChanged()
|
||||
@ -3204,9 +3091,27 @@ nsGfxTextControlFrame2::InternalContentChanged()
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGfxTextControlFrame2::InitFocusedValue()
|
||||
{
|
||||
return GetText(&mFocusedValue);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGfxTextControlFrame2::CallOnChange()
|
||||
nsGfxTextControlFrame2::CheckFireOnChange()
|
||||
{
|
||||
nsString value;
|
||||
GetText(&value);
|
||||
if (!mFocusedValue.Equals(value))//different fire onchange
|
||||
{
|
||||
mFocusedValue = value;
|
||||
FireOnChange();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGfxTextControlFrame2::FireOnChange()
|
||||
{
|
||||
// Dispatch th1e change event
|
||||
nsCOMPtr<nsIContent> content;
|
||||
@ -3226,8 +3131,7 @@ nsGfxTextControlFrame2::CallOnChange()
|
||||
// Have the content handle the event.
|
||||
nsWeakPtr &shell = mTextSelImpl->GetPresShell();
|
||||
nsCOMPtr<nsIPresShell> presShell = do_QueryReferent(shell);
|
||||
if (!presShell)
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
if (NS_SUCCEEDED(presShell->GetPresContext(getter_AddRefs(context))) && context)
|
||||
return presShell->HandleEventWithTarget(&event, nsnull, mContent, NS_EVENT_FLAG_INIT, &status);
|
||||
|
||||
@ -52,7 +52,6 @@
|
||||
#include "nsIScrollableViewProvider.h"
|
||||
|
||||
class nsIPresState;
|
||||
class nsFormFrame;
|
||||
class nsISupportsArray;
|
||||
class nsIHTMLContent;
|
||||
class nsIEditor;
|
||||
@ -132,7 +131,6 @@ public:
|
||||
virtual void SetFocus(PRBool aOn , PRBool aRepaint);
|
||||
virtual void ScrollIntoView(nsIPresContext* aPresContext);
|
||||
virtual void MouseClicked(nsIPresContext* aPresContext);
|
||||
virtual void SetFormFrame(nsFormFrame* aFrame);
|
||||
virtual nscoord GetVerticalInsidePadding(nsIPresContext* aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerHeight) const;
|
||||
@ -158,6 +156,7 @@ public:
|
||||
NS_IMETHOD OwnsValue(PRBool* aOwnsValue);
|
||||
NS_IMETHOD GetValue(nsAString& aValue, PRBool aIgnoreWrap);
|
||||
NS_IMETHOD GetTextLength(PRInt32* aTextLength);
|
||||
NS_IMETHOD CheckFireOnChange();
|
||||
NS_IMETHOD SetSelectionStart(PRInt32 aSelectionStart);
|
||||
NS_IMETHOD SetSelectionEnd(PRInt32 aSelectionEnd);
|
||||
NS_IMETHOD SetSelectionRange(PRInt32 aSelectionStart, PRInt32 aSelectionEnd);
|
||||
@ -182,23 +181,66 @@ public:
|
||||
|
||||
public: //for methods who access nsGfxTextControlFrame2 directly
|
||||
|
||||
void SubmitAttempt();
|
||||
NS_IMETHOD InternalContentChanged();//notify that we have some kind of change.
|
||||
NS_IMETHOD CallOnChange();
|
||||
/**
|
||||
* Find out whether this is a single line text control. (text or password)
|
||||
* @return whether this is a single line text control
|
||||
*/
|
||||
virtual PRBool IsSingleLineTextControl() const;
|
||||
/**
|
||||
* Find out whether this control edits plain text. (Currently always true.)
|
||||
* @return whether this is a plain text control
|
||||
*/
|
||||
virtual PRBool IsPlainTextControl() const;
|
||||
/**
|
||||
* Find out whether this is a password control (input type=password)
|
||||
* @return whether this is a password ontrol
|
||||
*/
|
||||
virtual PRBool IsPasswordTextControl() const;
|
||||
void SetValueChanged(PRBool aValueChanged);
|
||||
/** Called when the frame is focused, to remember the value for onChange. */
|
||||
nsresult InitFocusedValue();
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* Find out whether this control is scrollable (i.e. if it is not a single
|
||||
* line text control)
|
||||
* @return whether this control is scrollable
|
||||
*/
|
||||
PRBool IsScrollable() const;
|
||||
nsresult SetInitialValue();
|
||||
virtual PRIntn GetSkipSides() const;
|
||||
/**
|
||||
* Initialize mEditor with the proper flags and the default value.
|
||||
* @throws NS_ERROR_NOT_INITIALIZED if mEditor has not been created
|
||||
* @throws various and sundry other things
|
||||
*/
|
||||
nsresult InitEditor();
|
||||
/**
|
||||
* Strip all \n, \r and nulls from the given string
|
||||
* @param aString the string to remove newlines from [in/out]
|
||||
*/
|
||||
void RemoveNewlines(nsString &aString);
|
||||
NS_IMETHOD GetMaxLength(PRInt32* aSize);
|
||||
NS_IMETHOD DoesAttributeExist(nsIAtom *aAtt);
|
||||
void PreDestroy(nsIPresContext* aPresContext); // remove yourself as a form control
|
||||
/**
|
||||
* Get the maxlength attribute
|
||||
* @param aMaxLength the value of the max length attr
|
||||
* @throws NS_CONTENT_ATTR_NOT_THERE if attr not defined
|
||||
*/
|
||||
nsresult GetMaxLength(PRInt32* aMaxLength);
|
||||
/**
|
||||
* Find out whether an attribute exists on the content or not.
|
||||
* @param aAtt the attribute to determine the existence of
|
||||
* @throws NS_CONTENT_ATTR_NOT_THERE if it does not exist
|
||||
*/
|
||||
nsresult DoesAttributeExist(nsIAtom *aAtt);
|
||||
/**
|
||||
* We call this when we are being destroyed or removed from the PFM.
|
||||
* @param aPresContext the current pres context
|
||||
*/
|
||||
void PreDestroy(nsIPresContext* aPresContext);
|
||||
/**
|
||||
* Fire the onChange event.
|
||||
*/
|
||||
nsresult FireOnChange();
|
||||
|
||||
//helper methods
|
||||
nsresult GetSizeFromContent(PRInt32* aSize) const;
|
||||
@ -265,10 +307,10 @@ private:
|
||||
PRPackedBool mNotifyOnInput;//default this to off to stop any notifications until setup is complete
|
||||
PRPackedBool mDidPreDestroy; // has PreDestroy been called
|
||||
|
||||
nsFormFrame *mFormFrame;
|
||||
nsTextInputSelectionImpl *mTextSelImpl;
|
||||
nsTextInputListener *mTextListener;
|
||||
nsIScrollableView *mScrollableView;
|
||||
nsString mFocusedValue;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -43,7 +43,6 @@
|
||||
#include "nsIFormControlFrame.h"
|
||||
#include "nsHTMLParts.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsFormFrame.h"
|
||||
|
||||
#include "nsIRenderingContext.h"
|
||||
#include "nsIPresContext.h"
|
||||
@ -68,6 +67,8 @@
|
||||
#include "nsFormControlFrame.h"
|
||||
#include "nsIFrameManager.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsReflowPath.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsIAccessibilityService.h"
|
||||
#endif
|
||||
@ -114,10 +115,6 @@ NS_IMETHODIMP
|
||||
nsHTMLButtonControlFrame::Destroy(nsIPresContext *aPresContext)
|
||||
{
|
||||
nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_FALSE);
|
||||
if (mFormFrame) {
|
||||
mFormFrame->RemoveFormControlFrame(*this);
|
||||
mFormFrame = nsnull;
|
||||
}
|
||||
return nsHTMLContainerFrame::Destroy(aPresContext);
|
||||
}
|
||||
|
||||
@ -373,9 +370,6 @@ nsHTMLButtonControlFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aChildList)
|
||||
{
|
||||
// add ourself as an nsIFormControlFrame
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *NS_STATIC_CAST(nsIFrame*, this));
|
||||
|
||||
// get the frame manager and the style context of the new parent frame
|
||||
// this is used whent he children are reparented below
|
||||
// NOTE: the whole reparenting should not need to happen: see bugzilla bug 51767
|
||||
@ -500,9 +494,8 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext,
|
||||
DO_GLOBAL_REFLOW_COUNT("nsHTMLButtonControlFrame", aReflowState.reason);
|
||||
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
||||
|
||||
if (!mFormFrame && (eReflowReason_Initial == aReflowState.reason)) {
|
||||
if (eReflowReason_Initial == aReflowState.reason) {
|
||||
nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_TRUE);
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *NS_STATIC_CAST(nsIFrame*, this));
|
||||
}
|
||||
|
||||
#if 0
|
||||
@ -604,8 +597,10 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext,
|
||||
0, aStatus);
|
||||
|
||||
// calculate the min internal size so the contents gets centered correctly
|
||||
nscoord minInternalWidth = aReflowState.mComputedMinWidth == 0?0:aReflowState.mComputedMinWidth -
|
||||
(aReflowState.mComputedBorderPadding.left + aReflowState.mComputedBorderPadding.right);
|
||||
// minInternalWidth is not being used at all and causes a warning--commenting
|
||||
// out until someone wants it.
|
||||
// nscoord minInternalWidth = aReflowState.mComputedMinWidth == 0?0:aReflowState.mComputedMinWidth -
|
||||
// (aReflowState.mComputedBorderPadding.left + aReflowState.mComputedBorderPadding.right);
|
||||
nscoord minInternalHeight = aReflowState.mComputedMinHeight == 0?0:aReflowState.mComputedMinHeight -
|
||||
(aReflowState.mComputedBorderPadding.top + aReflowState.mComputedBorderPadding.bottom);
|
||||
|
||||
|
||||
@ -44,7 +44,6 @@
|
||||
#include "nsIFormControlFrame.h"
|
||||
#include "nsHTMLParts.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsFormFrame.h"
|
||||
|
||||
#include "nsIRenderingContext.h"
|
||||
#include "nsIPresContext.h"
|
||||
@ -132,7 +131,6 @@ public:
|
||||
NS_IMETHOD GetName(nsAString* aName);
|
||||
NS_IMETHOD GetValue(nsAString* aName);
|
||||
virtual void MouseClicked(nsIPresContext* aPresContext);
|
||||
virtual void SetFormFrame(nsFormFrame* aFormFrame) { mFormFrame = aFormFrame; }
|
||||
NS_IMETHOD OnContentReset();
|
||||
|
||||
void SetFocus(PRBool aOn, PRBool aRepaint);
|
||||
@ -168,7 +166,6 @@ protected:
|
||||
|
||||
PRIntn GetSkipSides() const;
|
||||
PRBool mInline;
|
||||
nsFormFrame* mFormFrame;
|
||||
nsCursor mPreviousCursor;
|
||||
nsRect mTranslatedRect;
|
||||
PRBool mDidInit;
|
||||
|
||||
@ -57,10 +57,10 @@
|
||||
#include "nsIImage.h"
|
||||
#include "nsStyleUtil.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsFormFrame.h"
|
||||
#include "nsFormControlFrame.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsIAccessibilityService.h"
|
||||
#endif
|
||||
@ -121,8 +121,6 @@ public:
|
||||
|
||||
virtual void MouseClicked(nsIPresContext* aPresContext);
|
||||
|
||||
virtual void SetFormFrame(nsFormFrame* aFormFrame) { mFormFrame = aFormFrame; }
|
||||
|
||||
NS_IMETHOD GetType(PRInt32* aType) const;
|
||||
|
||||
NS_IMETHOD GetName(nsAString* aName);
|
||||
@ -159,7 +157,6 @@ protected:
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
|
||||
nsFormFrame* mFormFrame;
|
||||
nsMouseState mLastMouseState;
|
||||
nsPoint mLastClickPoint;
|
||||
nsCursor mPreviousCursor;
|
||||
@ -176,7 +173,6 @@ nsImageControlFrame::nsImageControlFrame()
|
||||
mPreviousCursor = eCursor_standard;
|
||||
mTranslatedRect = nsRect(0,0,0,0);
|
||||
mGotFocus = PR_FALSE;
|
||||
mFormFrame = nsnull;
|
||||
}
|
||||
|
||||
nsImageControlFrame::~nsImageControlFrame()
|
||||
@ -188,10 +184,6 @@ nsImageControlFrame::Destroy(nsIPresContext *aPresContext)
|
||||
{
|
||||
nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_FALSE);
|
||||
|
||||
if (mFormFrame) {
|
||||
mFormFrame->RemoveFormControlFrame(*this);
|
||||
mFormFrame = nsnull;
|
||||
}
|
||||
return nsImageControlFrameSuper::Destroy(aPresContext);
|
||||
}
|
||||
|
||||
@ -313,10 +305,8 @@ nsImageControlFrame::Reflow(nsIPresContext* aPresContext,
|
||||
{
|
||||
DO_GLOBAL_REFLOW_COUNT("nsImageControlFrame", aReflowState.reason);
|
||||
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
||||
if (!mFormFrame && (eReflowReason_Initial == aReflowState.reason)) {
|
||||
if (aReflowState.reason == eReflowReason_Initial) {
|
||||
nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_TRUE);
|
||||
// add ourself as an nsIFormControlFrame
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *NS_STATIC_CAST(nsIFrame*, this));
|
||||
}
|
||||
return nsImageControlFrameSuper::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
|
||||
}
|
||||
@ -339,7 +329,7 @@ nsImageControlFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE || uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED)
|
||||
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
|
||||
if (nsFormFrame::GetDisabled(this)) { // XXX cache disabled
|
||||
if (nsFormControlHelper::GetDisabled(mContent)) { // XXX cache disabled
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -414,7 +404,7 @@ nsImageControlFrame::GetName(nsAString* aResult)
|
||||
if (nsnull == aResult) {
|
||||
return NS_OK;
|
||||
} else {
|
||||
return nsFormFrame::GetName(this, *aResult);
|
||||
return nsFormControlHelper::GetName(mContent, aResult);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +54,6 @@
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
#include "nsIComboboxControlFrame.h"
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsFormFrame.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsIDOMHTMLOptGroupElement.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
@ -77,6 +76,7 @@
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsIAccessibilityService.h"
|
||||
#endif
|
||||
@ -84,6 +84,7 @@
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsILookAndFeel.h"
|
||||
#include "nsReflowPath.h"
|
||||
|
||||
// Timer Includes
|
||||
#include "nsITimer.h"
|
||||
@ -393,7 +394,6 @@ nsListControlFrame::nsListControlFrame()
|
||||
: mWeakReferent(this)
|
||||
{
|
||||
mComboboxFrame = nsnull;
|
||||
mFormFrame = nsnull;
|
||||
mButtonDown = PR_FALSE;
|
||||
mMaxWidth = 0;
|
||||
mMaxHeight = 0;
|
||||
@ -433,10 +433,6 @@ nsListControlFrame::~nsListControlFrame()
|
||||
}
|
||||
|
||||
mComboboxFrame = nsnull;
|
||||
if (mFormFrame) {
|
||||
mFormFrame->RemoveFormControlFrame(*this);
|
||||
mFormFrame = nsnull;
|
||||
}
|
||||
NS_IF_RELEASE(mPresContext);
|
||||
}
|
||||
|
||||
@ -920,9 +916,8 @@ nsListControlFrame::Reflow(nsIPresContext* aPresContext,
|
||||
|
||||
// Add the list frame as a child of the form
|
||||
if (eReflowReason_Initial == aReflowState.reason) {
|
||||
if (IsInDropDownMode() == PR_FALSE && !mFormFrame) {
|
||||
if (!IsInDropDownMode()) {
|
||||
nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_TRUE);
|
||||
nsFormFrame::AddFormControlFrame(aPresContext, *NS_STATIC_CAST(nsIFrame*, this));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1604,7 +1599,7 @@ nsListControlFrame::HandleEvent(nsIPresContext* aPresContext,
|
||||
if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE || uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED)
|
||||
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
|
||||
if (nsFormFrame::GetDisabled(this))
|
||||
if (nsFormControlHelper::GetDisabled(mContent))
|
||||
return NS_OK;
|
||||
|
||||
switch (aEvent->message) {
|
||||
@ -1929,13 +1924,6 @@ nsListControlFrame::GetType(PRInt32* aType) const
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
void
|
||||
nsListControlFrame::SetFormFrame(nsFormFrame* aFormFrame)
|
||||
{
|
||||
mFormFrame = aFormFrame;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------
|
||||
void
|
||||
@ -2742,7 +2730,7 @@ nsListControlFrame::MouseUp(nsIDOMEvent* aMouseEvent)
|
||||
|
||||
mButtonDown = PR_FALSE;
|
||||
|
||||
if (nsFormFrame::GetDisabled(this)) {
|
||||
if (nsFormControlHelper::GetDisabled(mContent)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -2927,7 +2915,7 @@ nsListControlFrame::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
|
||||
mButtonDown = PR_TRUE;
|
||||
|
||||
if (nsFormFrame::GetDisabled(this)) {
|
||||
if (nsFormControlHelper::GetDisabled(mContent)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -3250,7 +3238,7 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
|
||||
{
|
||||
NS_ASSERTION(aKeyEvent != nsnull, "keyEvent is null.");
|
||||
|
||||
if (nsFormFrame::GetDisabled(this))
|
||||
if (nsFormControlHelper::GetDisabled(mContent))
|
||||
return NS_OK;
|
||||
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
@ -242,7 +242,6 @@ public:
|
||||
virtual void SetFocus(PRBool aOn = PR_TRUE, PRBool aRepaint = PR_FALSE);
|
||||
virtual void ScrollIntoView(nsIPresContext* aPresContext);
|
||||
virtual void MouseClicked(nsIPresContext* aPresContext);
|
||||
virtual void SetFormFrame(nsFormFrame* aFrame);
|
||||
virtual nscoord GetVerticalInsidePadding(nsIPresContext* aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerHeight) const;
|
||||
@ -381,8 +380,6 @@ protected:
|
||||
void ItemsHaveBeenRemoved(nsIPresContext * aPresContext);
|
||||
|
||||
// Data Members
|
||||
nsFormFrame* mFormFrame;
|
||||
|
||||
PRInt32 mStartSelectionIndex;
|
||||
PRInt32 mEndSelectionIndex;
|
||||
PRPackedBool mChangesSinceDragStart;
|
||||
|
||||
@ -1158,13 +1158,6 @@
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS>Debug</FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsFormFrame.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS>Debug</FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsFormControlFrame.cpp</PATH>
|
||||
@ -2304,11 +2297,6 @@
|
||||
<PATH>nsHTMLReflowState.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsFormFrame.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsFormControlFrame.cpp</PATH>
|
||||
@ -4081,13 +4069,6 @@
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS>Debug</FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsFormFrame.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS>Debug</FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsFormControlFrame.cpp</PATH>
|
||||
@ -5247,11 +5228,6 @@
|
||||
<PATH>nsHTMLReflowState.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsFormFrame.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsFormControlFrame.cpp</PATH>
|
||||
@ -6368,12 +6344,6 @@
|
||||
<PATH>nsFileControlFrame.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>layout.shlb</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsFormFrame.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>layout.shlb</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user