Bug 8622 - VisiblePositions aren't canonicalized in some cases
Summary: VisiblePositions aren't canonicalized in some cases
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Justin Garcia
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2006-04-26 22:02 PDT by Justin Garcia
Modified: 2007-05-30 15:17 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Garcia 2006-04-26 22:02:57 PDT
In this example: <div>foo<br></div>
VP(div, 2) != VP(br, 0)

There are a couple of problems in initDeepPosition.  First, in the fall through code, where neither upstream() nor downstream() are candidates, we canonicalize to next in most cases, whereas we claim that we always canonicalize to the candidate that appears first in the DOM.  
Second, in the fall through code, prev is just the first candidate found when going backward through the DOM.  There may be another equivalent candidate if you go further, and we should canonicalize to that one.  In the example above, VP(div, 2) gets into the fall through code, prev is [br, 0], which is equivalent to [foo, 3].  [foo, 3] should be used, but [br, 0] is used instead.
Comment 1 Justin Garcia 2006-04-26 23:26:54 PDT
Note, remove the workaround in VisiblePosition::isEqualIgnoringAffinity when this is fixed.
Comment 2 David Harrison 2007-05-07 17:00:38 PDT
Justin says he thinks this sounds like rdar://5096134 is a result of the workaround not being in affect for WebKit Accessibility's TextMarkers.
Comment 3 Justin Garcia 2007-05-30 15:17:26 PDT
r21904