Fix Incorrect Ellipsis Offset When Printing Selections
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox-esr68 | --- | unaffected |
firefox-esr78 | --- | wontfix |
firefox79 | --- | wontfix |
firefox80 | --- | verified |
People
(Reporter: nordzilla, Assigned: nordzilla)
References
(Regression)
Details
(Keywords: regression)
Attachments
(2 files)
Bug 1620289 modified the behavior of printing selection ranges to remove its dependency on the original document's current selections.
To solve this, the selected ranges are cached on the static clone of the document when printing is invoked.
To print only the selections, the complement set of ranges (the non-selected data) is deleted from the cloned document and ellipses are added where appropriate (when content is cut off within text in the same node).
The old way of achieving this involved traversing both the original document and the static clone at the same time, deleting the relevant data in the clone while keeping track of the same position in the original. This led to code that would need to offset the position in the original document based on the addition of an ellipsis in the cloned document.
Now that the original document is no longer involved in this process, we no longer need to separately keep track of the difference in position with the added ellipses. It is now implicitly taken care of in the modification to the node itself.
Failing to remove the code that explicitly accounted for the added ellipses was causing an off-by-one issue with some printing selections, reported in Bug 1652746. This issue occurs especially when there are multiple selections within the same text (see attached image).
The attached image shows (from left to right):
- The highlighted text in the test case
- The incorrect output caused by the regression.
- The output before the regression.
- The output after applying this patch.
Assignee | ||
Comment 1•4 years ago
|
||
- Fix double-counted ellipsis offset.
- Rename unselected to nonselected for consistency.
Updated•4 years ago
|
Comment 3•4 years ago
|
||
bugherder |
Updated•4 years ago
|
Updated•4 years ago
|
Comment 5•4 years ago
|
||
Reproduced the initial issue using old Nightly from 2020-07-21, verified that using Firefox 80.0 this does not reproduce anymore across platforms (Windows 10 64bit, Ubuntu 18.04, macOS 10.15.6).
Updated•4 years ago
|
Description
•