Closed Bug 543398 Opened 14 years ago Closed 14 years ago

Drop nsTextEventReply and nsIPrivateCompositionEvent

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.3a5

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

Attachments

(1 file, 2 obsolete files)

Attached patch Patch v1.0 (obsolete) — Splinter Review
After bug 520732, we can drop nsTextEventReply and nsIPrivateCompositionEvent.

See also bug 528435.
After I fix this bug, we can:

* drop nsIPlaintextEditor::eEditorUseAsyncUpdatesMask
* drop nsCompositionEvent by replacing to nsInputEvent

and also we might be able to drop nsIPrivateTextEvent and  nsIPrivateTextRangeList because we can access to the information by nsIPrivateDOMEvent::GetInternalNSEvent() safely.
Why we can drop nsIPlaintextEditor::eEditorUseAsyncUpdatesMask?
Textformcontrol uses it in nsTextControlFrame::SetValue for performance
reasons.
(In reply to comment #2)
> Why we can drop nsIPlaintextEditor::eEditorUseAsyncUpdatesMask?
> Textformcontrol uses it in nsTextControlFrame::SetValue for performance
> reasons.

Looks like the synchronous mode is only needed for IME which will be dropped by this patch. So, I guess that nsEditor won't need the synchronous mode. If some code need the synchronous mode, cannot they use FlushPendingNotifications instead?

The flags are only referred from:
http://mxr.mozilla.org/mozilla-central/source/editor/libeditor/base/nsEditor.cpp#4411
http://mxr.mozilla.org/mozilla-central/source/editor/libeditor/base/nsEditor.cpp#2545
At least at the moment textcontrolframe uses sync mode normally:
see http://mxr.mozilla.org/mozilla-central/source/layout/forms/nsTextControlFrame.cpp#1395

::SetValue is exception.
Thank you for the point.

Looks like when an editor is modified, it should be updated immediately. Otherwise, asynchronous mode is enough, probably. However, such change isn't small, I guess. So, I won't work for it, please ignore that. Thanks.
Attached patch Patch v2.0 (obsolete) — Splinter Review
Attachment #424539 - Attachment is obsolete: true
Attachment #433685 - Flags: review?(Olli.Pettay)
Could you explain the patch a bit, especially why the following isn't valid 
anymore - why we don't need the coordinates anymore?
- // XXX The IME stuff needs caret coordinates
- // XXX_kin: synchronously, but the editor could be using async
- // XXX_kin: updates (reflows and paints) for performance reasons.
- // XXX_kin: In order to give IME what it needs, we have to temporarily
- // XXX_kin: switch to sync updating during this call so that the
- // XXX_kin: nsAutoUpdateViewBatch can force sync reflows and paints
- // XXX_kin: so that we get back accurate caret coordinates.
Sorry.

1. Currently, widget can query the caret position (or other character rect) at anytime. So, the event reply isn't needed right now. Therefore, editor don't need to asynchronous update for the caret position at the beginning a composition.

2. IME will query the caret position or first character rect or something. Then, our query event flush the pending reflow.
(In reply to comment #8)
> Sorry.
> 
> 1. Currently, widget can query the caret position (or other character rect) at
> anytime. So, the event reply isn't needed right now. Therefore, editor don't
> need to asynchronous update for the caret position at the beginning a
> composition.
Editor has *synchronous* update for the caret position.
So currently widget can do synchronous query for the caret position?
And that does flush the layout or something?

> 2. IME will query the caret position or first character rect or something.
> Then, our query event flush the pending reflow.
So when IME queries caret position, there is a flush. Ok, sounds good.
(In reply to comment #9)
> (In reply to comment #8)
> > Sorry.
> > 
> > 1. Currently, widget can query the caret position (or other character rect) at
> > anytime. So, the event reply isn't needed right now. Therefore, editor don't
> > need to asynchronous update for the caret position at the beginning a
> > composition.
> Editor has *synchronous* update for the caret position.

Ah, I meant "synchronous", sorry.

> So currently widget can do synchronous query for the caret position?
> And that does flush the layout or something?

The query content event flush layout forcedly.

http://mxr.mozilla.org/mozilla-central/source/content/events/src/nsContentEventHandler.cpp#87

So, the widget can do synchronous query.
Comment on attachment 433685 [details] [diff] [review]
Patch v2.0

I assume you have tested this on all platforms.
Attachment #433685 - Flags: review?(Olli.Pettay) → review+
Attachment #433685 - Flags: superreview?(roc)
Attachment #433685 - Flags: superreview?(roc) → superreview+
Attached patch Patch v2.0.1Splinter Review
merged to latest trunk.
Attachment #433685 - Attachment is obsolete: true
http://hg.mozilla.org/mozilla-central/rev/bd0b0915864b
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a5
Depends on: 613810
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: