nsChildView::GetEditorView() is called by
which is called when Cocoa requests window level of focused widget.
It currently gets widget including focused element (e.g., it may be in a XUL
eQueryTextContent event. However, it requires only the widget
(i.e., when a XUL
<panel> has focused element, the widget for the panel).
Therefore, it does not require to flush the layout.
However, on macOS,
ContentEventHandler always flushes layout even with
eQueryContentState which does not require any layout information. Whether
it requires flushing layout or not is considered with
WidgetQueryContentEvent::mNeedsToFlushLayout but this is set to false only
IMEContentObserver notifies widget (and IME) of focus set. At this
time, only on macOS, IME caches the layout information, for example, the
character coordinates, but we don't have a way to update it. This is the reason
why we always flush layout on macOS.
Unfortunately, when a menu popup frame is created, widget for the popup is
created synchronously. Then, Cocoa retrieves window level of the widget including
focused element. But this is unsafe to flush the layout. So, we need to stop
flushing layout in this case.
Therefore, this patch moves the
IMEContentObserver.cpp, then, makes
eQueryContentState which is the simplest query content event, and finally,