Backing out 108308 due to pageload spike

This commit is contained in:
jkeiser@netscape.com
2002-03-29 07:35:09 +00:00
parent 9e96f44900
commit 87b93658ee
56 changed files with 752 additions and 557 deletions
+56 -10
View File
@@ -63,6 +63,7 @@
#include "nsIDOMMouseListener.h"
#include "nsIPresShell.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIStatefulFrame.h"
#include "nsISupportsPrimitives.h"
#include "nsIComponentManager.h"
#include "nsIDOMWindowInternal.h"
@@ -148,16 +149,10 @@ nsFileControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
if (NS_SUCCEEDED(rv)) {
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));
// Initialize value when we create the content in case the value was set
// before we got here
nsCOMPtr<nsIDOMHTMLInputElement> fileContent = do_QueryInterface(mContent);
if (fileContent) {
nsAutoString value;
fileContent->GetValue(value);
textControl->SetValue(value);
if (nsFormFrame::GetDisabled(this)) {
nsCOMPtr<nsIDOMHTMLInputElement> textControl = do_QueryInterface(mTextContent);
if (textControl) {
textControl->SetDisabled(nsFormFrame::GetDisabled(this));
}
}
aChildList.AppendElement(mTextContent);
@@ -204,6 +199,9 @@ nsFileControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
} else if (aIID.Equals(NS_GET_IID(nsIDOMMouseListener))) {
*aInstancePtr = (void*)(nsIDOMMouseListener*) this;
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsIStatefulFrame))) {
*aInstancePtr = (void*)(nsIStatefulFrame*) this;
return NS_OK;
}
return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr);
}
@@ -680,6 +678,54 @@ nsFileControlFrame::Paint(nsIPresContext* aPresContext,
return nsFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
}
//----------------------------------------------------------------------
// nsIStatefulFrame
//----------------------------------------------------------------------
NS_IMETHODIMP
nsFileControlFrame::SaveState(nsIPresContext* aPresContext, nsIPresState** aState)
{
NS_ENSURE_ARG_POINTER(aState);
// Don't save state before we are initialized
if (!mTextFrame && !mCachedState) {
return NS_OK;
}
// Get the value string
nsAutoString stateString;
nsresult res = GetProperty(nsHTMLAtoms::value, stateString);
NS_ENSURE_SUCCESS(res, res);
// Compare to default value, and only save if needed (Bug 62713)
nsAutoString defaultStateString;
nsCOMPtr<nsIDOMHTMLInputElement> formControl(do_QueryInterface(mContent));
if (formControl) {
formControl->GetDefaultValue(defaultStateString);
}
if (! stateString.Equals(defaultStateString)) {
// Construct a pres state and store value in it.
res = NS_NewPresState(aState);
NS_ENSURE_SUCCESS(res, res);
res = (*aState)->SetStateProperty(NS_LITERAL_STRING("value"), stateString);
}
return res;
}
NS_IMETHODIMP
nsFileControlFrame::RestoreState(nsIPresContext* aPresContext, nsIPresState* aState)
{
NS_ENSURE_ARG_POINTER(aState);
nsAutoString string;
aState->GetStateProperty(NS_LITERAL_STRING("value"), string);
SetProperty(aPresContext, nsHTMLAtoms::value, string);
return NS_OK;
}
NS_IMETHODIMP
nsFileControlFrame::OnContentReset()
{