exposing underlining mechanism for IME?

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)

where the color, thickness and backgroundColor are optional and if the user
doesn't chose anything, the colors of the current IME will be used.

That way one doesn't have to expose information about what colors and line
thickness the current IME is using. But Google Docs, which apparently shows
character creation to collaborators, can then use a different underline
color for characters that a collaborator is currently composing.

For cE=events, we could just have beforeInput events and the browser can
stop worrying entirely what goes into the DOM and what doesn't. It just
assumes that the JS does all that it asks it to do.


We could also have

addSpellingMarker(range,color)

where the color is optional. If not specified it's the default spelling
color. Because many editors have to turn of the builtin spell checker (Word
online is using contenteditable and turns of the spellchecker that, and
CKeditor, TinyMCE, etc. do it as well), this would allow for the third
party replacements that the editors use instead to be shown equally well.


So question is: Why are markers not exposed?


[1]
https://chromium.googlesource.com/chromium/blink/+/8d2d7506bebf376fcb885f8344e1df38de2998f2/Source/core/editing/InputMethodController.cpp#326


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

Received on Friday, 6 November 2015 06:33:28 UTC