Closed Bug 1065943 Opened 8 years ago Closed 8 years ago

[Text Selection] Hide utility bubble when scrolling and show bubble when scroll end - gaia part

Categories

(Firefox OS Graveyard :: Gaia::System, defect, P1)

x86
macOS
defect

Tracking

(Not tracked)

RESOLVED FIXED
2.1 S5 (26sep)

People

(Reporter: gduan, Assigned: gduan)

References

Details

Attachments

(1 file)

Per bug 987040 comment 41, we handle this special case in this bug. Detail use case is described at UX spec[1] page 17 figure 2.

[1] https://bug921965.bugzilla.mozilla.org/attachment.cgi?id=8412542
I've tested https://bugzilla.mozilla.org/attachment.cgi?id=8481290 patch and found out some wierd behavior.

STR:
1. long press some characters, and it will show dialog, and remove finger
2. touch the screen again, and start to scroll
3. stop scrolling and remove finger

Log between step 1 and 2 is as below,

E/GeckoConsole(  292): Content JS LOG at app://system.gaiamobile.org/js/text_selection_dialog.js:199 in tsd_show: {"rect":{"width":58.66667175292969,"height":14.666671752929688,"top":76.33332824707031,"bottom":91,"left":112.33332824707031,"right":171},"commands":{"canSelectAll":true,"canCut":true,"canCopy":true,"canPaste":false},"zoomFactor":1,"reasons":["mouseup"],"isCollapsed":false,"msg_name":"selectionchange","offsetX":0,"offsetY":30}

Log between step 2 and 3 is as below,

E/GeckoConsole(  292): Content JS LOG at app://system.gaiamobile.org/js/text_selection_dialog.js:74 in tsd_handleEvent: selectionchange
E/GeckoConsole(  292): Content JS LOG at app://system.gaiamobile.org/js/text_selection_dialog.js:199 in tsd_show: {"rect":{"width":320,"height":303.33331298828125,"top":30,"bottom":333.33331298828125,"left":0,"right":320},"commands":{"canSelectAll":true,"canCut":false,"canCopy":true,"canPaste":false},"zoomFactor":1,"reasons":["drag","mousedown"],"isCollapsed":true,"msg_name":"selectionchange","offsetX":0,"offsetY":0}
E/GeckoConsole(  292): Content JS LOG at app://system.gaiamobile.org/js/text_selection_dialog.js:74 in tsd_handleEvent: selectionchange
E/GeckoConsole(  292): Content JS LOG at app://system.gaiamobile.org/js/text_selection_dialog.js:199 in tsd_show: {"rect":{"width":320,"height":303.33331298828125,"top":30,"bottom":333.33331298828125,"left":0,"right":320},"commands":{"canSelectAll":true,"canCut":false,"canCopy":true,"canPaste":false},"zoomFactor":1,"reasons":[],"isCollapsed":true,"msg_name":"selectionchange","offsetX":0,"offsetY":0}
E/GeckoConsole(  292): Content JS LOG at app://system.gaiamobile.org/js/text_selection_dialog.js:74 in tsd_handleEvent: scrollviewchange


1. the value of isCollapsed are different
"isCollapsed":false
"isCollapsed":true

I believe it should be always true, since the selected area I saw on the screen is not collapsed after scrolling.

2. commands are different
{"canSelectAll":true,"canCut":true,"canCopy":true,"canPaste":false}
{"canSelectAll":true,"canCut":false,"canCopy":true,"canPaste":false}

I think they should be the same, or some button might be not workable after scrolling

3. rects are different
{"rect":{"width":58.66667175292969,"height":14.666671752929688,"top":76.33332824707031,"bottom":91,"left":112.33332824707031,"right":171}
{"rect":{"width":320,"height":303.33331298828125,"top":30,"bottom":333.33331298828125,"left":0,"right":320}

with and height should be the same due to same selected area. and top/bottom/left/right should changed by scrolling.


4. tsd_handleEvent: scrollviewchange happen after selectionchange
It makes text_seleciton_dialog.js updated with incorrect message of above items.




We should have way to filter the selectionchange event when user start to scroll and make sure the commands are the same scrolling.
open a new bug for comment 1
Depends on: 1065955
No longer depends on: 1065955
Assignee: nobody → gduan
Target Milestone: --- → 2.1 S5 (26sep)
Priority: -- → P1
Attached file PR to master
Hi Peter,
Please kindly test this patch and see if it works for the gecko code you provide.

This patch has included below update:
1. when scrolling, hide the bubble, and show it when stop
2. close bubble, when app is changed or pressing home
3. separate close/display/hide logic from show.
Attachment #8491968 - Flags: feedback?(pchang)
I just modified the ScrollVeiwChange event, please help to update gaia part. And I will help to check above testing scenarios.
Attachment #8491968 - Flags: feedback?(pchang)
Comment on attachment 8491968 [details] [review]
PR to master

Updated!
Please check it again, thanks.
Attachment #8491968 - Flags: feedback?(pchang)
Attachment #8491968 - Flags: feedback?(pchang) → feedback+
test updated, waiting for test result.
Comment on attachment 8491968 [details] [review]
PR to master

Hi Alive,
could you help to review this patch for text_selection?

here are what I changed
1. handle scrollviewchange event: hide bubble when scrolling, and show it when scroll end and recalculate the offset
2. close bubble when receiving home or activeappchanged event
3. separate show selectionchange handler and show function
4. filter event when rectHeight and rectWidth are zero
Attachment #8491968 - Flags: review?(alive)
Comment on attachment 8491968 [details] [review]
PR to master

r+ with nits
Attachment #8491968 - Flags: review?(alive) → review+
Thanks,
master: https://github.com/mozilla-b2g/gaia/commit/9a059ab8667b965ae7c4f9305abd324d71ad6a55
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.