Closed Bug 1052513 Opened 10 years ago Closed 10 years ago

Selection offsets broken on descendant accessibles

Categories

(Core :: Disability Access APIs, defect)

Other
Windows 8.1
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla34

People

(Reporter: Jamie, Assigned: tbsaunde)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Str:
1. Open this: data:text/html,a<div>b</div>
2. Press control+a to select all.
3. Get the accessible for the document.
4. Call IAccessibleText::selection(0).
Result (correct): (0, 2)
5. Get the accessible for the div.
6. Call IAccessibleText::selection(0).
Expected: (0, 1)
Actual: (1, 1)
Blocks: texta11y
Comment on attachment 8472656 [details] [diff] [review]
fix HyperTextAccessible::SelectionBoundsAt for selections extending outside the current hyper text

Review of attachment 8472656 [details] [diff] [review]:
-----------------------------------------------------------------

::: accessible/generic/HyperTextAccessible.cpp
@@ +1451,5 @@
> +
> +  if (!nsContentUtils::ContentIsDescendantOf(endNode, mContent))
> +    *aEndOffset = CharacterCount();
> +  else
> +    *aEndOffset = DOMPointToOffset(endNode, endOffset, true);

does it work when both points either after or before the text accessible? it'd be good to have a test case for it

::: accessible/tests/mochitest/textselection/test_general.html
@@ +182,5 @@
>        gQueue.push(new synthFocus("textarea", onfocusEventSeq("textarea")));
>        gQueue.push(new changeSelection("textarea", 1, 3));
>  
> +      gQueue.push(new changeDOMSelection("c1", "c1_span1", 0, "c1_span2", 0, [["c1", 2, 2]]));
> +      gQueue.push(new changeDOMSelection("c2", "c2", 0, "c2_div2", 1, [["c2", 0, 3], ["c2_div2", 0, 2]]));

nit: it'd be good to break this into two lines

::: testing/mochitest/runtests.py
@@ -1158,5 @@
>      gmp_path = os.path.join(self.profile.profile, 'plugins', 'gmp-fake')
>      if os.path.isdir(gmp_path):
>        return gmp_path
>      # This is fatal for desktop environments.
> -    raise EnvironmentError('Could not find gmp-fake')

unrelated

::: testing/testsuite-targets.mk
@@ +38,5 @@
>  RUN_MOCHITEST = \
>    rm -f ./$@.log && \
>    $(PYTHON) _tests/testing/mochitest/runtests.py --autorun --close-when-done \
>      --console-level=INFO --log-file=./$@.log --file-level=INFO \
> +    --log-tbpl --failure-file=$(abspath _tests/testing/mochitest/makefailures.json) \

unrelated
Trev, ping
> ::: accessible/generic/HyperTextAccessible.cpp
> @@ +1451,5 @@
> > +
> > +  if (!nsContentUtils::ContentIsDescendantOf(endNode, mContent))
> > +    *aEndOffset = CharacterCount();
> > +  else
> > +    *aEndOffset = DOMPointToOffset(endNode, endOffset, true);
> 
> does it work when both points either after or before the text accessible?

GetSelectionDOMRanges() doesn't return ranges that don't intersect the subtree of GetNode()

> it'd be good to have a test case for it

I guess it can't hurt.
Attachment #8472656 - Flags: review?(surkov.alexander) → review+
https://hg.mozilla.org/mozilla-central/rev/ff17b837114d
Assignee: nobody → trev.saunders
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: