[webkit-dev] Getting text alignment in editing mode?

Kevin Ollivier kevino at theolliviers.com
Fri Jan 23 10:36:15 PST 2009


Hi Darin,

On Jan 23, 2009, at 8:47 AM, Darin Adler wrote:

> On Jan 22, 2009, at 10:29 AM, Kevin Ollivier wrote:
>
>> I'm working on adding HTML editing capabilities to the wxWebKit  
>> API, and I've gotten a lot of things working by exposing the edit  
>> commands, as well as providing a level of DOM wrapping for getting/ 
>> manipulating attributes. One thing I've been unable to figure out,  
>> though, is how to get the text alignment(s) of a selection. The  
>> Align(Left/Center/Right/Justify) commands do not provide a  
>> mechanism for reporting the state of those commands, and neither do  
>> I see an API in Editor, SelectionController, or DOMRange for it. Is  
>> there an 'official' way to get this information, or is it a matter  
>> of traversing the DOM and getting the info from each element myself?
>
> It's a missing feature. I think that Align commands should probably  
> implement state, although they currently don't. The stateStyle  
> functions might have close to the right logic, but they might also  
> need added changes that understand that these are block styles  
> rather than styles that can affect arbitrary runs of text.

Thanks, do you have any examples of how e.g. the logic in  
selectionHasStyle could be tripped up by (or be insufficient for)  
block styles like this? Is it a matter of having it not query the  
alignment for non-block elements when traversing nodes (because it  
might return an invalid value?), or something else?

Thanks,

Kevin

>
>    -- Darin
>



More information about the webkit-dev mailing list