Closed Bug 852949 Opened 11 years ago Closed 7 years ago

Selection created by content script is ignored by metrofx

Categories

(Firefox for Metro Graveyard :: Input, defect)

x86_64
Windows 8.1
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: jimm, Unassigned)

References

Details

(Whiteboard: [selection])

Attachments

(1 file)

Attached file testcase
STR:

1) load the test case
2) wait a few seconds

result: selection should appear, but the selection monocles do not display

We currently don't have dom events that would allow the front end to pick up on this.
This is a good catch, and also a bug in Fennec!

Would a selection listener help you out here? In Fennec, we add a selection listener to shut down our SelectionHelper if a selection is programatically collapsed, but we should probably add something to also show the handles if a selection is programatically added. We did this in bug 767065, but the code has evolved since then.
(In reply to :Margaret Leibovic from comment #1)
> This is a good catch, and also a bug in Fennec!
> 
> Would a selection listener help you out here? In Fennec, we add a selection
> listener to shut down our SelectionHelper if a selection is programatically
> collapsed, but we should probably add something to also show the handles if
> a selection is programatically added. We did this in bug 767065, but the
> code has evolved since then.

What type of event were you listening for?
Summary: Selection created by in content script is ignored by metrofx → Selection created by content script is ignored by metrofx
(In reply to Jim Mathies [:jimm] from comment #2)
> (In reply to :Margaret Leibovic from comment #1)
> > This is a good catch, and also a bug in Fennec!
> > 
> > Would a selection listener help you out here? In Fennec, we add a selection
> > listener to shut down our SelectionHelper if a selection is programatically
> > collapsed, but we should probably add something to also show the handles if
> > a selection is programatically added. We did this in bug 767065, but the
> > code has evolved since then.
> 
> What type of event were you listening for?

You can add a listener as part of the selection API, it just needs to implement nsISelectionListener:
http://mxr.mozilla.org/mozilla-central/source/content/base/public/nsISelectionPrivate.idl#50
http://mxr.mozilla.org/mozilla-central/source/content/base/public/nsISelectionListener.idl#12

Here's how we add/remove the selection listener:
http://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/SelectionHandler.js#245
http://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/SelectionHandler.js#398

Although thinking about this now, I realize you actually need a selection in the first place to do this... so maybe this won't work for this case...
(In reply to :Margaret Leibovic from comment #3)
> Although thinking about this now, I realize you actually need a selection in
> the first place to do this... so maybe this won't work for this case...

I should be able to get a selection object from the browser no matter what so maybe this will work. I'll give it a whirl. 

I ran into this today on bugzilla - changing the Product in a new bug form auto-selects the Assigned To field.
(In reply to Jim Mathies [:jimm] from comment #4)
> (In reply to :Margaret Leibovic from comment #3)
> > Although thinking about this now, I realize you actually need a selection in
> > the first place to do this... so maybe this won't work for this case...
> 
> I should be able to get a selection object from the browser no matter what
> so maybe this will work. I'll give it a whirl. 
> 
> I ran into this today on bugzilla - changing the Product in a new bug form
> auto-selects the Assigned To field.

This didn't seem to work. I was able to get a content window selection object on pageshow, but it didn't fire any events.
Blocks: 957244
OS: Windows 8 Metro → Windows 8.1
Mass close of bugs in obsolete product https://bugzilla.mozilla.org/show_bug.cgi?id=1350354
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: