Closed Bug 862054 Opened 11 years ago Closed 11 years ago

Defect - caret selection via touch not working, no grippers appear (elementFromPoint doesn't take clientX/clientY from sub frame events.)

Categories

(Firefox for Metro Graveyard :: Input, defect, P1)

x86_64
Windows 8.1
defect

Tracking

(Not tracked)

VERIFIED FIXED
Firefox 23

People

(Reporter: jbecerra, Assigned: jimm)

References

Details

(Keywords: regression, Whiteboard: [selection] feature=defect u=metro_firefox_user c=content_features p=3 status=verified)

Attachments

(3 files, 3 obsolete files)

Tested on 2013-04-15 using latest nightly built from http://hg.mozilla.org/mozilla-central/rev/261d6997d1d1

While regression testing bug 851388 I noticed that text selection using touch isn't working. The grippers don't show.

Steps:
1. In Firefox Metro go to https://developer.mozilla.org/en-US/docs/HTML/HTML_Elements/textarea#HTML_Content
2. Tap on a word in the text area

Expected: You should see a monocle you can drag  left or fright to select thext

Actual: Caret blinking but no monocle.

You can select text using mouse and also with hardware arrows.
Blocks: caret-sel
Keywords: regression
Summary: defect - caret selection via touch not working, no grippers appear → Defect - caret selection via touch not working, no grippers appear
Whiteboard: [selection] feature=defect u=metro_firefox_user c=content_features p=0
Appears to be a problem with elementFromPoint - 

http://mxr.mozilla.org/mozilla-central/source/browser/metro/base/content/contenthandlers/Content.js#421

I placed a dump statement here, it returns random elements, a div, a head, and sometimes the test area. The textarea in this sample is in an iframe, so looks like elementFrompoint is having a hard time with that.
No longer blocks: metrov1defect&change
Summary: Defect - caret selection via touch not working, no grippers appear → defect - caret selection via touch not working, no grippers appear (elementFromPoint fails to identify the correct tapped element)
Whiteboard: [selection] feature=defect u=metro_firefox_user c=content_features p=0
Whiteboard: [selection] feature=defect u=metro_firefox_user c=content_features p=0
OS: Windows 8 → Windows 8 Metro
Component: General → Input
Whiteboard: [selection] feature=defect u=metro_firefox_user c=content_features p=0 → [selection] feature=defect u=metro_firefox_user c=content_features p=8
Assignee: nobody → jmathies
Blocks: metrov1it6
Summary: defect - caret selection via touch not working, no grippers appear (elementFromPoint fails to identify the correct tapped element) → defect - caret selection via touch not working, no grippers appear (elementFromPoint doesn't take clientX/clientY from sub frame events.)
No longer blocks: metrov1defect&change
Summary: defect - caret selection via touch not working, no grippers appear (elementFromPoint doesn't take clientX/clientY from sub frame events.) → Defect - caret selection via touch not working, no grippers appear (elementFromPoint doesn't take clientX/clientY from sub frame events.)
Status: NEW → ASSIGNED
QA Contact: jbecerra
I don't see why we need this anymore. We have fluffing through the dom so this just fluffs things out more while adding complexity to Content.js. FWIW, I've been surfing around with this and having no issues.

mbrubeck, curious what your thoughts are on this?
Attachment #738110 - Flags: feedback?(mbrubeck)
Attached patch part 3 - misc (obsolete) — Splinter Review
A few issues addressed here - 

1) the Content:SelectionCaret message needs top level browser coordinates. I was sending subframe coordinates.

2) _restrictSelectionRectToEditBounds needs to restrict to browser vs. subframe as well.

3) minor tweak to the deck offset code that popped up here, this._targetElement.ownerDocument.defaultView.innerHeight is the subframe height, not the browser height.

Generally SelectionHandler isn't well tested with input in subframes so there are probably other bugs. When I get back to updating my selection tests I'll put together a big set of sub frame element related tests and address any additional issues in follow ups.
Whiteboard: [selection] feature=defect u=metro_firefox_user c=content_features p=8 → [selection] feature=defect u=metro_firefox_user c=content_features p=3
Priority: -- → P1
Comment on attachment 738108 [details] [diff] [review]
part 1 - move translateToTopLevelWindow to Utils

simple code move.
Attachment #738108 - Flags: review?(netzen)
Comment on attachment 738108 [details] [diff] [review]
part 1 - move translateToTopLevelWindow to Utils

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

::: browser/metro/base/content/contenthandlers/ContextMenuHandler.js
@@ +175,5 @@
>  
>      let { targetWindow: targetWindow,
>            offsetX: offsetX,
>            offsetY: offsetY } =
> +      Utils.translateToTopLevelWindow(aPopupNode);

Shouldn't this be Util.translateToTopLevelWindow(aPopupNode);?
Attachment #738108 - Flags: review?(netzen)
Nice catch, that would have broken something I'm sure. :)
Attachment #738108 - Attachment is obsolete: true
Attachment #739055 - Flags: review?(netzen)
Attachment #739055 - Flags: review?(netzen) → review+
Blocks: 863748
mbrubeck - ping.

I'm currently working up some tests for this in bug 863748. Thus far I haven't seen any issues. Curious if you know of anything elementFromPoint is helping us with warranting it's use. If not I'd like to go ahead and seek reviews on these changes.
Comment on attachment 738110 [details] [diff] [review]
part 2 - get rid of ElementTouchHelper and elementFromPoint

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

Yes, I'm in favor of this.  ElementTouchHelper was originally designed for tapping on clickable items like links and buttons; we're not using it for that since Gecko now handles it for us (bug 780847).  I don't think it's really necessary or suitable for text selection.
Attachment #738110 - Flags: feedback?(mbrubeck) → feedback+
No changes to part 2 compared to the original patch. 99% code removal.
Attachment #738110 - Attachment is obsolete: true
Attachment #740477 - Flags: review?(mbrubeck)
Attachment #740477 - Flags: feedback+
This is pretty straight forward. In three places in the selection code, I use the bounds of the element in calculations. The original routine returned coords that were relative to the frame the element was in. If there was a sub frame things broke, if not coords were relative to the top level browser, which is why this all worked outside of sub frames.

I've written a number of tests for the sub frame case in the dependent bug. Top level coords are tested by existing selection tests that have already landed. Everything passes with these changes.
Attachment #738118 - Attachment is obsolete: true
Attachment #740483 - Flags: review?(netzen)
Comment on attachment 740483 [details] [diff] [review]
part 3 - SelectionHandler should use browser relative coords

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

::: browser/metro/base/content/contenthandlers/Content.js
@@ +281,5 @@
>  
>      // A tap on a form input triggers touch input caret selection
>      if (Util.isTextInput(element) &&
>          aEvent.mozInputSource == Ci.nsIDOMMouseEvent.MOZ_SOURCE_TOUCH) {
> +      let { targetWindow, offsetX, offsetY } = Util.translateToTopLevelWindow(element);

I think you ca just do:
let { offsetX, offsetY } = Util.translateToTopLevelWindow(element);

here.
Attachment #740483 - Flags: review?(netzen) → review+
Attachment #740477 - Flags: review?(mbrubeck) → review+
For Virgil to test and verify.
Flags: needinfo?(virgil.dicu)
I won't be able to verify this, as I don't have access to a Win8 tablet. Adding Juan.
Flags: needinfo?(virgil.dicu) → needinfo?(jbecerra)
Tested on 2013-04-24 using a nightly built from http://hg.mozilla.org/mozilla-central/rev/fef5f202b2dc
- You can now select text via touch using the grippers, but Firefox for Metro isn't following the guidelines described in http://msdn.microsoft.com/en-us/library/windows/apps/hh465334.aspx which make text selection in IE more natural.
- Filed bug 865369 for the follow-up issue
Status: RESOLVED → VERIFIED
Depends on: 865369
Flags: needinfo?(jbecerra)
Whiteboard: [selection] feature=defect u=metro_firefox_user c=content_features p=3 → [selection] feature=defect u=metro_firefox_user c=content_features p=3 status=verified
No longer depends on: 865369
We really don't need to be verifying this bug anymore since there are a bunch of other bugs whose verification steps involve selecting text using touch input, but... verified for it8
OS: Windows 8 Metro → Windows 8.1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: