зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1053048 nsTextEditorState::UnbindFromFrame() should ensure to call nsTextInputListener::EditAction() for updating the content r=ehsan
This commit is contained in:
Родитель
c2443fe41c
Коммит
de1f9dee1c
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче