Closed Bug 864589 Opened 11 years ago Closed 11 years ago

Show/hide text selection handles if a selection is programatically added/removed

Categories

(Firefox for Android Graveyard :: Text Selection, defect)

ARM
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 26

People

(Reporter: Margaret, Assigned: capella)

References

Details

Attachments

(1 file, 1 obsolete file)

This was originally half fixed in bug 767065, but I removed that logic in bug 667243, since it didn't work well with our new caretPositionFromPoint approach.
Blocks: 801421
Assignee: nobody → markcapella
Status: NEW → ASSIGNED
Attached patch bug864589 (obsolete) — Splinter Review
This appears to solve for this and the test case in bug 767065, as well as solving bug 904288 the right way.

I have one minor concern, let's see if you notice :-)
Attachment #790198 - Flags: review?(margaret.leibovic)
Comment on attachment 790198 [details] [diff] [review]
bug864589

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

I'm impressed that you aren't afraid to jump right into the platform side of things. This seems like a less hacky approach than what I did back in bug 767065!

However, I want Ehsan to take a look at these platform changes before I start reviewing the JS side of things :)
Attachment #790198 - Flags: review?(ehsan)
margaret: fyi - yah - when I started out with a11y I did some tinkering with text selection, notably here https://bugzilla.mozilla.org/show_bug.cgi?id=614585
Attachment #790198 - Flags: review?(ehsan) → review+
Comment on attachment 790198 [details] [diff] [review]
bug864589

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

LGTM. I'm wondering what your concern is! :)

::: mobile/android/chrome/content/SelectionHandler.js
@@ +479,1 @@
>          selection.removeAllRanges();

This is the opposite order of what was in my patch from bug 767065, but I did update it to do this before removing the selection listener from the code:
http://hg.mozilla.org/mozilla-central/annotate/c8d7e2709f01/mobile/android/chrome/content/SelectionHandler.js#l402

So this is correct.
Attachment #790198 - Flags: review?(margaret.leibovic) → review+
I wonder if this platform change is something that will help out metro. Cc'ing jimm in case it is.
Attached patch bug864589Splinter Review
I'm reposting this for review as a little research confirmed it needed help a) to better target the notification reasons we're interested in, and b) allow our reasons to co-exist with, vs. supercede, other bit flags that may be present.
Attachment #790198 - Attachment is obsolete: true
Attachment #791111 - Flags: review?(margaret.leibovic)
Attachment #791111 - Flags: review?(ehsan)
Copying aaronmt ... fyi ... this should confirm the fix for bug 767065, as well as solving bug 904288.
Comment on attachment 791111 [details] [diff] [review]
bug864589

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

r+ to the JS changes. Thanks for being so thorough!
Attachment #791111 - Flags: review?(margaret.leibovic) → review+
Comment on attachment 791111 [details] [diff] [review]
bug864589

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

::: layout/generic/nsSelection.cpp
@@ +4444,5 @@
>    if (!firstRange)
>      return NS_ERROR_FAILURE;
>  
> +  if (mFrameSelection) {
> +    short reason = mFrameSelection->PopReason() | nsISelectionListener::COLLAPSETOSTART_REASON;

int16_t here and below.

::: mobile/android/chrome/content/SelectionHandler.js
@@ +176,5 @@
>  
> +  notifySelectionChanged: function sh_notifySelectionChanged(aDocument, aSelection, aReason) {
> +    // If the selection was collapsed to Start or to End, always close it
> +    if (aReason & Ci.nsISelectionListener.COLLAPSETOSTART_REASON ||
> +        aReason & Ci.nsISelectionListener.COLLAPSETOEND_REASON) {

Please don't rely on operator precedence like this!  Use parenthesis to make the precedence explicit.
Attachment #791111 - Flags: review?(ehsan) → review+
re-push because uuid's are real things
https://hg.mozilla.org/integration/fx-team/rev/5a5d5ebec1fc
https://hg.mozilla.org/mozilla-central/rev/5a5d5ebec1fc
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 26
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: