Re: exposing underlining mechanism for IME?

On Fri, Nov 6, 2015 at 7:18 PM, David Young <dyoung@pobox.com> wrote:

> On Fri, Nov 06, 2015 at 08:51:47AM +0100, Johannes Wilm wrote:
> >  So the way you would handle those in cE=events would be:
> >
> > 1. compositionstart event. JS registers this and knows it will add
> markers
> > to everything until the compositionend event.
> >
> > 2. beforeInput{editType: insertCharacter, isComposition: true, data :
> 'ยด'}
> > event. JS inserts the accent into the DOM where it wants, then marks the
> > character using addCompositionMarker.
> >
> > 3. compositionend event. JS decides the DOM is fine as it is and it
> removes
> > the composition marker by running something like
> > deleteCompositionMarker(range) over the characters that came out of the
> > composition.
>
> Sure, but I am a bit uneasy with addCompositionMarker.  Seems like
> there could be more properties involved than underline thickness,
> foreground and background color.


thickness, color and backgroundColor are the values used in the browser
code for markers. I didn't see foreground color. So unless there is some
other code somewhere else that I haven't seen, those three properties seem
to cover everything browsers need to do for IME marking as of November
2015. :)


> What if, instead, there was an API
> function that returned the CSS property-value pairs for a composition
> candidate---getCompositionStyle()?  The the editor could apply the
> style, modify it, or ignore it, according to the author's preference.
>

Well, first of all it is really hard for us to underline part of a text
node using only CSS.

Secondly, we often run into security issues. For example, we are not
allowed to get access to the spell checker. And I believe we are not
allowed to know where CJK words end and start. Giving the JS access to
information about the styling options of the current IME would give us more
information than we had previously about the user (certain colors and line
thicknesses are connected with certain IMEs), so judging by previous
responses, I assume that the browser people will think it is a security
issue to hand this information to JS. That's why I came up with a proposal
that would let us get around that.




>
> 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 18:40:32 UTC