[Webkit-unassigned] [Bug 112240] execCommand("RemoveFormat") might remove format after the selection

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Apr 12 08:03:25 PDT 2013


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





--- Comment #6 from Claudio Saavedra <csaavedra at igalia.com>  2013-04-12 08:01:40 PST ---
> I have yet to find why nodeFullySelected() is returning true here, but I wanted to share this before continuing.

I think I've found an answer to this question. This method makes two comparisons to find whether the given node is fully selected. For nodeFullySelected(node, start, end), we are interested in the second comparison, which in the code has the following form:

  comparePositions(lastPositionInOrAfterNode(node).upstream(), end) <= 0

lastPositionInOrAfterNode(node), where node is <B>, as in our example, will return a position that is anchored after all children, however, calling upstream() in this position ends up losing the AnchorType. I suspect this is related to the following comment in WebCore::Position::upstream():

    // FIXME: PositionIterator should respect Before and After positions.

When a Position p has an AnchorType of PositionIsAfterChildren, the position p.upstream() will just have an anchor type of PositionIsOffsetInAnchor but with offset 0. That's why later Range::compareBoundaryPoints() will return the wrong value comparePositions() will return -1.

Just removing the call to upstream() and using the Position returned by lastPositionInOrAfterNode() works around the issue, but I haven't investigated yet whether this will break something.

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