Bug 1725743 - Put the use of internal PDF destinations behind a pref, and disable by default due to possible cairo assertions. r=jrmuizel

Differential Revision: https://phabricator.services.mozilla.com/D123650
This commit is contained in:
Jonathan Kew 2021-08-25 16:28:43 +00:00
parent fe7e7e5b9b
commit ef07bb0d84
2 changed files with 19 additions and 6 deletions

View File

@ -34,6 +34,7 @@
#include "mozilla/StaticPrefs_gfx.h"
#include "mozilla/StaticPrefs_layers.h"
#include "mozilla/StaticPrefs_layout.h"
#include "mozilla/StaticPrefs_print.h"
#include "mozilla/SVGIntegrationUtils.h"
#include "mozilla/SVGUtils.h"
#include "mozilla/ViewportUtils.h"
@ -569,11 +570,14 @@ nsDisplayListBuilder::Linkifier::Linkifier(nsDisplayListBuilder* aBuilder,
}
}
};
if (elem->HasID()) {
maybeGenerateDest(nsGkAtoms::id);
}
if (elem->HasName()) {
maybeGenerateDest(nsGkAtoms::name);
if (StaticPrefs::print_save_as_pdf_internal_destinations_enabled()) {
if (elem->HasID()) {
maybeGenerateDest(nsGkAtoms::id);
}
if (elem->HasName()) {
maybeGenerateDest(nsGkAtoms::name);
}
}
// Links don't nest, so if the builder already has a destination, no need to
@ -591,7 +595,8 @@ nsDisplayListBuilder::Linkifier::Linkifier(nsDisplayListBuilder* aBuilder,
// Is it a local (in-page) destination?
bool hasRef, eqExRef;
nsIURI* docURI;
if (NS_SUCCEEDED(uri->GetHasRef(&hasRef)) && hasRef &&
if (StaticPrefs::print_save_as_pdf_internal_destinations_enabled() &&
NS_SUCCEEDED(uri->GetHasRef(&hasRef)) && hasRef &&
(docURI = aFrame->PresContext()->Document()->GetDocumentURI()) &&
NS_SUCCEEDED(uri->EqualsExceptRef(docURI, &eqExRef)) && eqExRef) {
if (NS_FAILED(uri->GetRef(aBuilder->mLinkSpec)) ||

View File

@ -10234,6 +10234,14 @@
value: true
mirror: always
# Whether we attempt to generate and use document-internal PDF destinations.
# This currently sometimes results in an internal cairo error, see bug 1725743;
# disabled by default until that is resolved.
- name: print.save_as_pdf.internal_destinations.enabled
type: RelaxedAtomicBool
value: false
mirror: always
# The default DPI for printing.
#
# For PDF-based output, DPI should ideally be irrelevant, but in fact it is not