NPAPI:CocoaCompositionClarification

From MozillaWiki
Revision as of 09:36, 28 November 2010 by Josh (talk | contribs) (→‎Open Questions)
Jump to navigation Jump to search

Status

Under consideration.

Contributors

  • Last modified: November 28, 2010
  • Authors: Josh Aas (Mozilla)
  • Contributors: Stuart Morgan (Google)

Overview

This proposal modifies the existing Cocoa NPAPI specification (NPAPI:CocoaEventModel). Plugins need a way to know when complex text composition (started by returning 'kNPEventStartIME' for an 'NPCocoaEventKeyDown' event) has been canceled by the user or the browser. Plugins receive key events during composition and without this extension they cannot tell in-composition key events from post-composition key events unless a composition completes and results in an 'NPCocoaEventTextInput' event.

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'. The 'compositionInProgress' field is only valid for 'NPCocoaEventKeyDown' events. It will be set to false when no composition is in progress and true when a composition is in progress.

Open Questions

  • An alternative solution would be to specify that once composition is started it will always result in an 'NPCocoaEventTextInput' event and canceled compositions will simply result in an 'NPCocoaEventTextInput' event with an empty string. Unlike the currently proposed solution this has the downside of potential backwards-compatibility issues. Adobe Flash?