From 6806248030fdc24b985a610e6dc4123b50c73a7a Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 27 Jan 2019 12:07:38 +0100 Subject: [PATCH] Modify a number of the viewer preferences, whose current default value is `0`, such that they behave as expected with the view history The intention with preferences such as `sidebarViewOnLoad`/`scrollModeOnLoad`/`spreadModeOnLoad` were always that they should be able to *unconditionally* override their view history counterparts. Due to the way that these preferences were initially implemented[1], trying to e.g. force the sidebar to remain hidden on load cannot be guaranteed[2]. The reason for this is the use of "enumeration values" containing zero, which in hindsight was an unfortunate choice on my part. At this point it's also not as simple as just re-numbering the affected structures, since that would wreak havoc on existing (modified) preferences. The only reasonable solution that I was able to come up with was to change the *default* values of the preferences themselves, but not their actual values or the meaning thereof. As part of the refactoring, the `disablePageMode` preference was combined with the *adjusted* `sidebarViewOnLoad` one, to hopefully reduce confusion by not tracking related state separately. Additionally, the `showPreviousViewOnLoad` and `disableOpenActionDestination` preferences were combined into a *new* `viewOnLoad` enumeration preference, to further avoid tracking related state separately. --- extensions/chromium/options/options.html | 16 +++++ extensions/chromium/preferences_schema.json | 33 ++++++---- web/app.js | 71 ++++++++++++--------- web/app_options.js | 26 +++----- web/base_viewer.js | 27 ++------ web/default_preferences.json | 10 ++- web/pdf_sidebar.js | 8 ++- web/secondary_toolbar.js | 3 +- web/ui_utils.js | 28 ++++++++ 9 files changed, 132 insertions(+), 90 deletions(-) diff --git a/extensions/chromium/options/options.html b/extensions/chromium/options/options.html index 412e80bb1..57ddae7b1 100644 --- a/extensions/chromium/options/options.html +++ b/extensions/chromium/options/options.html @@ -43,6 +43,19 @@ body { + +