From 8dc2f7da633d6ac3f336dc3988ce3a6becefded4 Mon Sep 17 00:00:00 2001 From: "buster%netscape.com" Date: Tue, 7 Sep 1999 23:20:32 +0000 Subject: [PATCH] made a small change to the way the file control interacts with the embedded gfx text control now, it talks to it via nsIDOMHTMLInputElement interface, rather than assuming imlementation details about what attributes to set. git-svn-id: svn://10.0.0.236/trunk@46239 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/forms/nsFileControlFrame.cpp | 15 ++++++++++++--- .../layout/html/forms/src/nsFileControlFrame.cpp | 15 ++++++++++++--- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/mozilla/layout/forms/nsFileControlFrame.cpp b/mozilla/layout/forms/nsFileControlFrame.cpp index 28355ff7208..b9db0c8aa0e 100644 --- a/mozilla/layout/forms/nsFileControlFrame.cpp +++ b/mozilla/layout/forms/nsFileControlFrame.cpp @@ -44,6 +44,7 @@ #include "nsDocument.h" #include "nsIDOMMouseListener.h" #include "nsIPresShell.h" +#include "nsIDOMHTMLInputElement.h" static NS_DEFINE_IID(kCFileWidgetCID, NS_FILEWIDGET_CID); @@ -91,7 +92,10 @@ nsFileControlFrame::CreateAnonymousContent(nsISupportsArray& aChildList) if (NS_OK == NS_NewHTMLInputElement(&mTextContent, tag)) { mTextContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, nsAutoString("text"), PR_FALSE); if (nsFormFrame::GetDisabled(this)) { - mTextContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::readonly, nsAutoString("true"), PR_FALSE); + nsCOMPtr textControl = do_QueryInterface(mTextContent); + if (textControl) { + textControl->SetDisabled(nsFormFrame::GetDisabled(this)); + } } aChildList.AppendElement(mTextContent); } @@ -380,8 +384,13 @@ nsFileControlFrame::AttributeChanged(nsIPresContext* aPresContext, { // set the text control to readonly or not if (nsHTMLAtoms::disabled == aAttribute) { - nsAutoString val(nsFormFrame::GetDisabled(this) ? "true":"false"); - mTextContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::readonly, val, PR_FALSE); + //nsAutoString val(nsFormFrame::GetDisabled(this) ? "true":"false"); + nsCOMPtr textControl = do_QueryInterface(mTextContent); + if (textControl) + { + textControl->SetDisabled(nsFormFrame::GetDisabled(this)); + } + //mTextContent->SetHTMLAttribute(nsHTMLAtoms::disabled, val, PR_TRUE); } return nsAreaFrame::AttributeChanged(aPresContext, aChild, aAttribute, aHint); diff --git a/mozilla/layout/html/forms/src/nsFileControlFrame.cpp b/mozilla/layout/html/forms/src/nsFileControlFrame.cpp index 28355ff7208..b9db0c8aa0e 100644 --- a/mozilla/layout/html/forms/src/nsFileControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFileControlFrame.cpp @@ -44,6 +44,7 @@ #include "nsDocument.h" #include "nsIDOMMouseListener.h" #include "nsIPresShell.h" +#include "nsIDOMHTMLInputElement.h" static NS_DEFINE_IID(kCFileWidgetCID, NS_FILEWIDGET_CID); @@ -91,7 +92,10 @@ nsFileControlFrame::CreateAnonymousContent(nsISupportsArray& aChildList) if (NS_OK == NS_NewHTMLInputElement(&mTextContent, tag)) { mTextContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, nsAutoString("text"), PR_FALSE); if (nsFormFrame::GetDisabled(this)) { - mTextContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::readonly, nsAutoString("true"), PR_FALSE); + nsCOMPtr textControl = do_QueryInterface(mTextContent); + if (textControl) { + textControl->SetDisabled(nsFormFrame::GetDisabled(this)); + } } aChildList.AppendElement(mTextContent); } @@ -380,8 +384,13 @@ nsFileControlFrame::AttributeChanged(nsIPresContext* aPresContext, { // set the text control to readonly or not if (nsHTMLAtoms::disabled == aAttribute) { - nsAutoString val(nsFormFrame::GetDisabled(this) ? "true":"false"); - mTextContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::readonly, val, PR_FALSE); + //nsAutoString val(nsFormFrame::GetDisabled(this) ? "true":"false"); + nsCOMPtr textControl = do_QueryInterface(mTextContent); + if (textControl) + { + textControl->SetDisabled(nsFormFrame::GetDisabled(this)); + } + //mTextContent->SetHTMLAttribute(nsHTMLAtoms::disabled, val, PR_TRUE); } return nsAreaFrame::AttributeChanged(aPresContext, aChild, aAttribute, aHint);