Commit Graph

78 Commits

Author SHA1 Message Date
Chris Peterson
71422dcaa9 Bug 1457813 - Part 2: Replace non-asserting NS_PRECONDITIONs with MOZ_ASSERTs. r=froydnj
s/NS_PRECONDITION/MOZ_ASSERT/ and reindent

MozReview-Commit-ID: KuUsnVe2h8L

--HG--
extra : source : c14655ab3df2c9b1465dd8102b9d25683359a37b
2018-04-28 12:50:58 -07:00
Masayuki Nakano
e6ee7e1c05 Bug 1423693 - Make IMContextWrapper::Init() resolve actual IM if active IM context ID is "xim" and there is XMODIFIERS env r=m_kato
On some Linux environment, GTK_IM_MODULE env may be "xim".  Then, actual
IM is specified with XMODIFIERS env with "@im=".  Therefore, if active IM
context ID is xim, IMContextWrapper::Init() needs to look for actual IM name
in XMODIFIERS.

MozReview-Commit-ID: 1aGjBkF4AQn

--HG--
extra : rebase_source : 8c50baa517c61ec2d872c036abc989b4a07e8e36
2018-03-19 14:22:52 +09:00
Masayuki Nakano
7744988cce Bug 1444571 - Prevent IIIM module from being unloaded with grabbing GtkIMContextIIIM class with static variable r=karlt
IIIMF is really old IME framework.  In these days, it's not used as default IM
module of any major distributions.  However, ATOK X which is old proprietary
IME requires IIIMF and it's still used by some Japanese IME users.  Therefore,
we need to take back the hack to prevent crash caused by IIIMF.

We did increment refcount of GtkIMContextIIIM class to prevent IIIM module
from being unloaded.  However, it was not ported when we changed default
toolkit from GTK2 to GTK3.  So, this is doing the porting.

Unfortunately, the instance of GtkIMContextIIIM is wrapped by opacity struct.
So, it's not safe to access the pointer with declaring a mimic struct.
Therefore, we should directly get GType from the name with calling
g_type_from_name("GtkIMContextIIIM") instead of using G_TYPE_FROM_INSTANCE()
and g_type_name().

MozReview-Commit-ID: GCZaSUtPiS9

--HG--
extra : rebase_source : 3b959023bf47fa26393fc04e722c9da79a50991d
2018-03-12 22:32:43 +09:00
Masayuki Nakano
162ea38a55 Bug 1444572 - IMContextWrapper should dispatch fake eKeyDown event during composition if active IM is uim r=m_kato
uim is an old IM which uses key snooper to listen to key events rather than
via filter key event API which should be called by applications.  It's still
used by Debian 9.x, so, we still need to support this.

Unfortunately, we cannot detect if uim actually uses key snooper because it's
switch by build option of uim.  Currently, Debian builds uim as using key
snooper.  So, we should assume uim uses key snooper always.  On the other
hand, somebody *might* use uim built as not using key snooper, so, let's
decide if uim uses key snooper with new pref,
"intl.ime.hack.uim.using_key_snooper", but its default should be true.

Note that ibus and Fcitx also have the mode to use key snooper (perhaps for
backward compatibility with uim).  However, it's not enabled in default
settings and even if it's enabled, Firefox is in whitelist in the default
settings of them for stop using key snooper.  Therefore, we don't need to
support key snooper mode for them unless we'll get some requests to
support their key snooping mode.

MozReview-Commit-ID: 6fTsfKrHzvo

--HG--
extra : rebase_source : 8ddf4541db635246e6bb0ddc73b012c9be001c6d
2018-03-12 15:41:39 +09:00
Masayuki Nakano
28e4c11d86 Bug 1443421 - part 2: IMContextWrapper should dispatch eKeyDown or eKeyUp event as "processed by IME" even when IM sent some signals without sending key event again r=m_kato
ibus and fcitx usually post key event to other IME process, then, if it causes
some signals to updating composition string, they may not send the posted
key event to us again.  Then, IMContextWrapper dispatches neither eKeyDown nor
eKeyUp event since mProcessingKeyEvent becomes non-nullptr only while
OnKeyEvent() is called.  So, IMContextWrapper need to store key event if
OnKeyEvent() assumes that given key event is posted to different process.
Then, if IMContextWrapper receives some signals, it should dispatch eKeyDown
and eKeyUp event with stored key event.

Note that we cannot compare the pointer of first event and following event
directly even though usually both events are same address as far as I checked
because according to the source code of ibus, fcitx and GDK, they use
gdk_event_copy() to keep storing original event.  According to the document of
the API, it might just increment refcount.  However, the actual implementation
of the API always creates another instance and return it.  So, it might be
used same address by arena allocation or something accidentally.   Anyway,
we shouldn't compare them.  Instead, we need to compare each information of
two key events.  Unfortunately, we also cannot compare them simply.  Both
ibus and fcitx set unused bits of GdkEventKey::state to true when they send
back the event to us.  Therefore, we should compare some of or all of the
members by ourselves.  I think that matching time must be enough in most
cases since its value of native key events are properly set.  However, for
safer code, this patch also checks type, keyval and part of state.

MozReview-Commit-ID: FZSwN61v0Sd

--HG--
extra : rebase_source : e57a654392f476f5ec52d82bdd238eed2eb91e83
2018-03-09 12:39:40 +09:00
Masayuki Nakano
22ab980e4c Bug 1443421 - part 1: Make IMContextWrapper not dispatch eKeyDown and eKeyUp event if the native key event is being handled by other IME process r=m_kato
ibus and fcitx have asynchronous key event handling mode and it's enabled in
default settings.  That is, when they receive a key event from application via
a call of gtk_im_context_filter_keypress(), they may post the key event
information to other IME process, then does nothing but store the copy of the
event with gdk_event_copy() and returns true for the result of
gtk_im_context_filter_keypress().  When the other IME process handles the
event, returns the result to them in our process.  Then, they send the stored
key event to us again.  Finally, they actually handles the event in our process
actually.

Therefore, we may receive every key event twice.  So, this causes dispatching
eKeyDown event and eKeyUp event twice.  Preceding key event is always marked
as "processed by IME" since gtk_im_context_filter_keypress() returns true
temporarily and following key event is dispatched as expected.  So, we need
to ignore the first event only when gtk_im_context_filter_keypress() returns
true but the event is posted to different process.

Unfortunately, we cannot know if the key event is actually posted to different
process directly.  However, we can know if active IM is ibus, fcitx or another
one and if ibus or fcitx is in asynchronous key handling mode.

The former information is provided by gtk_im_multicontext_get_context_id().
It returns a string which is set to the IM multicontext instance by creator.
We'll get "ibus" if IM is ibus, get "fcitx" if IM is fcitx.

The latter information is not provided.  However, they consider the mode from
env value.  ibus checks IBUS_ENABLE_SYNC_MODE.  fcitx checks both
IBUS_ENABLE_SYNC_MODE and FCITX_ENABLE_SYNC_MODE.

Additionally, we can know if received key event has already been posted to
other IME process.  They use undefined bit of GdkEventKey::state to store
if the key event has already been posted (1 << 25, they called "ignored" flag).
Although their approach is really hacky but we can refer the information at
least for now.

Finally, when we guess a key event is posted to other IME process, let's
IMContextWrapper::OnKeyEvent() not dispatch eKeyDown nor eKeyUp event.
Note that if it's handled synchronously as unexpected, it may causes
dispatching one or more composition events and/or delete content event.
So, in such case, we dispatch a keyboard event for processing key event
anyway.  There is only once case we'll fail to dispatch keyboard event.
If we receive signals to dispatch composition events or delete content
command event when IM receives the result from other IME process but
it doesn't send the key event to us.  This will be fixed by the following
patch.

MozReview-Commit-ID: 94PrlnmQ3uJ

--HG--
extra : rebase_source : fc31b0293ff0f0688dd39b0094fdf8f98b6c64d3
2018-03-09 00:46:52 +09:00
Dorel Luca
4295ed1070 Backed out 2 changesets (bug 1443421) for Valgrind leak on Linux x64 opt
Backed out changeset 6afa399e604a (bug 1443421)
Backed out changeset edc1455e7082 (bug 1443421)
2018-03-14 12:31:23 +02:00
Dorel Luca
b10a3945a4 Backed out changeset e226de7caa88 (bug 1444572) for conflicts while backing out 1443421 2018-03-14 12:28:59 +02:00
Masayuki Nakano
d23a5323b4 Bug 1444572 - IMContextWrapper should dispatch fake eKeyDown event during composition if active IM is uim r=m_kato
uim is an old IM which uses key snooper to listen to key events rather than
via filter key event API which should be called by applications.  It's still
used by Debian 9.x, so, we still need to support this.

Unfortunately, we cannot detect if uim actually uses key snooper because it's
switch by build option of uim.  Currently, Debian builds uim as using key
snooper.  So, we should assume uim uses key snooper always.  On the other
hand, somebody *might* use uim built as not using key snooper, so, let's
decide if uim uses key snooper with new pref,
"intl.ime.hack.uim.using_key_snooper", but its default should be true.

Note that ibus and Fcitx also have the mode to use key snooper (perhaps for
backward compatibility with uim).  However, it's not enabled in default
settings and even if it's enabled, Firefox is in whitelist in the default
settings of them for stop using key snooper.  Therefore, we don't need to
support key snooper mode for them unless we'll get some requests to
support their key snooping mode.

MozReview-Commit-ID: 6fTsfKrHzvo

--HG--
extra : rebase_source : 8ddf4541db635246e6bb0ddc73b012c9be001c6d
2018-03-12 15:41:39 +09:00
Masayuki Nakano
863964eb27 Bug 1443421 - part 2: IMContextWrapper should dispatch eKeyDown or eKeyUp event as "processed by IME" even when IM sent some signals without sending key event again r=m_kato
ibus and fcitx usually post key event to other IME process, then, if it causes
some signals to updating composition string, they may not send the posted
key event to us again.  Then, IMContextWrapper dispatches neither eKeyDown nor
eKeyUp event since mProcessingKeyEvent becomes non-nullptr only while
OnKeyEvent() is called.  So, IMContextWrapper need to store key event if
OnKeyEvent() assumes that given key event is posted to different process.
Then, if IMContextWrapper receives some signals, it should dispatch eKeyDown
and eKeyUp event with stored key event.

Note that we cannot compare the pointer of first event and following event
directly even though usually both events are same address as far as I checked
because according to the source code of ibus, fcitx and GDK, they use
gdk_event_copy() to keep storing original event.  According to the document of
the API, it might just increment refcount.  However, the actual implementation
of the API always creates another instance and return it.  So, it might be
used same address by arena allocation or something accidentally.   Anyway,
we shouldn't compare them.  Instead, we need to compare each information of
two key events.  Unfortunately, we also cannot compare them simply.  Both
ibus and fcitx set unused bits of GdkEventKey::state to true when they send
back the event to us.  Therefore, we should compare some of or all of the
members by ourselves.  I think that matching time must be enough in most
cases since its value of native key events are properly set.  However, for
safer code, this patch also checks type, keyval and part of state.

MozReview-Commit-ID: FZSwN61v0Sd

--HG--
extra : rebase_source : e54284c27a171f899a6cf87a65935669e2d57021
2018-03-09 12:39:40 +09:00
Masayuki Nakano
6a306796a7 Bug 1443421 - part 1: Make IMContextWrapper not dispatch eKeyDown and eKeyUp event if the native key event is being handled by other IME process r=m_kato
ibus and fcitx have asynchronous key event handling mode and it's enabled in
default settings.  That is, when they receive a key event from application via
a call of gtk_im_context_filter_keypress(), they may post the key event
information to other IME process, then does nothing but store the copy of the
event with gdk_event_copy() and returns true for the result of
gtk_im_context_filter_keypress().  When the other IME process handles the
event, returns the result to them in our process.  Then, they send the stored
key event to us again.  Finally, they actually handles the event in our process
actually.

Therefore, we may receive every key event twice.  So, this causes dispatching
eKeyDown event and eKeyUp event twice.  Preceding key event is always marked
as "processed by IME" since gtk_im_context_filter_keypress() returns true
temporarily and following key event is dispatched as expected.  So, we need
to ignore the first event only when gtk_im_context_filter_keypress() returns
true but the event is posted to different process.

Unfortunately, we cannot know if the key event is actually posted to different
process directly.  However, we can know if active IM is ibus, fcitx or another
one and if ibus or fcitx is in asynchronous key handling mode.

The former information is provided by gtk_im_multicontext_get_context_id().
It returns a string which is set to the IM multicontext instance by creator.
We'll get "ibus" if IM is ibus, get "fcitx" if IM is fcitx.

The latter information is not provided.  However, they consider the mode from
env value.  ibus checks IBUS_ENABLE_SYNC_MODE.  fcitx checks both
IBUS_ENABLE_SYNC_MODE and FCITX_ENABLE_SYNC_MODE.

Additionally, we can know if received key event has already been posted to
other IME process.  They use undefined bit of GdkEventKey::state to store
if the key event has already been posted (1 << 25, they called "ignored" flag).
Although their approach is really hacky but we can refer the information at
least for now.

Finally, when we guess a key event is posted to other IME process, let's
IMContextWrapper::OnKeyEvent() not dispatch eKeyDown nor eKeyUp event.
Note that if it's handled synchronously as unexpected, it may causes
dispatching one or more composition events and/or delete content event.
So, in such case, we dispatch a keyboard event for processing key event
anyway.  There is only once case we'll fail to dispatch keyboard event.
If we receive signals to dispatch composition events or delete content
command event when IM receives the result from other IME process but
it doesn't send the key event to us.  This will be fixed by the following
patch.

MozReview-Commit-ID: 94PrlnmQ3uJ

--HG--
extra : rebase_source : 0bb58ed432bacef8ad13264babd2b21fe950b71c
2018-03-09 00:46:52 +09:00
Masayuki Nakano
48703c7384 Bug 1443091 - IMContextWrapper should dispatch eKeyDown and eKeyUp event as "Dead" keys rather than "Process" if user pressed a dead key r=m_kato
On Linux, dead key is implemented with "table-based input methods" which are
available even on GtkIMContextSimple (i.e., available even in password fields).
Therefore, IMContextWrapper handles dead key sequence as usual composition of
IME.  However, on the other platforms, we dispatch "Dead" eKeyDown and eKeyUp
events for dead key.

We started to mark keyboard events which are handled by IME as "processed by
IME" since bug 1343451, i.e., we started to set mKeyNameIndex to
KEY_NAME_INDEX_Process.  However, we should keep previous behavior, i.e., keep
setting it to KEY_NAME_INDEX_Dead.  Fortunately, GDK's key event tells us
whether the keyboard event is a dead key event with keysym.  So, we can detect
if we're in a dead key sequence simply.

MozReview-Commit-ID: Dv336WptfXN

--HG--
extra : rebase_source : e8a7b5a7eb7c57e1e45de20ebebd56f88457cfc6
2018-03-05 22:03:58 +09:00
Masayuki Nakano
3db8525089 Bug 1343451 - part 3-2: Make IMContextWrapper dispatch eKeyDown event or eKeyUp event if IME handles native key event but we have not dispatched DOM event for it yet r=m_kato
Currently, IMContextWrapper doesn't dispatch eKeyDown event and eKeyUp event
if it's handled by IME.  However, for conforming to UI Events, it should
not eat given keyboard events completely.

This patch makes IMContextWrapper dispatches eKeyDown event or eKeyUp event
before dispatching first event of composition events or content command
event.

MozReview-Commit-ID: H2jHpViTH5Q

--HG--
extra : rebase_source : a1f4127ba87e03e1ff97690f97fb7bf64b4d4818
2018-02-22 20:56:08 +09:00
Masayuki Nakano
896e893f72 Bug 1343451 - part 3-1: Make KeymapWrapper::InitKeyEvent() mark given key event as "processed by IME" if it has been handled by IME r=m_kato
For conforming UI Events spec, KeymapWrapper::InitKeyEvent() should initialize
mKeyCode and mKeyNameIndex with NS_VK_PROCESSKEY and KEY_NAME_INDEX_Process if
given keyboard event has already been handled by IME.

For making it know if given keyboard event has been handled by IME, this patch
adds additional bool argument to it and its callers.

Note that this patch changes keyCode value and key value of "keydown" event if
it's fired before "compositionstart" since Chromium does so on Linux.

MozReview-Commit-ID: FC3tfyeeopU

--HG--
extra : rebase_source : b7e2a70db1fbb4ca7d20379fd1c14f7dc38e656d
2018-02-22 19:52:53 +09:00
Cosmin Sabou
462b445081 Backed out 6 changesets (bug 1343451) for mochitest android perma failures on testInputConnection.
Backed out changeset e07105d9698e (bug 1343451)
Backed out changeset dc4a2a5932c3 (bug 1343451)
Backed out changeset 9561ed261d04 (bug 1343451)
Backed out changeset 84a5ec921442 (bug 1343451)
Backed out changeset b34d48936db8 (bug 1343451)
Backed out changeset 4dce7ab14f71 (bug 1343451)
2018-03-12 18:07:46 +02:00
Masayuki Nakano
fd292edc43 Bug 1343451 - part 3-2: Make IMContextWrapper dispatch eKeyDown event or eKeyUp event if IME handles native key event but we have not dispatched DOM event for it yet r=m_kato
Currently, IMContextWrapper doesn't dispatch eKeyDown event and eKeyUp event
if it's handled by IME.  However, for conforming to UI Events, it should
not eat given keyboard events completely.

This patch makes IMContextWrapper dispatches eKeyDown event or eKeyUp event
before dispatching first event of composition events or content command
event.

MozReview-Commit-ID: H2jHpViTH5Q

--HG--
extra : rebase_source : 4129620126a34e27af1503e7c4652bb09c7e9bb6
2018-02-22 20:56:08 +09:00
Masayuki Nakano
099a9bedee Bug 1343451 - part 3-1: Make KeymapWrapper::InitKeyEvent() mark given key event as "processed by IME" if it has been handled by IME r=m_kato
For conforming UI Events spec, KeymapWrapper::InitKeyEvent() should initialize
mKeyCode and mKeyNameIndex with NS_VK_PROCESSKEY and KEY_NAME_INDEX_Process if
given keyboard event has already been handled by IME.

For making it know if given keyboard event has been handled by IME, this patch
adds additional bool argument to it and its callers.

Note that this patch changes keyCode value and key value of "keydown" event if
it's fired before "compositionstart" since Chromium does so on Linux.

MozReview-Commit-ID: FC3tfyeeopU

--HG--
extra : rebase_source : 9c88967b8e2a5539023deb1277ae8704418dfd0d
2018-02-22 19:52:53 +09:00
Sylvestre Ledru
424664ff30 Bug 1278282 - Remove the 'MOZ_WIDGET_GTK == 2' defines r=karlt,lsalzman
MozReview-Commit-ID: 3v8D600g8St

--HG--
extra : rebase_source : 34ea6f9868c1b322076c24daa75dc33e27b6704e
2018-01-10 08:52:04 +01:00
Sylvestre Ledru
2c6660f219 Bug 1278282 - Ride along Remove some trailing whitespaces r=lsalzman
MozReview-Commit-ID: 8W6VKIW8PQV

--HG--
extra : rebase_source : 23b5c300dd4bebe2b8808bdb03373073aab80b9f
2017-12-19 11:38:59 +01:00
Sylvestre Ledru
eabcdd21b2 Bug 1278282 - Replace #if (MOZ_WIDGET_GTK == 3) by #ifdef MOZ_WIDGET_GTK r=lsalzman
MozReview-Commit-ID: Bo0m7n078oh

--HG--
extra : rebase_source : 1874ac3e0abca65b821b5d04a6610a5cbb63fe24
2018-01-09 11:51:07 +01:00
Masayuki Nakano
1166607c92 Bug 1387357 - IMContextWrapper::DispatchCompositionStart() should stop dispatching eCompositionStart if dispatching preceding eKeyDown event causes changing active IM context r=m_kato
If a keydown event handler moves focus like Ctrl+PageDown handler, IM context
may be changed to DISABLED or something.  In such case, native IME would stop
current composition because focus moving in Gecko causes making IME blurred.
However, IMContextWrapper::DispatchCompositionStart() always dispatches
eCompositionStart even in such case.

So, it should stop dispatching eCompositionStart if IME enabled state is
changed during dispatching the preceding keydown event.

Note that this patch moves the setter of mComposingContext from
OnStartCompositionNative() which is a signal listener of "preedit_start" to
DispatchCompositionStart() because if IME starts composition without
"preedit_start" signal, DispatchCompositionStart() will be called but
OnStartCompositionNative() isn't called.  However, this fix needs
mComposingContext.

MozReview-Commit-ID: F3F6NuCOrkJ

--HG--
extra : rebase_source : 513528eba0f29eb9b6ce8c5f47e4badbde9cbdb8
2017-09-04 20:18:43 +09:00
Masayuki Nakano
a9fb7c2f23 Bug 1376407 - part2: Emulate selection when committing composition as collapsed to the end of composition r=m_kato
When you start new composition during converting with Mozc in e10s mode, the following things occur:

1. Mozc commits previous composition.
2. Gecko dispatches eCompositionCommit event.
3. Mozc sets new composition string (skipping composition start signal).
4. Gecko dispatches eCompositionStart and eCompositionChange event.
5. Selection is changed asynchronously.
6. Gecko sets position of IME windows.

At #4, Gecko stores start of composition as selection start, then, trying to adjust it at #5. However, new selection is caret position in new composition string. Therefore, it's not used for the adjustment. This causes that stored composition start offset is always the start of the previous composition (if the previous patch didn't change EnsureToCacheSelection() behavior). So, IMContextWrapper needs to compute proper composition start offset in this case.

The simplest fix is, modifying selection at #2 as which will be occurred in focused editor.  So, this patch makes the selection cache collapsed to the end of committing string.

Note that actual selection may be different if JS changes selection and/or the text in the focused editor. However, it doesn't matter. IMContextWrapper should behave as expected while current composition is active.

MozReview-Commit-ID: 221mDUd8yRP

--HG--
extra : rebase_source : 571b2de85ed6ea1fdadea73b7f95507937cc60e9
2017-06-27 03:11:25 -07:00
Masayuki Nakano
b67cd28522 Bug 1376407 - part1: IMContextWrapper should cache selected string instead of length of selection r=m_kato
IMContextWrapper::EnsureToCacheSelection() always queries actual selection when the caller needs selected string.  However, this may be expensive and this is bad behavior for the following patch because it wants to emulate selection range until receiving next selection change notification.

Therefore, this patch makes IMContextWrapper::Selection store selected string instead of just its length like other native IME handlers

Additionally, this patch renames IMContextWrapper::mSelectedString to IMContextWrapper::mSelectedStringRemovedByComposition for making the difference between it and the new string in Selection clearer.

MozReview-Commit-ID: 3bygvW7sKf4

--HG--
extra : rebase_source : b0835b8c1607ecd647444a4d984980943a6fd570
2017-06-27 02:46:08 -07:00
Masayuki Nakano
61ce5526c6 Bug 1296220 Rename nsIMEUpdatePreference to mozilla::widget::IMEUpdatePreference r=m_kato
MozReview-Commit-ID: 2rIXTlwA6my

--HG--
extra : rebase_source : a51be3edd717092738c2b5e8ccc4f60540712bfd
2017-04-11 21:24:55 +09:00
Jim Chen
53a1107cd1 Bug 1343075 - Use GeckoEditableSupport from PuppetWidget; r=masayuki r=rbarker r=snorp r=esawin
Bug 1343075 - 1a. Add TextEventDispatcherListener::GetIMEUpdatePreference; r=masayuki

Add a GetIMEUpdatePreference method to TextEventDispatcherListener to
optionally control which IME notifications are received by NotifyIME.
This patch also makes nsBaseWidget forward its GetIMEUpdatePreference
call to the widget's native TextEventDispatcherListener.

Bug 1343075 - 1b. Implement GetIMEUpdatePreference for all TextEventDispatcherListener; r=masayuki

This patch implements GetIMEUpdatePreference for all
TextEventDispatcherListener implementations, by moving previous
implementations of nsIWidget::GetIMEUpdatePreference.

Bug 1343075 - 2. Allow setting a PuppetWidget's native TextEventDispatcherListener; r=masayuki

In PuppetWidget, add getter and setter for the widget's native
TextEventDispatcherListener. This allows overriding of PuppetWidget's
default IME handling. For example, on Android, the PuppetWidget's native
TextEventDispatcherListener will communicate directly with Java IME code
in the main process.

Bug 1343075 - 3. Add AIDL interface for main process; r=rbarker

Add AIDL definition and implementation for an interface for the main
process that child processes can access.

Bug 1343075 - 4. Set Gecko thread JNIEnv for child process; r=snorp

Add a JNIEnv* parameter to XRE_SetAndroidChildFds, which is used to set
the Gecko thread JNIEnv for child processes. XRE_SetAndroidChildFds is
the only Android-specific entry point for child processes, so I think
it's the most logical place to initialize JNI.

Bug 1343075 - 5. Support multiple remote GeckoEditableChild; r=esawin

Support remote GeckoEditableChild instances that are created in the
content processes and connect to the parent process GeckoEditableParent
through binders.

Support having multiple GeckoEditableChild instances in GeckoEditable by
keeping track of which child is currently focused, and only allow
calls to/from the focused child by using access tokens.

Bug 1343075 - 6. Add method to get GeckoEditableParent instance; r=esawin

Add IProcessManager.getEditableParent, which a content process can call
to get the GeckoEditableParent instance that corresponds to a given
content process tab, from the main process.

Bug 1343075 - 7. Support GeckoEditableSupport in content processes; r=esawin

Support creating and running GeckoEditableSupport attached to a
PuppetWidget in content processes.

Because we don't know PuppetWidget's lifetime as well as nsWindow's,
when attached to PuppetWidget, we need to attach/detach our native
object on focus/blur, respectively.

Bug 1343075 - 8. Connect GeckoEditableSupport on PuppetWidget creation; r=esawin

Listen to the "tab-child-created" notification and attach our content
process GeckoEditableSupport to the new PuppetWidget.

Bug 1343075 - 9. Update auto-generated bindings; r=me
2017-03-07 22:34:39 -05:00
Tom Tromey
5f8f360823 Bug 1060419 - make log_print use Printf.h, r=froydnj
MozReview-Commit-ID: BIZ1GQEZ1vs

--HG--
extra : rebase_source : 2f1f0aa12493c44f352d9a7e8683e7bb72d2d75b
2016-12-15 20:16:31 -07:00
Makoto Kato
4a28a26c93 Bug 1302980 - Don't reset IME context on preedit_end. r=masayuki
You know, when Korean IME commits string, then it sometimes set next preedit string.  So reseting context causes that next preedit string is committed.

So we shouldn't reset IME context with preedit_end.

MozReview-Commit-ID: CZJJvYjcrKY

--HG--
extra : rebase_source : d7e2e80930355794a40466c68fe22e43e7164d72
2016-09-16 18:00:25 +09:00
Masayuki Nakano
c09c84b7eb Bug 1138159 Don't reset IM context at selection change when there is no composition and hasn't retrieved surrounding text after last selection change r=m_kato
ibus-pinyin has a bug.  When application calls gtk_im_context_reset(), which means selection is changed in application, ibus-pinyin sents a set of composition signals with empty commit string.  Therefore, selecting text causes removing it.

For preventing it but not breaking the other IMEs which use surrounding text, we should give up to call gtk_im_context_reset() if IME hasn't retrieved surrounding text after the last selection change.  Not having retrieved surrounding text means that the IME doesn't have any cache of contents.  Therefore, not calling gtk_im_context_reset() at selection change must be safe for such IMEs.

MozReview-Commit-ID: 5cbIZjpd7zN

--HG--
extra : rebase_source : 6010b3e055d66ebd2ed50f9b3ee8ff2330d3c6ab
2016-09-15 22:36:23 +09:00
Michael Layzell
0c311dc0f9 Bug 1018486 - Part 7: Changes in widget/gtk/, r=masayuki
MozReview-Commit-ID: 2uJ9flIaCEY
2016-09-07 10:50:44 -04:00
Makoto Kato
e2412501ba Bug 1286753 - Candidate window should be located under composing string. r=masayuki
TargetClauseOffset is the offset from start composition offset.  So we should add start composition to calaculate correct rects.

MozReview-Commit-ID: 4qCpKvw2Eb4

--HG--
extra : rebase_source : 1c11d5648987772ee684166ee715340ad90284c0
2016-07-14 15:43:47 +09:00
Masayuki Nakano
84473f8e3e Bug 1284422 part.7 Replace "KeymapWrapper(%p): " with "0x%p " and "%p" with "0x%p" in nsGtkKeyUtils.cpp r=m_kato
MozReview-Commit-ID: 8HcQ4Aj0eqI

--HG--
extra : rebase_source : b88de464c784e4a5c327716c443b1d4c8b32e901
2016-07-06 18:52:23 +09:00
Masayuki Nakano
119993dfbb Bug 1284422 part.6 Reduce indent of MOZ_LOG() in IMContextWrapper.cpp r=m_kato
MozReview-Commit-ID: 4jHFhQiUoHv

--HG--
extra : rebase_source : 2fc68708d048c1e2a0dc9d0a3a05b62ec420b338
2016-07-05 18:44:18 +09:00
Masayuki Nakano
8900028692 Bug 1284422 part.5 Remove "GTKIM: " from log of IMContextWrapper.cpp r=m_kato
MozReview-Commit-ID: 1rn6Azf0gLi

--HG--
extra : rebase_source : b9f4f4013f19565d23e711f4d365b23cdffbca10
2016-07-05 18:41:48 +09:00
Masayuki Nakano
d9d66b8cff Bug 1282043 IMContextWrapper shouldn't append 0 length clause to TextRangeArray and if IME doesn't specify clause at beginning of the composition, it should insert dummy clause r=m_kato
Here is the patched build's log:

[Main Thread]: I/nsGtkIMModuleWidgets GTKIM: 7fab5a60a2c0 CreateTextRangeArray(aContext=7fab5a7bbbf0, aCompositionString="÷" (Length()=1))
[Main Thread]: W/nsGtkIMModuleWidgets GTKIM: 7fab5a60a2c0   SetTextRange(), FAILED, due to no attr, aTextRange= { mStartOffset=0, mEndOffset=1 }
[Main Thread]: W/nsGtkIMModuleWidgets GTKIM: 7fab5a60a2c0   SetTextRange(), FAILED, due to current clause length is 0
[Main Thread]: E/nsGtkIMModuleWidgets GTKIM: 7fab5a60a2c0   SetTextRange(), FAILED, due to g_utf8_to_utf16() failure (retrieving current clause)
[Main Thread]: W/nsGtkIMModuleWidgets GTKIM: 7fab5a60a2c0   CreateTextRangeArray(), inserting a dummy clause at the beginning of the composition string mStartOffset=0, mEndOffset=1, mRangeType=TextRangeType::eRawClause

iBus Chewing IME has two clauses when user presses Shift+p, one doesn't have pango_attr, the other is empty.  These clauses are not useful in Gecko. Additionally, TextRangeArray assumes that there is a clause at beginning of the composition when there is one or more clauses.  Therefore, this patch tries to insert dummy clause at the beggining of composition in such case.

MozReview-Commit-ID: 3hVGVmvFrhA

--HG--
extra : rebase_source : edbd3a6a1139cffb0d5bfbe0c92bf6870c9a2608
2016-06-28 19:37:03 +09:00
Masayuki Nakano
ef2fb8753d Bug 1282669 Get rid of nsIMEUpdatePreference::DontNotifyChangesCausedByComposition() r=m_kato
I think that we can drop nsIMEUpdatePreference::DontNotifyChangesCausedByComposition(), i.e., nsIMEUpdatePreference::NOTIFY_CHANGES_CAUSED_BY_COMPOSITION because it's now used only by TSFTextStore but TSFTextStore ignores if SelectionChangeDataBase::mCausedByComposition or TextChangeDataBase::mCausedOnlyByComposition is true (for supporting async changes in e10s mode).  So, only issue is, dropping the flag might cause increasing computing TextChangeData cost during composition in TSF mode.  However, now, it's already enough fast and even if it'd cause performance regression, we could add a hack with TextComposition's offset information.  Therefore, we don't need to worry about the performance regression so seriously.

MozReview-Commit-ID: HNT3G4isONj

--HG--
extra : rebase_source : 164231023aa2a17ceab94d92fb49ba0a00dab429
2016-06-28 16:51:59 +09:00
Masayuki Nakano
e1d8dafcd9 Bug 1282668 Get rid of nsIMEUpdatePreference::NOTIFY_SELECTION_CHANGE r=m_kato
Currently, all widgets request selection change notifications to IMEContentObserver.  Additionally, IMEContentObserver needs to listen selection changes for caching latest selection for eQuerySelectedText.  Therefore, it doesn't make sense to keep defining nsIMEUpdatePreference::NOTIFY_SELECTION_CHANGE.

If widgets didn't need selection change notifications, they could just ignore the unnecessary notifications.

Note that all widgets don't need selection change notifications if a plugin has focus and IMEContentObserver cannot observe selection changes in the plugin.  Therefore, if IMEContentObserver is initialized with a plugin, it shouldn't listen selection changes (and doesn't need to notify widgets of selection changes).

MozReview-Commit-ID: FOVFFgA2nOz

--HG--
extra : rebase_source : 3e16d5023835f99f82934e754d2e7db70474f9ee
2016-06-28 15:23:12 +09:00
Makoto Kato
b01777a050 Bug 1280796 - Selection cache should be updated on commit string. r=masayuki
Selection cache might be updated on commit string, so it should be updated correctly.  Also, IMContextWrapper::OnSelectionChange() already has the check for composing using IsComposing().

MozReview-Commit-ID: 2n3f3I3aAjg

--HG--
extra : rebase_source : 5bd43d723a3170864dd7ac05c9101aaedd7dfac6
2016-06-28 10:28:42 +09:00
Makoto Kato
a4ac8392bb Bug 1282338 - Fix log output of IMContextWrapper::OnDeleteSurroundingNative. r=masayuki
IMContextWrapper::OnDeleteSurroundingNative should output aOutput and aNChar correctly.

MozReview-Commit-ID: 46UrnGajnTG

--HG--
extra : rebase_source : 7ed7d3f389d492117e835c071bbea00f7ce4ff8d
2016-06-27 10:40:02 +09:00
Masayuki Nakano
dead605781 Bug 1281391 IMContextWrapper and nsGtkKeyUtils should use LazyLogModule instead of PR_NewLogModule() for making MOZ_LOG* aware r=m_kato
MozReview-Commit-ID: 5xqIfFmakvq

--HG--
extra : rebase_source : 825b0b667d5200ba8d8c07ddbb3ea98f499ebd79
2016-06-22 16:31:37 +09:00
Masayuki Nakano
258c1f97d6 Bug 1277756 part.7 Rename TextRangeType::NS_TEXTRANGE_SELECTEDCONVERTEDTEXT to TextRangeType::eSelectedClause r=smaug
MozReview-Commit-ID: GyRYWzfeWrm

--HG--
extra : rebase_source : 8bebacaf675ec4a3cf91cfd434d07beeb7fb1567
2016-06-03 19:15:21 +09:00
Masayuki Nakano
3fa2003d17 Bug 1277756 part.6 Rename TextRangeType::NS_TEXTRANGE_CONVERTEDTEXT to TextRangeType::eConvertedClause r=smaug
MozReview-Commit-ID: 3mexBm278As

--HG--
extra : rebase_source : ef363b0ac50396631e9b145b7e869330509fe259
2016-06-03 19:05:32 +09:00
Masayuki Nakano
98f069e029 Bug 1277756 part.5 Rename TextRangeType::NS_TEXTRANGE_SELECTEDRAWTEXT to TextRangeType::eSelectedRawClause r=smaug
MozReview-Commit-ID: MbG4siLb4Q

--HG--
extra : rebase_source : 23c20c55c3936dc6af5f57414ef7630003480275
2016-06-03 18:57:21 +09:00
Masayuki Nakano
f4254e7f7f Bug 1277756 part.4 Rename TextRangeType::NS_TEXTRANGE_RAWINPUT to TextRangeType::eRawClause r=smaug
MozReview-Commit-ID: KLC1VPiYTdz

--HG--
extra : rebase_source : 3f750e526bb04b26ed66d2c0fada14e7d5b43d73
2016-06-03 18:48:37 +09:00
Masayuki Nakano
6b5425853a Bug 1277756 part.3 Rename TextRangeType::NS_TEXTRANGE_CARETPOSITION to TextRangeType::eCaret r=smaug
MozReview-Commit-ID: CaqmOSxYYU7

--HG--
extra : rebase_source : 5820d491b97be7899150516d05f1426e74dab5b5
2016-06-03 18:40:06 +09:00
Masayuki Nakano
4fc95828b6 Bug 1277756 part.1 Make anonymous enum for NS_TEXTRANGE_* to an enum class named "TextRangeType" r=smaug
For making our code clearer by the stronger type check, we should change the anonymous enum for NS_TEXTRANGE_* to enum class whose name is "TextRangeType" and whose type is "RawTextRangeType" which is an alias of uint8_t.

Additionally, this also adds some utility methods for them.

Note that some lines which are changed by this patch become over 80 characters but it will be fixed by the following patches.

MozReview-Commit-ID: 76izA1WqTkp

--HG--
extra : rebase_source : 27cd8cc8f7f8e82055dbfe82aba94c02beda5fa4
2016-06-04 09:49:21 +09:00
Masayuki Nakano
e67330e0b4 Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
It's not clear to me what NOTIFY_IME_OF_COMPOSITION_UPDATE means only from the name. For making the name clearer, this patch renames it to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED and add some explanation to the definition.

MozReview-Commit-ID: 8ySYCNJ1Ytz

--HG--
extra : rebase_source : 3331b8f48e8b460c7f9b088064dcda9488f3403c
2016-05-31 11:39:15 +09:00
Arata Furukawa
676913b9bb Bug 1259655 - part 1 Rename WidgetEventTime::time to WidgetEventTime::mTime r=masayuki
MozReview-Commit-ID: 7lBCEVkanvF

--HG--
extra : source : d629f018d02594951b7deccf1e1fce279d04694c
2016-03-28 13:29:42 +09:00
Masayuki Nakano
9aa8592b7f Bug 1137565 part.4 Implement IMContextWrapper::WillDispatchKeyboardEvent() r=m_kato 2016-03-16 13:47:49 +09:00
Masayuki Nakano
ad8535477c Bug 1137565 part.2 IMContextWrapper should use TextEventDispatcher r=m_kato 2016-03-16 13:47:49 +09:00
Masayuki Nakano
a9f207530a Bug 1137565 part.1 Implement TextEventDispatcherListener in IMContextWrapper r=m_kato 2016-03-16 13:47:49 +09:00