Closed Bug 1172219 Opened 9 years ago Closed 9 years ago

[TSF][TS_E_NOLAYOUT][e10s] nsTextStore should put off to send notifications to TSF if it's dispatching composition events but hasn't received update composition notification

Categories

(Core :: Widget: Win32, defect)

x86
Windows
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla41
Tracking Status
e10s + ---
firefox41 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

(Blocks 1 open bug)

Details

(Keywords: inputmethod)

Attachments

(3 files)

According to TSF spec, we can put off to answer GetTextExt() until our layout is completely prepared. So, I think that after NS_COMPOSITION_CHANGE, the layout may not be accessible especially in e10s mode. When ContentCache in TabParent is modified, widget should be notified the timing. Then, nsTextStore can notify TSF os layout change, text change and selection change.

This is experimental. I guess that some TIP might not work well. However, I believe that this is right approach for TSF.
Summary: [TSF}[e10s] nsTextStore should return TS_E_NOLAYOUT after dispatching NS_COMPOSITION_CHANGE and before NOTIFY_IME_OF_COMPOSITION_UPDATE or something is notified → [TSF][e10s] nsTextStore should return TS_E_NOLAYOUT after dispatching NS_COMPOSITION_CHANGE and before NOTIFY_IME_OF_COMPOSITION_UPDATE or something is notified
Currently, IMEContentObserver sends notifications to IME only when it's safe to receive query content events and dispatch composition events. When it's run in e10s mode, TabParent may send notifications to widget which is received from PuppetWidget in remote process.

However, if there is a bug, nsTextStore will send some notifications to TSF when content is not available. If that occurs, TSF may be confused and stop working. For avoiding the worst scenario, nsTextStore should have another wall to block to send notifications when it's not safe.

This patch makes nsTextStore stores received notifications and flush them when it's safe to do that.
Attachment #8622353 - Flags: review?(VYV03354)
Putting off layout change notifications may TSF believe that Gecko doesn't have layout. So, we should notify TSF of creating layout when nsTextStore is created (i.e., a text editor gets focus).
Attachment #8622354 - Flags: review?(VYV03354)
Additional patch for improving selection cache performance.

Now, selection change notification has new selection range. So, nsTextStore should use it instead of marking the selection dirty.
Attachment #8622356 - Flags: review?(VYV03354)
I gave up to return TS_E_NOLAYOUT after dispatching composition event and before receving NOTIFY_IME_OF_LAYOUT_CHANGE or NOTIFY_IME_OF_COMPOSITION_UPDATE because the TSF's bug around TS_E_NOLAYOUT and known TIPs do not work with such behavior...
Summary: [TSF][e10s] nsTextStore should return TS_E_NOLAYOUT after dispatching NS_COMPOSITION_CHANGE and before NOTIFY_IME_OF_COMPOSITION_UPDATE or something is notified → [TSF][e10s] nsTextStore should put off to send notifications to TSF if it's dispatching composition events but hasn't received update composition notification
Comment on attachment 8622353 [details] [diff] [review]
part.1 nsTextStore should notify IME of anything while events are being dispatched which may be handled asynchronously

Review of attachment 8622353 [details] [diff] [review]:
-----------------------------------------------------------------

::: widget/windows/nsTextStore.cpp
@@ +1767,5 @@
> +           ("TSF: 0x%p   nsTextStore::MaybeFlushPendingNotifications(), "
> +            "putting off flushing pending notifications due to being the "
> +            "document locked...", this));
> +    return;
> +  }

Please add
if (mPendingDestroy) {
  Destroy();
  return;
}
here. Then you can avoid !mPendingDestroy checks below.

::: widget/windows/nsTextStore.h
@@ +786,5 @@
> +  // we shouldn't query layout information.  However, TS_E_NOLAYOUT bugs of
> +  // ITextStoreAPC::GetTextExt() blocks us to behave ideally.
> +  // For preventing it to be called, we should put off notifying TSF of
> +  // anything until layout information becomes available.
> +  bool                         mPutOffNotifyingTSF;

Could you use a word "delay" or something? Phrasal verbs are hard to understand for non-native speakers (at least for me).
Attachment #8622353 - Flags: review?(VYV03354) → review+
Attachment #8622354 - Flags: review?(VYV03354) → review+
Attachment #8622356 - Flags: review?(VYV03354) → review+
Comment on attachment 8622353 [details] [diff] [review]
part.1 nsTextStore should notify IME of anything while events are being dispatched which may be handled asynchronously

> nsTextStore should notify IME of anything while events are being
> dispatched which may be handled asynchronously

By the way, I failed to parse this sentence. Could make the wording something better?
Summary: [TSF][e10s] nsTextStore should put off to send notifications to TSF if it's dispatching composition events but hasn't received update composition notification → [TSF][TS_E_NOLAYOUT][e10s] nsTextStore should put off to send notifications to TSF if it's dispatching composition events but hasn't received update composition notification
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: