Bug 1896892 - Remove the double-escaping of backslashes when writing links to the cairo-pdf backend. r=gfx-reviewers,jrmuizel

This reverts part of bug 1748077, which was working around a quirk of
the cairo pdf backend. The behavior there was fixed upstream in
https://gitlab.freedesktop.org/cairo/cairo/-/issues/526, so since we've
updated to cairo-1.18.0 we no longer need this; it would in fact make
links with backslashes be recorded incorrectly.

Differential Revision: https://phabricator.services.mozilla.com/D210479
This commit is contained in:
Jonathan Kew 2024-05-15 13:58:13 +00:00
parent 578dc97928
commit c6df5f3132

View file

@ -665,9 +665,6 @@ void DrawTargetCairo::Link(const char* aDestination, const Rect& aRect) {
//
// We also need to escape any backslashes (bug 1748077), as per doc at
// https://www.cairographics.org/manual/cairo-Tags-and-Links.html#cairo-tag-begin
// The cairo-pdf-interchange backend (used on all platforms EXCEPT macOS)
// actually requires that we *doubly* escape the backslashes (this may be a
// cairo bug), while the quartz backend is fine with them singly-escaped.
//
// (Encoding of non-ASCII chars etc gets handled later by the PDF backend.)
nsAutoCString dest(aDestination);
@ -676,11 +673,7 @@ void DrawTargetCairo::Link(const char* aDestination, const Rect& aRect) {
if (dest[i] == '\'') {
dest.ReplaceLiteral(i, 1, "\\'");
} else if (dest[i] == '\\') {
#ifdef XP_MACOSX
dest.ReplaceLiteral(i, 1, "\\\\");
#else
dest.ReplaceLiteral(i, 1, "\\\\\\\\");
#endif
}
}