NPAPI:CocoaCompositionClarification: Difference between revisions

 
(19 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= Status =
= Status =


Under consideration.
Accepted, ready for implementation.


= Contributors =
= Contributors =


* Last modified: November 16, 2010
* Last modified: January 18, 2011
* Authors: Josh Aas (Mozilla)
* Authors: Josh Aas (Mozilla)
* Contributors: Stuart Morgan (Google)
* Contributors: Stuart Morgan (Google)
Line 11: Line 11:
= Overview =
= Overview =


This proposal modifies the existing Cocoa NPAPI specification ([[NPAPI:CocoaEventModel]]). After a plugin returns "kNPEventStartIME" for a "NPCocoaEventKeyDown" event the plugin has no way of knowing that it should start handling key events again if IME input is canceled by the browser and no "NPCocoaEventTextInput" is sent.
This proposal modifies the existing Cocoa NPAPI specification ([[NPAPI:CocoaEventModel]]). Under the current specification plugins receive key events during complex text composition but do not have a reliable way to know whether or not key events are intended for use in the composition. Since composition can be canceled by the user or the browser plugins cannot assume that composition is in progress until they receive an 'NPCocoaEventTextInput' event.


= Specification Change =
= Specification Change =


In order to provide the plugin with information about whether or not there is a complex text composition in progress we will bump the 'NPCocoaEvent' version to '2'. If a plugin receives an 'NPCocoaEvent' with a version of '2' or higher then the key structure will contain a field of type 'NPBool' called 'compositionInProgress'. This will be set to false when no composition is in progress and true when a composition is in progress.
The original "Text Input" section stated:


When 'compositionInProgress' there is not necessarily an input method window open. For example, consider the last key press for a composition which is typically the "enter" key. The sequence of events resulting from that physical key press might be:
"During complex text input the browser will continue to send regular key events. So long as the plugin still wants complex text input (which may result in a NPCocoaEventTextInput event being sent) it should continue to return kNPEventStartIME for NPCocoaEventKeyDown. If a plugin returns anything other than kNPEventStartIME for NPCocoaEventKeyDown then complex text input will be canceled."


1. Input method window closes.
This has been changed. See the current "Text Input" section of the [[NPAPI:CocoaEventModel|Cocoa event model spec]] for the updated version.
2. Plugin receives 'NPCocoaEventKeyDown' event for enter key with 'compositionInProgress' set to true.
3. Plugin receives 'NPCocoaEventTextInput' for completed composition.
4. Plugin receives 'NPCocoaEventKeyUp' event for enter key with 'compositionInProgress' set to false.
 
Another situation might be one in which returning "kNPEventStartIME" for a 'NPCocoaEventKeyDown' event does not open an input method window. In this case the sequence of events would look like:
 
1. Plugin receives 'NPCocoaEventKeyDown' event for 'g' key with 'compositionInProgress' set to true.
2. Plugin receives 'NPCocoaEventTextInput' for completed composition, the string "g".

Latest revision as of 23:59, 20 January 2011

Status

Accepted, ready for implementation.

Contributors

  • Last modified: January 18, 2011
  • Authors: Josh Aas (Mozilla)
  • Contributors: Stuart Morgan (Google)

Overview

This proposal modifies the existing Cocoa NPAPI specification (NPAPI:CocoaEventModel). Under the current specification plugins receive key events during complex text composition but do not have a reliable way to know whether or not key events are intended for use in the composition. Since composition can be canceled by the user or the browser plugins cannot assume that composition is in progress until they receive an 'NPCocoaEventTextInput' event.

Specification Change

The original "Text Input" section stated:

"During complex text input the browser will continue to send regular key events. So long as the plugin still wants complex text input (which may result in a NPCocoaEventTextInput event being sent) it should continue to return kNPEventStartIME for NPCocoaEventKeyDown. If a plugin returns anything other than kNPEventStartIME for NPCocoaEventKeyDown then complex text input will be canceled."

This has been changed. See the current "Text Input" section of the Cocoa event model spec for the updated version.