Commit Graph

56 Commits

Author SHA1 Message Date
Boris Zbarsky
1fb03996f4 Bug 1387143 part 29. Remove nsISelection. r=mats 2018-05-08 13:52:42 -04:00
Boris Zbarsky
a44e6132ff Bug 1387143 part 28. Remove nsISelection::AsSelection(). r=mats 2018-05-08 13:52:42 -04:00
Masayuki Nakano
e1f1db7272 Bug 1396725 - IMEStateManager doesn't need to manage whether menu keyboard listener is installed in different process r=smaug
Currently, IMEStateManager::OnChangeFocusInternal() tries to sync the state
whether menu keyboard listener is installed between itself and active remote
process -- When menu keyboard listener is installed, it posts a message to
_only_ active remote process.  When menu keyboard listener is uninstalled,
it posts a message to _only_ active remote process.  So, it's not guaranteed
that active remote process at installing and uninstalling may be different.
If it's different, IMEStateManager in the old remote process believes that
menu keyboard listener is still installed.  This is what the cause of IME
unavailable in a remote process.

Current approach must be wrong.  IMEStateManager should manage menu keyboard
listener state only in the process which the listener is installed in.  Then,
when menu keyboard listener is uninstalled, IMEStateManager needs to restore
the latest input context in the remote process without asking the remote
process.

Therefore, this patch does:

* stops IMEStateManager::OnChangeFocusInternal() posting message when menu
  keyboard listener is installed and uninstalled.
* removes the message sender and receiver from PBrowser.
* cache the latest input context of active remote process in
  IMEStateManager::SetInputContextForChildProcess().
* make IMEStateManager::SetInputContextForChildProcess() not set input context
  when menu keyboard listener is installed in the process.
* tries to restore latest input context in the remote process in
  IMEStateManager::OnChangeFocusInternal().  If there is no cached input
  context, it does nothing and waits next SetInputContextForChildProcess() call.
* clears the cache when IMEStateManager::OnChangeFocusInternal() changes
  active remote process to different one or nullptr.

So, this must improve performance at activating and inactivating memubar and
opening and closing popup menu in the main process.

MozReview-Commit-ID: EelKSPlaXdw

--HG--
extra : rebase_source : db7334b3c0d3ce87868450ee3179692027975bd6
2017-09-07 11:46:08 +09:00
Jan Henning
34bb1f8a36 Bug 1266683 - Part 2 - Add private browsing mode info to InputContext. r=masayuki
Android now supports telling an IME that it shouldn't store user-entered content into it's dictionary/language model/etc. and we want to automatically enable this in private browsing.

As the code that handles input on Android doesn't have any notion of tabs (and therefore of the difference between normal and private tabs), the best way to get that info across is to retrieve it directly within the IMEStateManager from the corresponding document and store it in the inputContext, which is then passed to Java for Fennec to handle.
Implementing this within Gecko also has the benefit that this part of the code can be used by other platforms as well should they want to support similar features in the future.

MozReview-Commit-ID: DsxjC4Ma7DR

--HG--
extra : rebase_source : f0940cb40170ab32cf5a172d07a61d083427be8a
2017-07-30 19:45:03 +02:00
Jim Mathies
57d9bf0aee Bug 1360666 - Update IME state when nsObjectLoadingContent content changes type from 'loading' to a valid content type. r=masayuki
MozReview-Commit-ID: JC3YGS75gpN
2017-08-03 14:07:14 -05:00
Wes Kocher
8de77914f5 Backed out changeset bcd223309de8 (bug 1360666) for asserting in stylo reftests a=backout
MozReview-Commit-ID: HH3rwDwvYyz
2017-08-02 18:14:56 -07:00
Jim Mathies
37050ac3cc Bug 1360666 - Update IME state when nsObjectLoadingContent content changes type from 'loading' to a valid content type. r=masayuki
MozReview-Commit-ID: 2cjJ5SvJsTa
2017-08-02 15:31:55 -05:00
Masayuki Nakano
0fa4a64aa3 Bug 1384027 - part3: Don't send blur notification to IME from IMEStateManager::OnChangeFocusInternal() if no window becomes active and IME wants to keep composition during deactive r=m_kato
Currently, IMEStateManager::OnChangeFocusInternal() sends blur notification to IME when a remote process has IME focus and focus is moving from the process.  However, if IME wants to keep composition even during deactive and nobody will gets focus (i.e., all windows becomes deactive), IMEStateManager shouldn't send the blur notification because it causes committing composition.

Therefore, it should send blur notification only when focus is moving to a PresContext (that means that not all windows becomes deactive) or IME doesn't want to keep composition during deactive.

Then, even if another window becomes active next time, IMEStateManager can send "stop IME state management" message to the composing remote process and the remote process can commit composition normally.

Additionally, this patch ensures to send blur notification when IME focused TabParent or widget is being destroyed.  This fixes new memory leak bug of this patch (sFocusedIMETabParent keeps grabbing the instance until shutting down in some mochitests).

MozReview-Commit-ID: KYiFGo970a8

--HG--
extra : rebase_source : c3de0df442420979414b47d8d20c7988c49b205b
2017-07-26 00:57:29 +09:00
Masayuki Nakano
cac05f3ef3 Bug 1377672 - part4: ContentCacheInParent::RequestIMEToCommitComposition() should ignore too late requests r=m_kato
Requests to commit/cancel composition came from remote process with sync message.  So, it may be too late.  E.g.,

* If the process already sent new composition start but is not handled by the remote process yet.
* If the process already send commit message but it's not handled by the remote process yet.
* If focus was already moved to different process.

In the former 2 cases, the remote process should wait eCompositionCommit(AsIs) events for clearing TextComposition.  Therefore, the requested should be treated as it's handled asynchronously.

In the last case, the remote process should commit composition with latest composition string in the main process because if the remote process commits composition with "current" composition string in it, user may lost some inputted text.

MozReview-Commit-ID: 18BUoZZq7HS

--HG--
extra : source : fd1585ad670a87d8b1ef8908931f3d4037751475
2017-07-05 19:55:18 +09:00
Masayuki Nakano
d6e921676c Bug 1377672 - part3: IMEStateManager::NotifyIME() should ignore notifications and requests which comes from unexpected process r=m_kato,smaug
IME should receive notifications and requests only from proper process.  E.g., IME shouldn't commit composition by a request which came from previous focused process.

This patch makes that IMEStateManager::NotifyIME() takes pointer to TabParent optionally.  If the request or notification came from remote process, it should be non-nullptr.  Then, this makes it ignore notifications and requests from unexpected process.

Note that this patch also touches some gfx headers because they use |ipc::| but compiler is confused at the ambiguousness between |mozilla::ipc::| and |mozilla::dom::ipc::|.

Finally, this patch changes the NS_ASSERTION in IMEHandler::OnDestroyWindow() to MOZ_ASSERT because the orange caused by the NS_ASSERTION was not realized since there was already an intermittent orange bug caused by different NS_ASSERTION.

MozReview-Commit-ID: 9CgKXQRJWmN

--HG--
extra : source : f3b5711908870c5e0e852a399a07e0ae721a12f1
2017-07-06 00:47:40 +09:00
Masayuki Nakano
c726abb366 Bug 1377672 - part2: IMEStateManager::SetIMEState() should set input context with proper origin information r=m_kato
Currently, IMEStateManager always sets input context as set by current process even when it needs to adjust IME state when a tab parent for current focused IME process is removed.  Then, input context for the widget is marked as for main process but the widget still have IME focus of a remote process.

For fixing this mismatch, IMEStateManager should set ORIGIN_CONTENT even when the tab parent is being destroyed.

MozReview-Commit-ID: C10YOAtkET4

--HG--
extra : source : 9430d123b19e0ac551c6048bb044fcfa22d13e45
2017-07-03 12:28:10 +09:00
Masayuki Nakano
583dafd5d4 Bug 1374207 - part2: TextComposition, IMEContentObserver and IMEStateManager should use EditorBase instead of nsIEditor r=m_kato
MozReview-Commit-ID: IdHmseTiv2t

--HG--
extra : rebase_source : b2f9f42dee97e1ba2cc081014d1696506088d375
2017-06-20 19:23:44 +09:00
Masayuki Nakano
d04632f559 Bug 1342552 - IMEStateManager should cache nsIWidget for sPresContext and use it. r=smaug
IMEStateManager should cache nsIWidget for sPresContext at caching sPresContext.  Then, even if sPresContext has gone, IMEStateManager can clean up with the nsIWidget cache.

Unfortunately, editor has some bugs about calling IMEStateManager::UpdateIMEState().  That is, calling it *before* IMEStateManager::OnFocusChange().  In such case, this patch makes UpdateIMEState() ignore the call.

MozReview-Commit-ID: 1cydI03WyB8
2017-04-20 13:43:50 +09:00
btian
97ecce399a Bug 1357638 - Use Preferences::AddBoolVarCache() to accelerate dom.forms.inputmode access in IMEStateManager::SetIMEState(), r=masayuki
MozReview-Commit-ID: 8SMud0v3jFr

--HG--
extra : rebase_source : 262b33a1076a3a9c7b6d2d9794221bff756664fc
2017-04-21 14:48:36 +08:00
Masayuki Nakano
fa85dc8ad8 Bug 1337718 part.9 Make IMEStateManager::OnClickInEditor() take const WidgetMouseEvent* instead of nsIDOMMouseEvent* r=m_kato
MozReview-Commit-ID: KdoMcxW8lkT

--HG--
extra : rebase_source : a03316e3a6ca7daf937032f32e00f2a4b2fd23fc
2017-02-08 22:29:14 +09:00
Masayuki Nakano
cee96a2b9a Bug 1337718 part.7 Make IMEStateManager::OnMouseButtonEventInEditor() take WidgetMouseEvent* instead of nsIDOMMouseEvent r=m_kato
MozReview-Commit-ID: FDselwSymZq

--HG--
extra : rebase_source : 211e4f91075d0a93bf10fd82273856010957b3ee
2017-02-08 22:02:49 +09:00
Randell Jesup
8f96069cc5 Bug 1298169: use StaticRefPtr r=masayuki 2016-09-20 01:12:09 -04:00
Masayuki Nakano
f8210c2a4e Bug 1275918 part.2 Update TextComposition::mCompositionStartOffset when it's modified in the remote process r=m_kato
MozReview-Commit-ID: H1SJTWWav6G

--HG--
extra : rebase_source : 6d7d79e7d4d719b720bed4f4c20196079fb8b5fb
2016-06-14 21:06:34 +09:00
Masayuki Nakano
54e57600e1 Bug 1275906 part.2 TextComposition should use IMEContentObserver for sending NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED if the editor which has the composition is in the active IMEContentObserver r=smaug
For sending NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED after the other change notifications which was caused by the user input, we need to use IMEContentObserver::IMENotificationSender because it sends the notifications when it's safe to do it.

This patch makes TextComposition use IMEContentObserver to send the notification.  However, if there is no active IMEContentObserver, e.g., composition events are fired on unfocused window, TextComposition sends it by itself (same as current implementation).

If IMEContentObserver stops observing when it has pending NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED, it cannot send the notification (i.e., it is discarded completely in such case). However, in such case, IMEContentObserver sends NOTIFY_IME_OF_BLUR.  So, anyway, native IME handler should treat the blur notification as it including NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED.

On the other hand, we're buggy if composition events are fired in non-active window.  Even in such case, IMEContentObserver should be created for active editor in each document and it notifies IME of the changes. But this is out of the scope of this bug.

MozReview-Commit-ID: 7Q0ZsJTh4hX

--HG--
extra : rebase_source : 6417f991fa8c0fbe3f25b27bacf4257e5485aecc
2016-06-01 22:14:41 +09:00
Masayuki Nakano
a58a540708 Bug 1251063 PuppetWidget should cache InputContext which is set with SetInputContext() and use it in GetInputContext() only when it is the widget which has active input context in the process r=smaug
PuppetWidget::GetInputContext() needs to communicate with its parent process with synchronous IPC. This is very expensive for focus move.

Currently, IMEStateManager uses nsIWidget::GetInputContext() only for checking the IME enabled state.  Therefore, it's enough to cache input context when nsIWidget::SetInputContext() is called.  Then, we can avoid to communicate with synchronous IPC with PuppetWidget::GetInputContext() in most cases.

This patch makes IMEStateManager stores the last widget which sets input context.  When PuppetWidget uses its input context cache, it should check if it is the last widget to set input context with IMEStateManager since an input context may be shared with other widgets and another one may have update the input context.  I.e., PuppetWidget's input context cache may be already outdated after IMEStateManager sets input context with another widget.

This patch gives up to support retrieving IME open state from child process. However, perhaps, this is not necessary for everybody including add-on developers because the only user of IME open state in child process is nsIDOMWindowUtils. So, add-ons can send IME open state from chrome process instead.  If this decision is wrong, unfortunately, we should support it again in another bug.  It's easy to support with creating another nsIWidget::GetInputContext() or adding additional argument to it.

MozReview-Commit-ID: B2d2CCTsPKj

--HG--
extra : rebase_source : 4117330ba7871753176da960063b612e96f11752
2016-05-28 11:27:56 +09:00
Masayuki Nakano
4d21fa83d0 Bug 1179632 part.6 KeyboardEvent.isComposing shouldn't expose IME state on different document r=smaug 2015-12-04 18:50:43 +09:00
Masayuki Nakano
3d27dcecfa Bug 1179632 part.5 WidgetCompositionEvent::mNativeIMEContext should be used at looking for a TextComposition instance for a WidgetCompositionEvent r=smaug 2015-12-04 18:50:34 +09:00
Robert O'Callahan
7739604da7 Bug 1222092. Don't let sFocusedIMEWidget keep an nsIWidget alive during shutdown. r=masayuki
--HG--
extra : commitid : GsPzx7tAfKb
extra : rebase_source : e202fd334b43956966daa1c7e9297d12c822dfd4
2015-11-13 17:05:54 +13:00
Masayuki Nakano
6a5c380903 Bug 1176955 part.1 TextComposition should guarantee that WidgetSelectionEvent should be handled by same content as the target of composition events when there is a composition r=smaug 2015-07-17 11:25:00 +09:00
Masayuki Nakano
b577b3a7ed Bug 1179122 TextComposition should manage a composition which is even in a child process r=smaug 2015-07-03 11:49:36 +09:00
Masayuki Nakano
9ce25e1e4d Bug 1053053 part.5 Make IMEStateManager::sActiveIMEContentObserver StaticRefPtr r=smaug 2015-07-01 22:19:11 +09:00
Masayuki Nakano
38e32ac3ff Bug 1053053 part.4 Make IMEStateManager::sContent StaticRefPtr r=smaug 2015-07-01 22:19:11 +09:00
Masayuki Nakano
3e2c998faa Bug 1053053 part.3 Notify child process's IMEStateManager of menu key event listener being installed r=smaug 2015-07-01 22:19:11 +09:00
Masayuki Nakano
3a23696fda Bug 1053053 part.2 Notify child process's IMEStateManager of that it should stop manageing IME state r=smaug 2015-07-01 22:19:11 +09:00
Masayuki Nakano
66a78db644 Bug 1053053 part.1 Active TabParent should be managed by IMEStateManager r=smaug 2015-07-01 22:19:11 +09:00
Masayuki Nakano
a6bad653ec Bug 1175392 part.2 IMEStateManager should manage notifications to IME especially delayed notifications from remote process r=smaug 2015-06-27 09:23:31 +09:00
Masayuki Nakano
3dd4837286 Bug 1175392 part.1 IMEContentObserver and TabParent should use IMEStateManager::NotifyIME() r=smaug 2015-06-27 09:23:31 +09:00
Jim Chen
ada45abfc5 bug 1112212 - Set flag in InputContext for IME-unaware webapps; r=masayuki 2015-06-16 19:02:39 -04:00
Masayuki Nakano
29e56f5a88 Bug 1162818 part.6 Don't notify IME of anything during reframing the editor r=smaug 2015-06-05 02:06:10 +09:00
Masayuki Nakano
91298b51a5 Bug 1167022 part.4 Get rid of MozIMEFocus(In|Out) events r=smaug 2015-05-26 16:45:26 +09:00
Masayuki Nakano
f9ae17caea Bug 1167022 part.2 IMEStateManager::UpdateIMEState() should try to restart to observe focused editor when it's reframed r=smaug+nchen 2015-05-26 16:45:26 +09:00
Phil Ringnalda
53b4601f96 Back out 4 changesets (bug 1167022) for reftest-e10s bustage
CLOSED TREE

Backed out changeset de4013b979a7 (bug 1167022)
Backed out changeset b97f76c4be1c (bug 1167022)
Backed out changeset cbc7f8b88a46 (bug 1167022)
Backed out changeset 00b1c04181d3 (bug 1167022)
2015-05-23 21:40:21 -07:00
Masayuki Nakano
bdb3dae876 Bug 1167022 part.4 Get rid of MozIMEFocus(In|Out) events r=smaug 2015-05-24 10:11:37 +09:00
Masayuki Nakano
bbfdde48f6 Bug 1167022 part.2 IMEStateManager::UpdateIMEState() should try to restart to observe focused editor when it's reframed r=smaug+nchen 2015-05-24 10:11:37 +09:00
Andrew McCreight
9e8f4b219e Bug 1152551, part 2 - Fix mode lines in dom/. r=jst 2015-05-03 15:32:37 -04:00
Andrea Marchesini
789ad8312d Bug 1156632 - Remove unused forward class declarations - patch 3 - dom/{events,xbl,xslt,xul} and others, r=ehsan 2015-04-22 08:29:18 +02:00
Ehsan Akhgari
883849ee32 Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj
This patch was automatically generated using the following script:

function convert() {
echo "Converting $1 to $2..."
find . \
       ! -wholename "*/.git*" \
       ! -wholename "obj-ff-dbg*" \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.c" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert MOZ_OVERRIDE override
convert MOZ_FINAL final
2015-03-21 12:28:04 -04:00
Kartikaya Gupta
d8cde2ed0d Bug 1121430 - Back out 4 csets from bug 1112212 for breaking backspace on Android. r=backout 2015-01-15 10:52:05 -05:00
Jim Chen
3817965035 bug 1112212 - Set flag in InputContext for IME-unaware webapps; r=masayuki 2015-01-10 12:41:57 -05:00
Masayuki Nakano
020fd43d35 Bug 1047588 - IMEContentObserver::Init() should take nsIEditor because nsDocShell sometimes hasn't been initialized and nsContentEditor::GetHTMLEditor() fails. r=smaug 2014-11-05 08:12:44 -05:00
Wes Kocher
e005079968 Backed out changeset f86dbba73d43 (bug 1047588) under suspicion of adding a hazard on a CLOSED TREE 2014-11-04 20:25:47 -08:00
Masayuki Nakano
a75c24771c Bug 1047588 IMEContentObserver::Init() should take nsIEditor because nsDocShell sometimes hasn't been initialized and nsContentEditor::GetHTMLEditor() fails r=smaug 2014-11-05 10:36:37 +09:00
Masayuki Nakano
2be456d529 Bug 960871 part.10 Some methods which took both WidgetCompositionEvent and WidgetTextEvent should take only WidgetCompositionEvent r=smaug 2014-10-07 19:01:49 +09:00
Masayuki Nakano
09a5b86212 Bug 960871 part.4 Rename NS_TEXT_TEXT to NS_COMPOSITION_CHANGE and fix comments which mention text events r=smaug 2014-10-07 19:01:47 +09:00
Masayuki Nakano
0cecd2284c Bug 1065835 part.4 Destroy TextComposition instance after handling synthesized compositionend event when synthesized events for a request to commit or cancel is caused by PresShell discarding native compositionend event r=smaug 2014-09-26 09:05:12 +09:00