Re: exposing underlining mechanism for IME?

On Fri, Nov 6, 2015 at 8:21 AM, David Young <dyoung@pobox.com> wrote:

> On Fri, Nov 06, 2015 at 07:32:58AM +0100, Johannes Wilm wrote:
> > Hey,
> > looking at some files around IME in blink's source code. The code for
> > markers (spelling, composition) looks interesting. Are there security
> > concerns that make us not expose those to JS? If so, what concerns are
> > those?
> >
> > It seems like the main problem problem for IME is figuring out what is a
> > candidate text (what is underlined), what is committed. Candidate text is
> > already part of the DOM, so for us who look at the DOM from the
> perspective
> > of JavaScript, it makes it all really difficult to deal with, and for
> those
> > working in the browser world everything is getting more complex when we
> try
> > to do anything unpredicted in JS because you then need to make sure that
> > your underlining mechanism works correctly.
> >
> > But what if we exposed something like
> >
> > addCompositionMarker(range,color,thickness,backgroundColor)
>
> Say that the editor's author decides that underline and thickness do not
> apply?



Ah, sorry, I think I understood you now. You mean that it will only have a
background color, as is typical on Mac OS X and some other systems in the
examples you showed below, correct?

Sure. If the JS editor author uses the default IME settings, it will simply
set the thickness of the line to 0 and the background color to the tone of
yellow commonly used. The color of the now invisible underline does not
really matter.

I assume that setting the line thickness to zero is what it will do by
default currently when marking such composition sections.

If instead the JS editor author decides to use his/her own values and
she/he wants to emulate the way it is done on those systems that don't have
an underline, he simply sets the thickness to zero manually and the
background color to something appropriate.





> Is something like this not possible, where the editor JavaScript
> would activate the composition style on the composition-start event, and
> deactivate the style when the -end event arrived?
>
> Example 1: enter a "naked" accent
>
>         user key commands               JavaScript events
>         -----------------               -----------------
>         Option-E
>                                         composition start
>                                         insert ´
>         E
>                                         delete backward 1
>                                         insert é
>                                         composition end
>
> Example 2: enter accented e (é)
>
>         user key commands               JavaScript events
>         -----------------               -----------------
>         Option-E
>                                         composition start
>                                         insert ´
>         Space bar
>                                         composition end
>
> Dave
>
> --
> David Young
> dyoung@pobox.com    Urbana, IL    (217) 721-9981
>
>


-- 
Johannes Wilm
Fidus Writer
http://www.fiduswriter.org

Received on Friday, 6 November 2015 08:25:29 UTC