Closed
Bug 394688
Opened 17 years ago
Closed 17 years ago
setCaretOffset() is off by one character (should be 0-indexed?)
Categories
(Core :: Disability Access APIs, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: jdiggs, Assigned: aaronlev)
References
(Blocks 1 open bug)
Details
(Keywords: access)
Attachments
(2 files, 2 obsolete files)
149 bytes,
text/html
|
Details | |
6.95 KB,
patch
|
davidb
:
review+
damons
:
approval1.9+
|
Details | Diff | Splinter Review |
Steps to reproduce:
1. Launch Accerciser and highlight the document frame of the attached test case.
2. Type the following in the iPython Console:
text = acc.queryText()
text.setCaretOffset(3)
text.caretOffset
Expected results: 3 would be returned
Actual results: 2 is returned
Notes:
1. Looking at the position of the caret on screen, 2 is the correct offset as offsets are 0-indexed. It seems that it's setCaretOffset() that is off by one.
2. This was introduced in Gecko/2007080404; in 2007080308 the offsets match.
Assignee | ||
Comment 1•17 years ago
|
||
That's when we checked in bug 348901, so maybe we're forgetting to convert from hypertext offsets internal source offsets. Internally we need to convert it to a source offset before we use it.
Assignee | ||
Comment 2•17 years ago
|
||
Wait, so are we setting the correct caret position but returning the wrong offset?
Reporter | ||
Comment 3•17 years ago
|
||
Nope, just the opposite. You're returning the correct offset. setCaretOffset(x) is currently setting the offset to x-1 instead of x.
Assignee | ||
Comment 4•17 years ago
|
||
Are the results affected by source whitespace?
Reporter | ||
Comment 5•17 years ago
|
||
As a matter of fact, they are. :-) I added additional whitespace in the source and the results changed. It's not a 1-to-1 correspondence, but it's definitely related. I should have known/guessed that. :-)
Assignee | ||
Comment 6•17 years ago
|
||
Assignee | ||
Comment 7•17 years ago
|
||
Joanie, this patch works for me with that change I mentioned. I think because you build statically you have to rebuild more than mozilla/accessible -- maybe in mozilla/browser as well. I'm not sure.
Assignee | ||
Comment 8•17 years ago
|
||
Assignee | ||
Comment 9•17 years ago
|
||
Attachment #279541 -
Attachment is obsolete: true
Attachment #279734 -
Attachment is obsolete: true
Attachment #279738 -
Flags: review?(surkov.alexander)
Assignee | ||
Comment 10•17 years ago
|
||
Setting the caret to -1 will be taken care of in a different bug.
Assignee | ||
Updated•17 years ago
|
Attachment #279738 -
Flags: review?(surkov.alexander) → review?(david.bolter)
Assignee | ||
Comment 11•17 years ago
|
||
Please ignore the first hunk in the diff of nsHyperTextAccessible.cpp, because it was going to help deal with setting the caret to -1. I'm going to work on that separately as I said.
Comment 12•17 years ago
|
||
Comment on attachment 279738 [details] [diff] [review]
Patch for review
Looks good (except for the GetCharacterCount hunk we discussed on IRC)
Attachment #279738 -
Flags: review?(david.bolter) → review+
Assignee | ||
Updated•17 years ago
|
Attachment #279738 -
Flags: approval1.9?
Updated•17 years ago
|
Attachment #279738 -
Flags: approval1.9? → approval1.9+
Assignee | ||
Updated•17 years ago
|
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•