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
Родитель d229288071
Коммит c564ceceb5
2 изменённых файлов: 13 добавлений и 0 удалений

Просмотреть файл

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

Просмотреть файл

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