[webkit-dev] Question about TextBreakIterator usage in RenderText

David Hyatt hyatt at apple.com
Mon Jun 7 14:45:29 PDT 2010

On Jun 7, 2010, at 4:18 PM, David.Leong at nokia.com wrote:

> My question is can we optimize this flow somehow? Can we re-use the TextBreakIterator in the render text class when performing the RenderText::positionForPoint() function?

That's what the ICU implementation does.  I think you just need to fix your implementation to do the same.  If you want to push the re-use higher you could probably make cursorMovementIterator cross-platform and then have it contain the static pointer to the reused iterator.  Then the existing cursorMovementIterator could be renamed and be called by the new cross-platform function.   However you could also just fix your implementation of cursorMovementIterator to reuse the iterator.

static bool createdCursorMovementIterator = false;
static TextBreakIterator* staticCursorMovementIterator;
return setUpIteratorWithRules(createdCursorMovementIterator, staticCursorMovementIterator, kRules, string, length);

(hyatt at apple.com)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20100607/21e5fbaa/attachment.html>

More information about the webkit-dev mailing list