Merge pull request #3018 from Snuffleupagus/detect-colors-disabled

Detect and add fallback if document colors are disabled in Firefox
This commit is contained in:
Yury Delendik 2013-04-03 10:03:18 -07:00
commit 55d850eb42
4 changed files with 25 additions and 1 deletions

View File

@ -383,6 +383,9 @@ ChromeActions.prototype = {
var prefGfx = getBoolPref('gfx.downloadable_fonts.enabled', true);
return (!!prefBrowser && prefGfx);
},
supportsDocumentColors: function() {
return getBoolPref('browser.display.use_document_colors', true);
},
fallback: function(url, sendResponse) {
var self = this;
var domWindow = this.domWindow;

View File

@ -123,3 +123,4 @@ request_password=PDF is protected by a password:
printing_not_supported=Warning: Printing is not fully supported by this browser.
printing_not_ready=Warning: The PDF is not fully loaded for printing.
web_fonts_disabled=Web fonts are disabled: unable to use embedded PDF fonts.
web_colors_disabled=Web colors are disabled.

View File

@ -122,4 +122,5 @@ request_password=PDF-filen är lösenordsskyddad:
printing_not_supported=Varning: Utskrifter stöds inte fullt ut av denna webbläsare.
printing_not_ready=Varning: Hela PDF-filen måste laddas innan utskrift kan ske.
web_fonts_disabled=Webbtypsnitt är inaktiverade: Typsnitt inkluderade i PDF-filer kan ej användas.
web_fonts_disabled=Webbtypsnitt är inaktiverade: Typsnitt inbäddade i PDF-filer kan ej användas.
web_colors_disabled=Webbfärger är inaktiverade.

View File

@ -922,6 +922,19 @@ var PDFView = {
return support;
},
get supportsDocumentColors() {
var support = true;
//#if !(FIREFOX || MOZCENTRAL)
//#else
// support = FirefoxCom.requestSync('supportsDocumentColors');
//#endif
Object.defineProperty(this, 'supportsDocumentColors', { value: support,
enumerable: true,
configurable: true,
writable: false });
return support;
},
get isHorizontalScrollbarEnabled() {
var div = document.getElementById('viewerContainer');
return div.scrollWidth > div.clientWidth;
@ -2263,6 +2276,12 @@ var PageView = function pageView(container, id, scale,
// 'Web fonts are disabled: unable to use embedded PDF fonts.'));
// PDFView.fallback();
// }
// if (self.textLayer && self.textLayer.textDivs.length &&
// !PDFView.supportsDocumentColors) {
// console.error(mozL10n.get('web_colors_disabled', null,
// 'Web colors are disabled.'));
// PDFView.fallback();
// }
//#endif
if (error) {
PDFView.error(mozL10n.get('rendering_error', null,