WebCore's text selection improvements

David Hyatt hyatt at apple.com
Wed Sep 24 18:34:38 CEST 2003


On Sep 22, 2003, at 5:26 AM, Leo Savernik wrote:

> Hello,
>
> I looked at the text selection improvements of WebCore. There is a
> PaintSelection action in the paint methods that strives to only paint 
> the
> selected parts. However, I don't see the spot where the paint event 
> with the
> PaintSelection action is triggered (within RenderCanvas::setSelection, 
> for
> instance).
>

PaintSelection is not a paint action that is undertaken during the 
normal painting process.  It's actually used by WebCore when the 
selection is being dragged with the mouse.  (This is Mac behavior.  You 
can actually take a selection and drag it out of one window and drop it 
into another window.)

You basically shouldn't need any of the PaintSelection paint action 
stuff unless you plan to support this feature also.

> rectangle to one single paint event? In Qt, they do, but interpreting
> WebCore's implementation, they do *not*.
>

Good question.  In Jaguar (OS 10.2), updateContents with a |now| of 
false results in a call to setNeedsDisplay in Cocoa.  If you do two 
updateContents calls with a |now| of false synchronously, then (in 
Jaguar) the rects will be united, and the resulting paint that happens 
later will use the united bounding box.

However, in Panther (OS 10.3), you can actually get to the individual 
rects when the paint call comes in.  (You can either use the united 
bounding box, or walk the individual rects.)

I'm actually working right now on eliminating KHTML's repaint timer and 
on stopping layout from doing a full repaint every time.  This is a 
change that will be critical to developing your caret navigation code 
into an editor (as well as for speeding up DHTML).

It's turning out to be quite challenging though. As soon as i have 
something limping along that works reasonably well, I'll post a patch, 
or I could post what I have already with a list of known issues if you 
want to get an early peek.  :)

dave



More information about the Khtml-devel mailing list