Bug 1836806 - Make TextControlState::SetValueWithoutTextEditor() notify IMEContentObserver of value changes even if it has a bounding frame r=smaug
This is an edge case which couldn't be fixed in bug 1835353. In the testcase, `TextControlState` has new frame for the new `<input type="number">` when its `stepUp()` is called. However, its `TextEditor` has not been recreated yet because it's not safe yet. Therefore, `SetValueWithoutTextEditor()` is called, but I added the new path notifying `IMEContentObserver` of the value changes does not run if `mBoundFrame` is not `nullptr`. I don't remember why I did so (probably for avoiding performance regressions as far as possible), but it does not make sense not to notify `IMEContentObserver` if only `mTextEditor` has not been recreated because `IMEStateManager` has not been reinitialized `IMEContentObserver` with new anonymous `<div>`s yet because it requires new `TextEditor` instance. Differential Revision: https://phabricator.services.mozilla.com/D180767
This commit is contained in:
@@ -2950,11 +2950,13 @@ bool TextControlState::SetValueWithoutTextEditor(
|
||||
if (mBoundFrame) {
|
||||
mBoundFrame->UpdateValueDisplay(true);
|
||||
}
|
||||
|
||||
// If the text control element has focus, IMEContentObserver is not
|
||||
// observing the content changes due to no bound frame. Therefore,
|
||||
// we need to let IMEContentObserver know all values are being replaced.
|
||||
else if (IMEContentObserver* observer = GetIMEContentObserver()) {
|
||||
observer->OnTextControlValueChangedDuringNoFrame(mValue);
|
||||
// observing the content changes due to no bound frame or no TextEditor.
|
||||
// Therefore, we need to let IMEContentObserver know all values are being
|
||||
// replaced.
|
||||
if (IMEContentObserver* observer = GetIMEContentObserver()) {
|
||||
observer->OnTextControlValueChangedWhileNotObservable(mValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user