mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1208944 - Part 8. Don't get selection on start compostion when plugin has foucs. r=masayuki
This commit is contained in:
parent
02cfd580a7
commit
d4d5e3d0d9
@ -497,6 +497,17 @@ ContentCacheInParent::HandleQueryContentEvent(WidgetQueryContentEvent& aEvent,
|
||||
("ContentCacheInParent: 0x%p HandleQueryContentEvent("
|
||||
"aEvent={ mMessage=eQuerySelectedText }, aWidget=0x%p)",
|
||||
this, aWidget));
|
||||
if (aWidget->PluginHasFocus()) {
|
||||
MOZ_LOG(sContentCacheLog, LogLevel::Info,
|
||||
("ContentCacheInParent: 0x%p HandleQueryContentEvent(), "
|
||||
"return emtpy selection becasue plugin has focus",
|
||||
this));
|
||||
aEvent.mSucceeded = true;
|
||||
aEvent.mReply.mOffset = 0;
|
||||
aEvent.mReply.mReversed = false;
|
||||
aEvent.mReply.mHasSelection = false;
|
||||
return true;
|
||||
}
|
||||
if (NS_WARN_IF(!IsSelectionValid())) {
|
||||
// If content cache hasn't been initialized properly, make the query
|
||||
// failed.
|
||||
@ -835,7 +846,12 @@ ContentCacheInParent::OnCompositionEvent(const WidgetCompositionEvent& aEvent)
|
||||
// We must be able to simulate the selection because
|
||||
// we might not receive selection updates in time
|
||||
if (!mIsComposing) {
|
||||
mCompositionStart = mSelection.StartOffset();
|
||||
if (aEvent.widget && aEvent.widget->PluginHasFocus()) {
|
||||
// If focus is on plugin, we cannot get selection range
|
||||
mCompositionStart = 0;
|
||||
} else {
|
||||
mCompositionStart = mSelection.StartOffset();
|
||||
}
|
||||
}
|
||||
|
||||
mIsComposing = !aEvent.CausesDOMCompositionEndEvent();
|
||||
|
@ -1791,6 +1791,14 @@ public:
|
||||
*/
|
||||
NS_IMETHOD SetPluginFocused(bool& aFocused) = 0;
|
||||
|
||||
/*
|
||||
* Tell the plugin has focus. It is unnecessary to use IPC
|
||||
*/
|
||||
bool PluginHasFocus()
|
||||
{
|
||||
return GetInputContext().mIMEState.mEnabled == IMEState::PLUGIN;
|
||||
}
|
||||
|
||||
/*
|
||||
* Notifies the input context changes.
|
||||
*/
|
||||
|
@ -77,14 +77,6 @@ public:
|
||||
*/
|
||||
virtual bool DispatchPluginEvent(const MSG& aMsg);
|
||||
|
||||
/*
|
||||
* Returns true if a plugin has focus on this widget. Otherwise, false.
|
||||
*/
|
||||
virtual bool PluginHasFocus() const final
|
||||
{
|
||||
return (mInputContext.mIMEState.mEnabled == IMEState::PLUGIN);
|
||||
}
|
||||
|
||||
/*
|
||||
* Touch input injection apis
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user