Empty embedded object (HyperTextAccessible child) breaks line and word offsets
Categories
(Core :: Disability Access APIs, defect, P3)
Tracking
()
People
(Reporter: Jamie, Assigned: MarcoZ)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
Bug 1149415: Return correct offsets for lines or words if they contain embedded characters, r?jamie!
(deleted),
text/x-phabricator-request
|
Details |
Comment 1•10 years ago
|
||
Reporter | ||
Comment 2•10 years ago
|
||
Comment 3•10 years ago
|
||
Reporter | ||
Comment 4•10 years ago
|
||
Comment 5•10 years ago
|
||
Reporter | ||
Comment 6•10 years ago
|
||
Comment 7•10 years ago
|
||
Reporter | ||
Comment 8•10 years ago
|
||
Reporter | ||
Comment 9•10 years ago
|
||
Comment 10•10 years ago
|
||
Reporter | ||
Comment 12•6 years ago
|
||
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Updated•4 years ago
|
Assignee | ||
Comment 13•4 years ago
|
||
Note to self: Reevaluate the inlineSpansWithBrs test case introduced in bug 1525631 when dealing with this bug.
Assignee | ||
Comment 14•4 years ago
|
||
(In reply to Marco Zehe (:MarcoZ) from comment #13)
Note to self: Reevaluate the inlineSpansWithBrs test case introduced in bug 1525631 when dealing with this bug.
Turns out the line offset fix for this bug has no adverse effect on the above mentioned test case at all. This one strictly deals with NextLine getting stuck on an empty or otherwise weird embedded character. "Otherwise weird" in this case refers to a center element that has two form elements inside, as the patch for this bug will fix the offsets for the embedded character for that example, too, see the mochitest patch in bug 1052000.
Assignee | ||
Comment 15•4 years ago
|
||
Jamie, am I right in assuming that the word offsets for the original test case are (0, 1, kEmbedChar) for offset 0, and (1, 2, "b") for offset 1?
Assignee | ||
Comment 16•4 years ago
|
||
On some embedded characters, like ones that are empty, or may contain interactive elements such as form fields, the initial move to the next line from the offset fails. The returned tmpOffset is either the starting offset, or even less than, most likely 0. In this case, and if there are more characters in the HyperText, move to the next character and down. This alone fixes the bit where querying the start and end offsets of line_test_1 for the embed returned the same start and end offsets. The subsequent press of the Home key moves to the start of the next line, and all is well.
If that new tmpOffset and the subsequent press of the Home key result in landing on an embedded character, as is the case for the line starting with an empty embedded character, and querying that offset, pressing End from that offset will also result in that thisLineEndOffset to be less or equal the offset. Return the final nextLineBeginOffset for the embedded character only if that offset is greater or equal to the start offset, and the line end offset is greater than the start offset.
In all other cases, find the real line end, as introduced in bug 1525631, but adjust for the fact that the new tmpOffset might point to the very last position in the HyperText, represented by characterCount. For that case, there is no need to go into the loop, since we know that pressing Home from this position brought us the current calamity in the first place.
Updated•4 years ago
|
Reporter | ||
Comment 17•4 years ago
|
||
(In reply to Marco Zehe (:MarcoZ) from comment #15)
Jamie, am I right in assuming that the word offsets for the original test case are (0, 1, kEmbedChar) for offset 0, and (1, 2, "b") for offset 1?
It's debatable. It could either be that, or alternatively, both offsets 0 and 1 could return (0, 2, kEmbedChar + "b"). I lean towards the latter because if you position the cursor on the "b" and press shift+control+rightArrow then delete, it removes the empty embed. So offset 1 is already correct, but offset 0 is wrong.
This test case I just came up with is even more fun:
data:text/html,<div contenteditable>w1 w2 <a name="foo"></a>w3
With this, not only does the embed return broken offsets, but the entire word before it (w2) breaks as well.
Updated•4 years ago
|
Updated•4 years ago
|
Assignee | ||
Comment 18•4 years ago
|
||
Unassigning myself from this bug to not block others from picking it up. Not expecting to work on this anytime soon. Feel free to use and finish the patch and make it your own.
Updated•3 years ago
|
Reporter | ||
Comment 19•2 years ago
|
||
Fixed by TextLeafPoint, bug 1729407 (currently behind the CTW pref).
Updated•2 years ago
|
Reporter | ||
Comment 20•2 years ago
|
||
This is resolved by Cache the World, which is enabled by default in Firefox 113.
Description
•