mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1053048 nsTextEditorState::UnbindFromFrame() should ensure to call nsTextInputListener::EditAction() for updating the content r=ehsan
This commit is contained in:
parent
927eafb070
commit
2c13b279ed
@ -664,6 +664,8 @@ public:
|
||||
void SettingValue(bool aValue) { mSettingValue = aValue; }
|
||||
void SetValueChanged(bool aSetValueChanged) { mSetValueChanged = aSetValueChanged; }
|
||||
|
||||
bool IsInEditAction() const { return mInEditAction; }
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_DECL_NSISELECTIONLISTENER
|
||||
@ -708,6 +710,10 @@ protected:
|
||||
* |SetValueChanged| to be called.
|
||||
*/
|
||||
bool mSetValueChanged;
|
||||
/**
|
||||
* mInEditAction is true while editor handling an edit action.
|
||||
*/
|
||||
bool mInEditAction;
|
||||
};
|
||||
|
||||
|
||||
@ -723,6 +729,7 @@ nsTextInputListener::nsTextInputListener(nsITextControlElement* aTxtCtrlElement)
|
||||
, mHadRedoItems(false)
|
||||
, mSettingValue(false)
|
||||
, mSetValueChanged(true)
|
||||
, mInEditAction(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -889,6 +896,8 @@ nsTextInputListener::HandleEvent(nsIDOMEvent* aEvent)
|
||||
NS_IMETHODIMP
|
||||
nsTextInputListener::EditAction()
|
||||
{
|
||||
mInEditAction = false;
|
||||
|
||||
nsWeakFrame weakFrame = mFrame;
|
||||
|
||||
nsITextControlFrame* frameBase = do_QueryFrame(mFrame);
|
||||
@ -934,12 +943,14 @@ nsTextInputListener::EditAction()
|
||||
NS_IMETHODIMP
|
||||
nsTextInputListener::BeforeEditAction()
|
||||
{
|
||||
mInEditAction = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextInputListener::CancelEditAction()
|
||||
{
|
||||
mInEditAction = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1518,6 +1529,13 @@ nsTextEditorState::UnbindFromFrame(nsTextControlFrame* aFrame)
|
||||
NS_ASSERTION(!aFrame || aFrame == mBoundFrame, "Unbinding from the wrong frame");
|
||||
NS_ENSURE_TRUE_VOID(!aFrame || aFrame == mBoundFrame);
|
||||
|
||||
// If the editor is modified, we need to notify it here because editor may be
|
||||
// destroyed before EditAction() is called if selection listener causes
|
||||
// flushing layout.
|
||||
if (mTextListener && mTextListener->IsInEditAction()) {
|
||||
mTextListener->EditAction();
|
||||
}
|
||||
|
||||
// We need to start storing the value outside of the editor if we're not
|
||||
// going to use it anymore, so retrieve it for now.
|
||||
nsAutoString value;
|
||||
|
Loading…
Reference in New Issue
Block a user