Commit Graph

69 Commits

Author SHA1 Message Date
Masayuki Nakano
141de4c2d1 Bug 1304620 part.5 ContentCacheInParent should store the latest composition start offset with mCompositionStartInChild r=m_kato
When ContentCacheInParent receives eCompositionStart, it temporarily sets mCompositionStart to selection start offset.  However, if there is a composition in the remote process, the selection start is caret position in the composition string.  Therefore, it's not useful information.  Instead, the composition start offset should be used because around there are a lot of information.

For that, ContentCacheInParent should always store compostion start offset in the remote process with mCompositionStartInChild even if mWidgetHasComposition is false.  And when it receives eCompositionStart, mCompositionStart should be set to mCompositionStartInChild.

MozReview-Commit-ID: DksPNEsi6Ec

--HG--
extra : rebase_source : bcf2946273d24a4c37c33fa18a321660115e3fb6
2016-10-12 21:52:01 +09:00
Masayuki Nakano
610b4b4a2e Bug 1304620 part.4 ContentCacheInParent::mCompositionStart should be set to better value for mWidgetHasComposition state r=m_kato
ContentCacheInParent::mCompositionStart was set to ContentCacheInChild::mCompositionStart without any check.  However, that's clearly wrong approach.  For example, when the remote process handles some composition events after eCompositionCommit(AsIs) in the parent process, mCompositionStart is valid offset even after mWidgetHasComposition is set to false.  Similarly, even after parent process sends eCompositionStart, the remote process may send invalid offset for mCompositionStart due to no composition in it.

For solving this issue, ContentCacheInParent should check mWidgetHasComposition.

If it's true and coming offset is valid, let's use it (even if mPendingCompositionCount is 2 or bigger since widget shouldn't use WidgetQueryContentEvent when there are some pending events).

If the coming offset is invalid but mWidgetHasComposition is false, let's use selection start instead because HandleQueryContentEvent() can work around selection start offset only.

Otherwise, i.e., mWidgetHasComposition is false, we should always set mCompositionStart to invalid offset.

MozReview-Commit-ID: IONU0Cbhpil

--HG--
extra : rebase_source : 05ae9eb0e7a0bb63b65be7a54103eb798274c8ff
2016-10-12 22:05:09 +09:00
Masayuki Nakano
7a5e29e854 Bug 1304620 part.3 The start offset of TextComposition instance in the parent process shouldn't be updated with older composition in the remote process r=m_kato
When ContentCacheInParent receives content information from the remote process, it notifies TextComposition of the latest composition start offset in the remote process.  However, the information may be older composition's, i.e., the composition was already committed in the process but is still being handled by the remote process.  TextComposition shouldn't work with such obsolete information.

Note that TextComposition instance is created and destroyed when WidgetCompostionEvent is handled by IMEStateManager.  Then, TextComposition instance guarantees that all following composition events for a composition are sent to same EventTarget (including TabParent).  So, TextComposition is always synced with a composition in widget.

MozReview-Commit-ID: 78NuvpE2rPx

--HG--
extra : rebase_source : 3ffbf2513750f4b940bfedd19a8b191f28611115
2016-10-12 22:03:16 +09:00
Masayuki Nakano
06d6d7a752 Bug 1304620 part.2 ContentCacheInParent should manage if there is pending composition in the remote process r=m_kato
If the remote process is busy or user restarts composition too quickly, there could be 2 or more compositions in ContentCache.  For managing such case, ContentCacheInParent should manage the pending composition count which is increased at dispatching eCompositionStart event to the remote process and decreased at receiving eCompositionCommit(AsIs) event from the remote process.

MozReview-Commit-ID: KbTsK20NEZD

--HG--
extra : rebase_source : 428b14646ccde190b446b5c820e0e84866a855f2
2016-10-12 17:09:02 +09:00
Masayuki Nakano
e9727adbec Bug 1304620 part.1 Rename ContentCacheInParent::mIsComposing to mWidgetHasComposition r=m_kato
For making the meaning of ContentCacheInParent::mIsComposing clearer, let's rename it to mWidgetHasComposition.  It becomes true when the parent process sends eCompositionStart to the remote process and false when the parent process sends eCompositionCommit(AsIs).  So, it represents if the widget (i.e., the native IME handler in the chrome process) has composition.

MozReview-Commit-ID: 5k05IXMgJxw

--HG--
extra : rebase_source : 69be70f22fb9b9dd6125ce390026b0740bd6de8f
2016-10-12 16:42:28 +09:00
Nicholas Nethercote
34dcc7b852 Bug 1299384 - Use MOZ_MUST_USE with NS_warn_if_impl(). r=erahm.
This change avoids lots of false positives for Coverity's CHECKED_RETURN
warning, caused by NS_WARN_IF's current use in both statement-style and
expression-style.

In the case where the code within the NS_WARN_IF has side-effects, I made the
following change.

> NS_WARN_IF(NS_FAILED(FunctionWithSideEffects()));
> -->
> Unused << NS_WARN_IF(NS_FAILED(FunctionWithSideEffects()));

In the case where the code within the NS_WARN_IF lacks side-effects, I made the
following change.

> NS_WARN_IF(!condWithoutSideEffects);
> -->
> NS_WARNING_ASSERTION(condWithoutSideEffects, "msg");

This has two improvements.
- The condition is not evaluated in non-debug builds.
- The sense of the condition is inverted to the familiar "this condition should
  be true" sense used in assertions.

A common variation on the side-effect-free case is the following.

> nsresult rv = Fn();
> NS_WARN_IF_(NS_FAILED(rv));
> -->
> DebugOnly<nsresult rv> = Fn();
> NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "Fn failed");

--HG--
extra : rebase_source : 58788245021096efa8372a9dc1d597a611d45611
2016-09-02 17:12:24 +10:00
Masayuki Nakano
e48dbcc546 Bug 1291082 part.3 ContentCache::TextRectArray::GetUnionRectAsFarAsPossible() should avoid crash by itself r=m_kato
ContentCache::TextRectArray::GetUnionRectAsFarAsPossible() should avoid crash by itself even if it's caller's bug. This makes parent process more stable, that is what one of the purpose of e10s is.

MozReview-Commit-ID: qKAfvm6eZw
2016-08-17 00:15:44 +09:00
Masayuki Nakano
598dee428f Bug 1257446 part.1 ContentCache should store previous character of selection r=m_kato
This patch makes ContentCache store previous character's rect of selection anchor and selection focus because if caret is at end of a line, IME may query the last character of the line.

MozReview-Commit-ID: 5X1K8KtrYfl

--HG--
extra : rebase_source : 403e4c993b48a832d50b4f44738c5b5c6d5ce085
2016-07-22 20:47:51 +09:00
Masayuki Nakano
d5bace6236 Bug 1257446 part.0 ContentCacheInParent::HandleQueryContentEvent() should log the cause of failure when it makes the event's input offset absolute r=m_kato
MozReview-Commit-ID: JVGHPQ5gC3G

--HG--
extra : rebase_source : 77d541f21b78b4270c109f2a4e9db59c19129e03
2016-07-12 17:44:44 +09:00
Masayuki Nakano
ddf5f8fb25 Bug 1291082 ContentCacheInParent::GetUnionTextRects() shouldn't use mTextRectArray when it's empty r=m_kato
This must be able to reproduce with some IMEs which creates 0 length composition string.  In such case, mTextRectArray isn't available, but mTextRectArray.GetUnionRectAsFarAsPossible() always assumes that it's valid and has at least one rect.  Therefore, it can meet this crash.

Therefore, this patch makes that ContentCacheInParent::GetUnionTextRects() not use mTextRectArray when it's not valid nor doesn't have rects.

MozReview-Commit-ID: 2yLMo4lxI3Z

--HG--
extra : rebase_source : 3ef3f2c6ba6473fd3eefbd5c909c1ef6c51c76af
2016-08-02 12:02:14 +09:00
Masayuki Nakano
1373da05f3 Bug 1286489 TSFTextStore.cpp and ContentCache.cpp shouldn't put \n, \r and \t to log file directly r=m_kato
MozReview-Commit-ID: 630lZINQteb

--HG--
extra : rebase_source : 9841cfdb199d1a7964d1ad4516d9862f498b0f39
2016-07-13 18:16:04 +09:00
Masayuki Nakano
3bba9b37d5 Bug 1284422 part.9 Remove "ContentCache(InParent|InChild)?: " from log of ContentCache.cpp since the classes are not in same process under current design r=m_kato
MozReview-Commit-ID: LwDBBwfkZKx

--HG--
extra : rebase_source : 1944e40a55bcc3de83fa4a309b0090ec87b766f9
2016-07-05 18:56:18 +09:00
Makoto Kato
c603b26d13 Bug 1203871 - Part 5. Use mozilla::Move for rect array. r=masayuki
To optimize copy of text rect array, we should use mozilla::Move.  Also, after using it, we should mark is invalid result into SetEventResult

MozReview-Commit-ID: HH9H7DhK12

--HG--
extra : rebase_source : 4e02ece73583306c386597bc92e203fa147cfcbc
extra : histedit_source : 726621cdaf262b9d173ae19d505575f10563cc36
2016-06-14 16:52:31 +01:00
Makoto Kato
8e42cbc802 Bug 1203871 - Part 3. Use eQueryTextRectArray on ContentCache for e10s. r=masayuki
Use new event to update cotent process's cache.

MozReview-Commit-ID: CexTXW4knMQ

--HG--
extra : rebase_source : 525a8b0a1fe6ef533e06f76ac5156e264b158c70
extra : histedit_source : 2a8c46a64eb5c6a7a05adc28917422c488b2b1c4
2016-03-14 16:03:31 +09:00
Masayuki Nakano
e195616e12 Bug 1280182 ContentCache should return non-empty rect as far as possible if query content event is relative to insertion point r=m_kato
ContentCache may store composition string's rects which are inserted by one or more older composition event.  Even in such case, native IME, especially TIP of TSF, expects non-empty rects.

Therefore, if native IME handler uses "insertion point relative query", ContentCache should return non-empty rect as far as possible.  For example, even if query offset or range is not in its rect array of composition string, ContentCache should adjust the offset into the stored range.

MozReview-Commit-ID: 7hcIqxOWFk2

--HG--
extra : rebase_source : 8b1572e01cc56e5596ffba4eac0f7d5818b85a89
2016-06-22 14:16:59 +09:00
Masayuki Nakano
02e3dc2d1b Bug 1275528 part.3 Support selection relative WidgetQueryContentEvent in e10s mode r=m_kato
In e10s mode and during focus is in a remote process, ContentCache handles WidgetQueryContentEvent instead of ContentEventHandler.  Therefore, for supporting selection relative WidgetQueryContentEvent in e10s mode, we need to support it in ContentCache too.

MozReview-Commit-ID: L5d5ilmpetG

--HG--
extra : rebase_source : 46d646677ac0a5803398d18efbfd667bc3bf0c17
2016-06-14 20:54:54 +09: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
50a7dd324b Bug 1275918 part.1 ContentCache should retrieve the latest composition start offset from TextComposition and send it to the parent process r=m_kato
MozReview-Commit-ID: EoMZtqoMue3

--HG--
extra : rebase_source : c4a60248e765cddeccd1be3607f80358a99dda34
2016-06-13 18:17:58 +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
Masayuki Nakano
07b6f24132 Bug 1259657 Rename WidgetGUIEvent::widget to WidgetGUIEvent::mWidget r=smaug
MozReview-Commit-ID: 167PQWJDEHW

--HG--
extra : rebase_source : 6cd44095b9f33e03190972f043087786cbd772f2
2016-04-14 17:03:14 +09:00
Makoto Kato
b4dbd36b25 Bug 1208944 - Part 8. Don't get selection on start compostion when plugin has foucs. r=masayuki 2015-12-29 22:57:38 +09:00
Sebastian Hengst
e082884d78 Backed out 15 changesets (bug 1208944) for failing tests M(2,5) on OSX. r=backout
Backed out changeset c29de223de2f (bug 1208944)
Backed out changeset 3d99da255be1 (bug 1209844)
Backed out changeset 3c915942af38 (bug 1209844)
Backed out changeset 759b425b5503 (bug 1208944)
Backed out changeset bf73cf8f0fda (bug 1208944)
Backed out changeset 0e337d912b7d (bug 1208944)
Backed out changeset 31c47f2980b5 (bug 1208944)
Backed out changeset 3e0d70a6e809 (bug 1208944)
Backed out changeset 7685dcb63e5f (bug 1208944)
Backed out changeset 3c2b9372dd36 (bug 1208944)
Backed out changeset 18160d306493 (bug 1208944)
Backed out changeset 4974e397b655 (bug 1208944)
Backed out changeset fde7e439844d (bug 1208944)
Backed out changeset 4213a355fbdc (bug 1208944)
Backed out changeset 33cfddbbf5f2 (bug 1208944)
2015-12-29 17:42:02 +01:00
Makoto Kato
d7699eb987 Bug 1208944 - Part 8. Don't get selection on start compostion when plugin has foucs. r=masayuki 2015-12-29 22:57:38 +09:00
Masayuki Nakano
6a05ca7e0d Bug 1179632 part.4 Clean up the code to request IME to commit composition across process boundary r=smaug 2015-12-11 15:15:58 +09:00
Nathan Froyd
01583602a9 Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat
The bulk of this commit was generated with a script, executed at the top
level of a typical source code checkout.  The only non-machine-generated
part was modifying MFBT's moz.build to reflect the new naming.

CLOSED TREE makes big refactorings like this a piece of cake.

 # The main substitution.
find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    xargs perl -p -i -e '
 s/nsRefPtr\.h/RefPtr\.h/g; # handle includes
 s/nsRefPtr ?</RefPtr</g;   # handle declarations and variables
'

 # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h.
perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h

 # Handle nsRefPtr.h itself, a couple places that define constructors
 # from nsRefPtr, and code generators specially.  We do this here, rather
 # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename
 # things like nsRefPtrHashtable.
perl -p -i -e 's/nsRefPtr/RefPtr/g' \
     mfbt/nsRefPtr.h \
     xpcom/glue/nsCOMPtr.h \
     xpcom/base/OwningNonNull.h \
     ipc/ipdl/ipdl/lower.py \
     ipc/ipdl/ipdl/builtin.py \
     dom/bindings/Codegen.py \
     python/lldbutils/lldbutils/utils.py

 # In our indiscriminate substitution above, we renamed
 # nsRefPtrGetterAddRefs, the class behind getter_AddRefs.  Fix that up.
find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \
    xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g'

if [ -d .git ]; then
    git mv mfbt/nsRefPtr.h mfbt/RefPtr.h
else
    hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h
fi

--HG--
rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 01:24:48 -04:00
Masayuki Nakano
ce885416ed Bug 1204439 part.3 Create methods to get enum item name r=smaug 2015-09-17 12:05:44 +09:00
Masayuki Nakano
888b2103ea Bug 895274 part.194 Rename NS_COMPOSITION_COMMIT to eCompositionCommit r=smaug 2015-09-11 21:21:27 +09:00
Masayuki Nakano
ed4dac1ca6 Bug 895274 part.193 Rename NS_COMPOSITION_CHANGE to eCompositionChange r=smaug 2015-09-11 21:21:27 +09:00
Masayuki Nakano
1e538fa11e Bug 895274 part.192 Rename NS_COMPOSITION_UPDATE to eCompositionUpdate r=smaug 2015-09-11 21:21:27 +09:00
Masayuki Nakano
ebdc7bd69b Bug 895274 part.191 Rename NS_COMPOSITION_END to eCompositionEnd r=smaug 2015-09-11 21:21:27 +09:00
Masayuki Nakano
0f2bfad9b1 Bug 895274 part.190 Rename NS_COMPOSITION_START to eCompositionStart r=smaug 2015-09-11 21:21:27 +09:00
Masayuki Nakano
966f685af3 Bug 895274 part.188 Rename NS_COMPOSITION_COMMIT_AS_IS to eCompositionCommitAsIs r=smaug 2015-09-11 21:21:26 +09:00
Masayuki Nakano
1d6a202900 Bug 895274 part.187 Rename NS_QUERY_TEXT_RECT to eQueryTextRect r=smaug 2015-09-11 21:21:26 +09:00
Masayuki Nakano
bb413ca230 Bug 895274 part.155 Rename NS_QUERY_EDITOR_RECT to eQueryEditorRect r=smaug 2015-09-10 10:40:06 +09:00
Masayuki Nakano
4a34ce078a Bug 895274 part.154 Rename NS_QUERY_CARET_RECT to eQueryCaretRect r=smaug 2015-09-10 10:40:06 +09:00
Masayuki Nakano
e463292274 Bug 895274 part.153 Rename NS_QUERY_TEXT_CONTENT to eQueryTextContent r=smaug 2015-09-10 10:40:05 +09:00
Masayuki Nakano
a8fd5ffc76 Bug 895274 part.152 Rename NS_QUERY_SELECTED_TEXT to eQuerySelectedText r=smaug 2015-09-10 10:40:05 +09:00
Masayuki Nakano
d177b04a17 Bug 895274 part.145 Rename NS_SELECTION_SET to eSetSelection r=smaug 2015-09-08 23:33:38 +09:00
Masayuki Nakano
0d22745cda Bug 895274 part.3 Make the enum of event messages a named enum IGNORE IDL r=smaug 2015-08-26 21:56:59 +09:00
Masayuki Nakano
66f2c27305 Bug 895274 part.1 Rename WidgetEvent::message to WidgetEvent::mMessage r=smaug 2015-08-22 10:34:51 +09:00
Bobby Holley
97b9240b34 Bug 1188696 - Hoist nsRefPtr.h into MFBT. r=froydnj 2015-07-29 10:44:59 -07:00
Masayuki Nakano
9906797f75 Bug 1185316 TabParent should flush pending IME notifications after child process handles all sending events r=smaug 2015-07-22 14:51:36 +09:00
Masayuki Nakano
a2baa83320 Bug 1184986 NOTIFY_IME_OF_POSITION_CHANGE should be put off until all sending events are recieved by child process r=smaug 2015-07-22 14:15:06 +09:00
Masayuki Nakano
0265f6a476 Bug 1184004 part.3 IPC methods to notify IME should use IMENotification for its argument r=smaug 2015-07-17 13:30:01 +09:00
Masayuki Nakano
500bdf163d Bug 1176954 part.8 ContentCacheInParent::OnEventNeedingAckReceived() should log the event message r=smaug 2015-07-11 10:53:56 +09:00
Masayuki Nakano
69720d0ea0 Bug 1176954 part.3 Don't send selection change, text change nor composition update notification to IME from TabParent until all events sent to the child process is received by it r=smaug 2015-07-11 10:53:55 +09:00
Masayuki Nakano
d35ea2b72d Bug 1176954 part.2 ContentCache in parent process should manage how many events are sent but not yet received r=smaug 2015-07-11 10:53:55 +09:00
Makoto Kato
e7d7a10538 Bug 1179695 - Remove mWasAsync from WidgetQueryContentEvent. r=masayuki,nchen 2015-07-09 15:09:56 +09:00
Masayuki Nakano
8750e33449 Bug 1177388 Create ContentCacheInParent and ContentCacheInChild for making their purpose clearer r=m_kato 2015-06-26 08:21:13 +09:00
Masayuki Nakano
729d547dd5 Bug 1173678 ContentCache should return union rect even if some character rects are not cached but the first character of the range is cached r=m_kato 2015-06-17 10:03:58 +09:00