Bug 1382189 - Persist preview value in PressState for select element to ensure the text is consistent after frame re-construction. r=heycam

MozReview-Commit-ID: piZkkGlWrs

--HG--
extra : rebase_source : 9a58a2591770c4ec9e8183bdd6fe2add2ee028f9
This commit is contained in:
Ray Lin 2017-07-20 15:40:46 +08:00
parent d229288071
commit c564ceceb5
2 changed files with 13 additions and 0 deletions

View File

@ -111,6 +111,16 @@ public:
return mDroppedDown;
}
void SetPreviewText(const nsAString& aValue)
{
mPreviewText = aValue;
}
void GetPreviewText(nsAString& aValue)
{
aValue = mPreviewText;
}
// MEMBER VARIABLES
protected:
nsCOMPtr<nsISupports> mContentData;
@ -121,6 +131,7 @@ protected:
bool mDisabledSet;
bool mDisabled;
bool mDroppedDown;
nsString mPreviewText;
};
#endif /* nsPresState_h_ */

View File

@ -1681,6 +1681,7 @@ nsComboboxControlFrame::SaveState(nsPresState** aState)
MOZ_ASSERT(!(*aState));
(*aState) = new nsPresState();
(*aState)->SetDroppedDown(mDroppedDown);
(*aState)->SetPreviewText(mPreviewText);
return NS_OK;
}
@ -1690,6 +1691,7 @@ nsComboboxControlFrame::RestoreState(nsPresState* aState)
if (!aState) {
return NS_ERROR_FAILURE;
}
aState->GetPreviewText(mPreviewText);
ShowList(aState->GetDroppedDown()); // might destroy us
return NS_OK;
}