Closed Bug 1654406 Opened 4 years ago Closed 4 years ago

Fix Incorrect Ellipsis Offset When Printing Selections

Categories

(Core :: DOM: Core & HTML, defect)

80 Branch
defect

Tracking

()

VERIFIED FIXED
mozilla80
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.
  • Fix double-counted ellipsis offset.
  • Rename unselected to nonselected for consistency.
Pushed by dluca@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/cc83430bf63a Fix Incorrect Ellipsis Offset When Printing Selections r=bobowen
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Regressions: 1655179
No longer regressions: 1655179
Flags: qe-verify+

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).

Status: RESOLVED → VERIFIED
Flags: qe-verify+
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: