Closed
Bug 710389
Opened 14 years ago
Closed 3 years ago
PeekOffset returns wrong offset for word boundary
Categories
(Core :: Layout, defect)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: eeejay, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(2 files, 1 obsolete file)
|
178 bytes,
text/html
|
Details | |
|
1.02 KB,
patch
|
Details | Diff | Splinter Review |
With the given document, a call to PeekOffset on the div's frame with this structure:
nsPeekOffsetStruct pos;
pos.SetData(eSelectWord, eDirPrevious, 0, 0, true, false, true, false, eStartWord);
returns an mContentOffset of 60, when the expected value is 0.
| Reporter | ||
Comment 1•14 years ago
|
||
SeekPos() erroneously adjusts the offset to -1 which is later interpreted as a last-char offset.
This patch removes whitespace-only content nodes from calculation of offset. This is totally a shot in the dark, since I am not familiar with how whitespace-only nodes are generally treated.
Attachment #581421 -
Flags: review?(ehsan)
| Reporter | ||
Comment 2•14 years ago
|
||
Just a slight re-order
Attachment #581421 -
Attachment is obsolete: true
Attachment #581421 -
Flags: review?(ehsan)
Attachment #581425 -
Flags: review?(ehsan)
Comment 3•14 years ago
|
||
Comment on attachment 581425 [details] [diff] [review]
Possible fix
>@@ -2950,8 +2950,14 @@ static FrameContentRange GetRangeForFrame(nsIFrame* aFrame) {
> parent = content->GetParent();
> if (parent) {
> PRInt32 beginOffset = parent->IndexOf(content);
>- if (beginOffset >= 0)
we usually use 8 lines of context (-U8 for most diffs). Since you look like your using git I'd recomend using bholley's version of git-bz.
Comment 4•14 years ago
|
||
Eitan says this was discovered when using nsIAccessibleText, but mochitest-a11y doesn't seem to cover it.
Flags: in-testsuite?
Comment 5•14 years ago
|
||
Comment on attachment 581425 [details] [diff] [review]
Possible fix
I'd really rather roc look at this.
Attachment #581425 -
Flags: review?(ehsan) → review?(roc)
(In reply to Eitan Isaacson [:eeejay] from comment #1)
> SeekPos() erroneously adjusts the offset to -1 which is later interpreted as
> a last-char offset.
SeekPos doesn't exist, what did you mean there? This sounds like a plausible explanation but I'd like to hear it in more detail :-). I suspect your patch isn't the correct fix for the bug.
| Reporter | ||
Comment 7•14 years ago
|
||
Yeah, what is SeekPos??
The offending line is here[1]. If the given offset is 0, and the frame's content has siblings to the left of it, they get subtracted from 0, and things go wrong. Specifically when a sibling has no text.
1. http://hg.mozilla.org/mozilla-central/file/803c353ee693/layout/generic/nsFrame.cpp#l5811
I think the problem with that line is that aPos->mStartOffset is assumed to be within the frame's content node, whereas GetRangeForFrame can return a node that's not the frame's content node, so subtracting one offset from the other doesn't make sense when they're in different nodes.
Comment 9•14 years ago
|
||
> Eitan says this was discovered when using nsIAccessibleText
Is it nsHyperTextAccessible::GetRelativeOffset we're talking about?
Perhaps it should do what nsFrame::PeekBackwardAndForward does and move forward
one character first?
http://mxr.mozilla.org/mozilla-central/source/layout/generic/nsFrame.cpp#2642
| Reporter | ||
Comment 10•12 years ago
|
||
Comment on attachment 581425 [details] [diff] [review]
Possible fix
Removing review flag, since it is not going to happen :)
Attachment #581425 -
Flags: review?(roc)
Updated•7 years ago
|
Product: Core → Core Graveyard
| Assignee | ||
Updated•7 years ago
|
Component: Layout: Misc Code → Layout
Product: Core Graveyard → Core
Comment 11•3 years ago
|
||
Eitan, do you have any idea what the a11y repro for this was or should we just close it? I can't see a problem here, with or without the cache, even if I give the div a role to force an Accessible.
Flags: needinfo?(eitan)
| Reporter | ||
Comment 12•3 years ago
|
||
Let's just close as works for me. This is old enough to not matter, especially if our current text implementation doesn't trip up on this.
Status: NEW → RESOLVED
Closed: 3 years ago
Flags: needinfo?(eitan)
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•