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);