[Webkit-unassigned] [Bug 36037] REGRESSION(51522): typing at the end of a line in designMode documents is *very* slow

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue May 25 11:08:24 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=36037





--- Comment #16 from Enrica Casucci <enrica at apple.com>  2010-05-25 11:08:22 PST ---
(In reply to comment #14)
> (From update of attachment 56949 [details])
> > +        m_offsetInAnchor = (m_anchorNode->hasChildNodes())? 0: lastOffsetForEditing(m_anchorNode);
> 
> Formatting nitpick: Please write it like this:
> 
>     m_offsetInAnchor = m_anchorNode->hasChildNodes() ? 0: lastOffsetForEditing(m_anchorNode);
> 
sure, I'll fix it.

> But also, it seems wasteful to call lastOffsetForEditing in a case where we already know the node is non-null and we know that hasChildNodes is false. The special editingIgnoresContent behavior is the main reason we have the lastOffsetForEditing function. If we're not trying to implement that rule, then I think the code above is equivalent to this:
> 
>     m_offsetInAnchor = m_anchorNode->offsetInCharacters() ? m_anchorNode->maxCharacterOffset() : 0;
> 
I agree that we don't need the test on the children, since we know already. but how can we be sure we don't need the editingIgnoresContent behavior?
If you look at the code above this for the case where m_nodeAfterPositionInAnchor is not null, lastOffsetForEditing is used there too. I don't have any reason to believe we can ignore editingIgnoresContent. Could you please explain?
I'll try what you're suggesting and see if it breaks any of the tests.

> For efficiency we could optimize it like this:
> 
>     m_offsetInAnchor = (m_anchorNode->hasChildNodes() || !m_anchorNode->offsetInCharacters()) ? 0 : m_anchorNode->maxCharacterOffset();
> 
> I'm not sure which is the best way to write it, but I do think that calling lastOffsetForEditing is a little strange. On the other hand, using it consistently might be clearer from a code readability point of view.
> 
> r=me even if you don't agree with my comments. It's OK to just fix the formatting nitpick.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list