[Webkit-unassigned] [Bug 61594] REGRESSION: Hitting enter in the middle of this span causes the cursor to go to the end of the span

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jun 7 16:46:02 PDT 2011


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





--- Comment #14 from Annie Sullivan <sullivan at chromium.org>  2011-06-07 16:46:02 PST ---
(From update of attachment 96322)
View in context: https://bugs.webkit.org/attachment.cgi?id=96322&action=review

> Source/WebCore/editing/CompositeEditCommand.cpp:1243
> +    Node* startNode = start->containerNode();

The way I rewrote this function, it is the same as splitTreeToNode, except that it handles some special cases for choosing which starting node to use:
* If the position is at the end of a text node, it starts at the next node in the tree.
* If the position is in the middle of a text node, it splits the text node and starts at the second half of the split. It turns out I did find a clear use case for this behavior; see changes to ReplaceSelectionCommand::insertAsListItems

The new layout tests I added work fine with this new code. However, when I converted the other callers of splitTreeToNode to call splitTree() with a position, I ran into some trouble because I am making too many assumptions about positions, and several layout tests regressed. I think the problems all have the same root cause--I am assuming the containerNode of the position is the same node that was passed into splitTreeToNode originally. However, stepping through the debugger I have found that this is definitely not always the case. Many of the callers of splitTreeToNode() were actually already using a position, and passing in deprecatedNode() or anchorNode(). So I thought I could just pass the position in directly. But there are multiple ways a position can be anchored, and so often the containerNode I check below is not the same as the deprecatedNode/anchorNode that was passed in originally. I think I want to normalize the position so that the containerNode is always what u
 sed to be the start argument. I think I want to use containerNode instead of deprecatedNode/anchorNode, because I also call offsetInContainerNode(). But I  don't see a normalization function for Position except parentAnchoredEquivalent(), which I think sets the containerNode to the parent of the node I wanted it to be. Do you know what the correct thing to do here is?

> Source/WebCore/editing/CompositeEditCommand.cpp:1247
> +        // FIXME: startNode can be null if traverseNextNode returns null. What should it be set to in that case?

If traverseNextNode() returns null on line 1249, it is because the position is at the end of the last node inside the end node. I am not sure how the function should behave in that case--should it start splitting at the containerNode's parent?

-- 
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