Fix a failure of `input-events-get-target-ranges-forwarddelete.tentative.html`, that is "Delete at "<table><tr><td>{}<br></td><td>cell2</td></tr></table>""
Categories
(Core :: DOM: Editor, defect)
Tracking
()
People
(Reporter: masayuki, Assigned: masayuki)
References
Details
Attachments
(1 file)
HTMLEditor shouldn't change table structure by user input like Backspace or Delete. Therefore, if pressing such key with collapsed selection, the range shouldn't extended to outside the closest ancestor any table element. However, we do that. Therefore, we have a known failure:
[Delete at "<table><tr><td>{}<br></td><td>cell2</td></tr></table>"]
Additionally, once bug 242829 is fixed, another test starts failing:
[Delete at "<table><caption>{}<br></caption><tr><td>cell</td></tr></table>"]
I already have a patch to fix this, but that will cause execCommand("delete") and execCommand("forwarddelete") starts returning false in the cases. However, Chrome returns true in the cases. So, we need to adjust the result of execCommand with fixing the bug.
| Assignee | ||
Comment 1•1 year ago
|
||
HTMLEditor won't change the table structure by user inputs. Therefore, if
selection range is collapsed in a <td>, <th> or <caption>, the range
shouldn't be extended as crossing such element boundary.
First, this patch makes AutoClonedRangeArray can override the ancestor limiter
and make AutoDeleteRangesHandler sets it to closest ancestor any table element
if there is.
Next, this patch needs to change the result of execCommand("delete") and
execCommand("forwarddelete") in the cases. Neither editing/run/delete.html
nor editing/run/forwarddelete.html expects execCommand return false even
if nothing is deleted. Additionally, Chrome and Safari pass all the tests.
Therefore, we need to align the result. So, we need the change in
EditorBase::DeleteSelectionAsAction.
Finally, this patch fixes the warning spam in
AutoClonedSelectionRangeArray::ExtendAnchorFocusRangeFor(). If there is
no content to extend the range, nsFrameSelection::CreateRangeExtendedTo*()
returns error [1][2][3][4]. So, if they returned error, it should just return
OK state and does not touch its range.
- https://searchfox.org/mozilla-central/rev/aed442d01309eb6695c4ace1c4d8336e2d6cafc0/layout/generic/nsFrameSelection.cpp#2098-2106
- https://searchfox.org/mozilla-central/rev/aed442d01309eb6695c4ace1c4d8336e2d6cafc0/layout/generic/SelectionMovementUtils.cpp#65-73
- https://searchfox.org/mozilla-central/rev/aed442d01309eb6695c4ace1c4d8336e2d6cafc0/layout/generic/SelectionMovementUtils.cpp#107-109
- https://searchfox.org/mozilla-central/rev/aed442d01309eb6695c4ace1c4d8336e2d6cafc0/layout/generic/nsIFrame.cpp#9639-9642
Description
•