mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 22:05:44 +00:00
Bug 639733 - Include the tag name in the frame state key. r=bzbarsky
This commit is contained in:
parent
cba5eb782d
commit
ce7e2319e4
@ -2138,10 +2138,16 @@ nsContentUtils::GenerateStateKey(nsIContent* aContent,
|
||||
|
||||
if (!generatedUniqueKey) {
|
||||
// Either we didn't have a form control or we aren't in an HTML document so
|
||||
// we can't figure out form info. First append a character that is not "d"
|
||||
// or "f" to disambiguate from the case when we were a form control in an
|
||||
// HTML document.
|
||||
// we can't figure out form info. Append the tag name if it's an element
|
||||
// to avoid restoring state for one type of element on another type.
|
||||
if (aContent->IsElement()) {
|
||||
KeyAppendString(nsDependentAtomString(aContent->Tag()), aKey);
|
||||
}
|
||||
else {
|
||||
// Append a character that is not "d" or "f" to disambiguate from
|
||||
// the case when we were a form control in an HTML document.
|
||||
KeyAppendString(NS_LITERAL_CSTRING("o"), aKey);
|
||||
}
|
||||
|
||||
// Now start at aContent and append the indices of it and all its ancestors
|
||||
// in their containers. That should at least pin down its position in the
|
||||
|
@ -527,11 +527,12 @@ nsIsIndexFrame::SaveState(SpecialStateID aStateID, nsPresState** aState)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aState);
|
||||
|
||||
*aState = nsnull;
|
||||
|
||||
// Get the value string
|
||||
nsAutoString stateString;
|
||||
GetInputValue(stateString);
|
||||
|
||||
nsresult res = NS_OK;
|
||||
if (! stateString.IsEmpty()) {
|
||||
|
||||
// Construct a pres state and store value in it.
|
||||
@ -549,7 +550,7 @@ nsIsIndexFrame::SaveState(SpecialStateID aStateID, nsPresState** aState)
|
||||
(*aState)->SetStateProperty(state);
|
||||
}
|
||||
|
||||
return res;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -561,6 +562,11 @@ nsIsIndexFrame::RestoreState(nsPresState* aState)
|
||||
nsCOMPtr<nsISupportsString> stateString
|
||||
(do_QueryInterface(aState->GetStateProperty()));
|
||||
|
||||
if (!stateString) {
|
||||
NS_ERROR("Not a <isindex> state!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsAutoString data;
|
||||
stateString->GetData(data);
|
||||
SetInputValue(data);
|
||||
|
Loading…
Reference in New Issue
Block a user