[Patch] text selection improvements

Leo Savernik l.savernik at aon.at
Thu Sep 25 02:51:25 BST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

Making text selection faster was harder than I anticipated -- no wonder nobody 
has done that yet ;-)

What the patch does:
- - merges the safari bool immediate parameter in RenderObject::repaint().
- - merges the safari changes for RenderCanvas::setSelection/clearSelection
- - big optimization for the common case in Font::drawText
- - smaller optimizations in Font::drawText

I merged the immediate parameter, but it is not used wrt selections. It may be 
useful for other purposes, so I left it in.

Nearly every speed gain results from the optimizations I have done within 
Font::drawText.

First, the common case (not justified, zero wordspacing/linespacing, no 
small-caps) directly paints the string as a whole (there is already an 
optimization for the most common case, but this isn't called for selections). 
This optimization is responsible for nearly every noticable gain.

Second, I implemented drawing words, not single characters, whenever this is 
applicable (justify or wordspacing, but not for letterspacing). The speed 
gains are virtually non-existent.

Finally, small-caps and letterspacing are still treated the old way, and 
therefore retain their slowness.

There are still issues: The selection is severly lagging the cursor for long 
render texts (needn't be excessively long, just about a page), though it 
doesn't degrade linearly like Mozilla's.

I actually intended to directly repaint from within the mouse event, but as 
Font::drawText has been determined as the actual bottleneck, I drop that for 
now.

Please review, and nitpick ;-)

mfg
	Leo
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE/ckoij5jssenUYTsRAnaJAJ9p+C01umzFdD8QRiFTTEJXlyRGkgCgkJLT
N6QstmojOToAImiuc/N2BaI=
=SYEg
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: khtml_selection_2.diff
Type: text/x-diff
Size: 37792 bytes
Desc: not available
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20030925/38a8a451/attachment.diff>


More information about the kfm-devel mailing list