Title: [254826] trunk/Source/WebKit
- Revision
- 254826
- Author
- [email protected]
- Date
- 2020-01-20 07:52:58 -0800 (Mon, 20 Jan 2020)
Log Message
[GTK][WPE] InputMethodFilter: do not notify about focus in when only content type changed
https://bugs.webkit.org/show_bug.cgi?id=206502
Reviewed by Adrian Perez de Castro.
That's unbalancing the focus in/out notifications.
* UIProcess/API/glib/InputMethodFilter.cpp:
(WebKit::InputMethodFilter::setContext): Always call notifyContentType().
(WebKit::InputMethodFilter::setState): Only call notifyFocusedIn() and notifyFocusedOut when there's a focus change.
(WebKit::InputMethodFilter::notifyContentType): Notify content type if changed.
(WebKit::InputMethodFilter::notifyFocusedIn): Move the content type notification to its own function.
* UIProcess/API/glib/InputMethodFilter.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (254825 => 254826)
--- trunk/Source/WebKit/ChangeLog 2020-01-20 15:43:09 UTC (rev 254825)
+++ trunk/Source/WebKit/ChangeLog 2020-01-20 15:52:58 UTC (rev 254826)
@@ -1,5 +1,21 @@
2020-01-20 Carlos Garcia Campos <[email protected]>
+ [GTK][WPE] InputMethodFilter: do not notify about focus in when only content type changed
+ https://bugs.webkit.org/show_bug.cgi?id=206502
+
+ Reviewed by Adrian Perez de Castro.
+
+ That's unbalancing the focus in/out notifications.
+
+ * UIProcess/API/glib/InputMethodFilter.cpp:
+ (WebKit::InputMethodFilter::setContext): Always call notifyContentType().
+ (WebKit::InputMethodFilter::setState): Only call notifyFocusedIn() and notifyFocusedOut when there's a focus change.
+ (WebKit::InputMethodFilter::notifyContentType): Notify content type if changed.
+ (WebKit::InputMethodFilter::notifyFocusedIn): Move the content type notification to its own function.
+ * UIProcess/API/glib/InputMethodFilter.h:
+
+2020-01-20 Carlos Garcia Campos <[email protected]>
+
[GTK][WPE] Also include the selection index in webkit_input_method_context_notify_surrounding()
https://bugs.webkit.org/show_bug.cgi?id=206497
Modified: trunk/Source/WebKit/UIProcess/API/glib/InputMethodFilter.cpp (254825 => 254826)
--- trunk/Source/WebKit/UIProcess/API/glib/InputMethodFilter.cpp 2020-01-20 15:43:09 UTC (rev 254825)
+++ trunk/Source/WebKit/UIProcess/API/glib/InputMethodFilter.cpp 2020-01-20 15:52:58 UTC (rev 254826)
@@ -77,6 +77,8 @@
g_signal_connect_swapped(m_context.get(), "committed", G_CALLBACK(committedCallback), this);
g_signal_connect_swapped(m_context.get(), "delete-surrounding", G_CALLBACK(deleteSurroundingCallback), this);
+ notifyContentType();
+
if (isEnabled() && isViewFocused())
notifyFocusedIn();
}
@@ -83,11 +85,14 @@
void InputMethodFilter::setState(Optional<InputMethodState>&& state)
{
- if (!state)
+ bool focusChanged = state.hasValue() != m_state.hasValue();
+ if (focusChanged && !state)
notifyFocusedOut();
m_state = WTFMove(state);
- if (isEnabled() && isViewFocused())
+ notifyContentType();
+
+ if (focusChanged && isEnabled() && isViewFocused())
notifyFocusedIn();
}
@@ -172,7 +177,8 @@
wkHints |= WEBKIT_INPUT_HINT_INHIBIT_OSK;
return static_cast<WebKitInputHints>(wkHints);
}
-void InputMethodFilter::notifyFocusedIn()
+
+void InputMethodFilter::notifyContentType()
{
if (!isEnabled() || !m_context)
return;
@@ -181,6 +187,13 @@
webkit_input_method_context_set_input_purpose(m_context.get(), toWebKitPurpose(m_state->purpose));
webkit_input_method_context_set_input_hints(m_context.get(), toWebKitHints(m_state->hints));
g_object_thaw_notify(G_OBJECT(m_context.get()));
+}
+
+void InputMethodFilter::notifyFocusedIn()
+{
+ if (!isEnabled() || !m_context)
+ return;
+
webkit_input_method_context_notify_focus_in(m_context.get());
}
Modified: trunk/Source/WebKit/UIProcess/API/glib/InputMethodFilter.h (254825 => 254826)
--- trunk/Source/WebKit/UIProcess/API/glib/InputMethodFilter.h 2020-01-20 15:43:09 UTC (rev 254825)
+++ trunk/Source/WebKit/UIProcess/API/glib/InputMethodFilter.h 2020-01-20 15:52:58 UTC (rev 254826)
@@ -87,6 +87,8 @@
bool isEnabled() const { return !!m_state; }
bool isViewFocused() const;
+ void notifyContentType();
+
WebCore::IntRect platformTransformCursorRectToViewCoordinates(const WebCore::IntRect&);
bool platformEventKeyIsKeyPress(PlatformEventKey*) const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes