Backing out 108308 due to pageload spike

git-svn-id: svn://10.0.0.236/trunk@117722 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jkeiser%netscape.com
2002-03-29 07:35:09 +00:00
parent 2bab077155
commit 317b99e5a5
56 changed files with 752 additions and 557 deletions

View File

@@ -466,6 +466,8 @@ nsGfxButtonControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
if (aIID.Equals(NS_GET_IID(nsIAnonymousContentCreator))) {
*aInstancePtr = NS_STATIC_CAST(nsIAnonymousContentCreator*, this);
} else if (aIID.Equals(NS_GET_IID(nsIStatefulFrame))) {
*aInstancePtr = NS_STATIC_CAST(nsIStatefulFrame*, this);
}
else {
return nsHTMLButtonControlFrame::QueryInterface(aIID, aInstancePtr);
@@ -649,3 +651,48 @@ nsGfxButtonControlFrame::HandleEvent(nsIPresContext* aPresContext,
return NS_OK;
}
//----------------------------------------------------------------------
// nsIStatefulFrame
//----------------------------------------------------------------------
NS_IMETHODIMP
nsGfxButtonControlFrame::SaveState(nsIPresContext* aPresContext, nsIPresState** aState)
{
NS_ENSURE_ARG_POINTER(aState);
// 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)
NS_ENSURE_TRUE(mContent->IsContentOfType(nsIContent::eHTML_FORM_CONTROL),
NS_ERROR_UNEXPECTED);
nsAutoString defaultStateString;
if (!mDefaultValueWasChanged) {
mContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::value, defaultStateString);
}
if (mDefaultValueWasChanged || !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
nsGfxButtonControlFrame::RestoreState(nsIPresContext* aPresContext, nsIPresState* aState)
{
NS_ENSURE_ARG_POINTER(aState);
// Set the value to the stored state.
nsAutoString stateString;
nsresult res = aState->GetStateProperty(NS_LITERAL_STRING("value"), stateString);
NS_ENSURE_SUCCESS(res, res);
return SetProperty(aPresContext, nsHTMLAtoms::value, stateString);
}