`TextInputListener::OnEditActionHandled` should notify ` the text control element even if no frame
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox148 | --- | fixed |
People
(Reporter: masayuki, Assigned: masayuki)
References
Details
Attachments
(1 file)
Currently,
nsresult TextInputListener::OnEditActionHandled(TextEditor& aTextEditor) {
if (mFrame) {
// XXX Do we still need this or can we just remove the mFrame and
// frame.IsAlive() conditions below?
AutoWeakFrame weakFrame = mFrame;
// Update the undo / redo menus
//
size_t numUndoItems = aTextEditor.NumberOfUndoItems();
size_t numRedoItems = aTextEditor.NumberOfRedoItems();
if ((numUndoItems && !mHadUndoItems) || (!numUndoItems && mHadUndoItems) ||
(numRedoItems && !mHadRedoItems) || (!numRedoItems && mHadRedoItems)) {
// Modify the menu if undo or redo items are different
UpdateTextInputCommands(u"undo"_ns);
mHadUndoItems = numUndoItems != 0;
mHadRedoItems = numRedoItems != 0;
}
if (weakFrame.IsAlive()) {
HandleValueChanged(aTextEditor);
}
}
return mTextControlState ? mTextControlState->OnEditActionHandled() : NS_OK;
}
TextInputListener::HandleValueChanged calls TextControlElement::OnValueChanged which updates the element state. Therefore, it does not directly require the frame. Additionally, if the frame is destroyed during TextEditor does something, the text control element may not receive the value change within this path. So, it might cause mismatch between the element state and the latest value.
| Assignee | ||
Comment 1•3 months ago
|
||
It's called by TextEditor after (maybe) modifying the value before
dispatching input event.
First, it updates the enabled state of the undo/redo commands. However,
it's managed by the window. Therefore, it does not make sense to depend
on the frame.
Then, it updates the various state of the related objects. For making
them work with destroyed TextEditor, this patch makes TextEditor
keep storing the latest value with caching the Text while it's
handling something.
Comment 4•3 months ago
|
||
| bugherder | ||
Updated•2 months ago
|
Description
•