Long-pressing on an iframe which doesn't have focus puts selection in unexpected place
Categories
(Core :: DOM: Selection, defect)
Tracking
()
People
(Reporter: kats, Assigned: TYLin)
References
(Blocks 1 open bug)
Details
Attachments
(3 files)
Reporter | ||
Comment 1•8 years ago
|
||
Reporter | ||
Comment 2•8 years ago
|
||
Reporter | ||
Comment 3•8 years ago
|
||
Reporter | ||
Comment 4•8 years ago
|
||
Reporter | ||
Comment 5•8 years ago
|
||
Assignee | ||
Comment 7•8 years ago
|
||
Comment 8•8 years ago
|
||
Comment 9•8 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 11•5 years ago
|
||
Long-pressing on a text in an unfocused iframe to select a word never
works. Currently, you need to single tap to focus the iframe first.
Each PresShell has an associated AccessibleCaretEventHub. This patch
fixes this bug by routing the event to the AccessibleCaretEventHub under
the event point, and handle it there. If the event is not handled, then
we handle it by the focused AccessibleCaretEventHub as before.
I've experimented with only routing the event to the
AccessibleCaretEventHub under the event point, without routing to the
fallback focused AccessibleCaretEventHub. However, caret dragging didn't
work in iframes. I didn't debug further.
Assignee | ||
Comment 12•5 years ago
|
||
Consider the following scenario:
- Select a word in an iframe.
- Select a word in the parent document. (The carets in iframe hide
due to blur, but the selection is still there.) - Scroll the parent document.
The selection in the iframe (made in step 1) has a non-collapsed range.
Thus the carets show again after scrolling due to UpdateCarets()
called in the end of AccessibleCaretManager::OnScrollEnd()
.
To fix the dual AccessibleCaret in the same page (described in bug
1199967), we can simply show no carets if the window is not focused.
This behavior always matches Google Chrome on Android.
Depends on D52767
Comment 13•5 years ago
|
||
Comment 14•5 years ago
|
||
Backed out 2 changesets (Bug 1306634) for causing assertion failures in nsAutoLayoutPhase.cpp CLOSED TREE
Push with failure: https://treeherder.mozilla.org/#/jobs?repo=autoland&selectedJob=285253547&resultStatus=testfailed%2Cbusted%2Cexception&revision=fb20602d0c39d727109ee19cf7d609ac908c2314
Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=285263243&repo=autoland&lineNumber=37064
Backout: https://hg.mozilla.org/integration/autoland/rev/5dd4c1288dc7eb4dc2ab12e522043613c7e79f8f
Assignee | ||
Comment 15•5 years ago
|
||
OK, so by looking at the failure log, the assertion is "display list building in the middle of frame construction."
That is, we are in the middle of destroying some frames, and some windows-only related stuff [1] can send WidgetQueryContentEvent
with eQuerySelectedText
messages that PresShell needs to handle. My new code added in Part 1 uses PresShell::EventHandler::ComputeEventTargetFrameAndPresShellAtEventPoint()
to find the desired target frame and PresShell, which requires building display lists to do the hit test.
In fact, AccessibleCaretEventHub [2] handles only mouse, touch, and keyboard events. To fix this, I think it is reasonable to filter the event classes upfront in PresShell::EventHandler::MaybeHandleEventWithAccessibleCaret()
, and add an assertion in AccessibleCaretEventHub::HandleEvent()
that it never gets events other than the three types it cares about.
[1] https://searchfox.org/mozilla-central/rev/68b2e0fd4323261a229233ec2ab8606228979141/widget/windows/TSFTextStore.cpp#2977-2979
[2] https://searchfox.org/mozilla-central/rev/68b2e0fd4323261a229233ec2ab8606228979141/layout/base/AccessibleCaretEventHub.cpp#405
Comment 16•5 years ago
|
||
Comment 17•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/3ad87a37592b
https://hg.mozilla.org/mozilla-central/rev/29c9a00754c1
Updated•5 years ago
|
Updated•5 years ago
|
Description
•