Skip to content

Commit

Permalink
Zoom values for both JS files come from one source
Browse files Browse the repository at this point in the history
Cleanup during review with @bridiver
  • Loading branch information
bsclifton committed Dec 2, 2019
1 parent 41776c0 commit 165e4cf
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 28 deletions.
5 changes: 1 addition & 4 deletions browser/resources/extensions/js_override/pdf/viewport.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,4 @@

<include src="../../../../../../chrome/browser/resources/pdf/viewport.js">

Viewport.ZOOM_FACTORS = [
0.25, 1 / 3, 0.5, 2 / 3, 0.75, 0.8, 0.9, 1, 1.1, 1.25, 1.33, 1.4, 1.5, 1.75, 2, 2.5, 3,
4, 5
];
Viewport.ZOOM_FACTORS = <include src="../../../settings/zoom_factors.json">;
22 changes: 1 addition & 21 deletions browser/resources/settings/brave_settings_overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,27 +105,7 @@ const BraveClearSettingsMenuHighlightBehavior = {

const BraveAddZoomLevelsBehavior = {
ready: function() {
this._setPageZoomLevels_([
1 / 4,
1 / 3,
1 / 2,
2 / 3,
3 / 4,
4 / 5,
9 / 10,
1,
11 / 10,
5 / 4,
4 / 3,
7 / 5,
3 / 2,
7 / 4,
2,
5 / 2,
3,
4,
5,
])
this._setPageZoomLevels_(<include src="./zoom_factors.json">)
}
}

Expand Down
21 changes: 21 additions & 0 deletions browser/resources/settings/zoom_factors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[
0.25,
1 / 3,
0.5,
2 / 3,
0.75,
0.8,
0.9,
1,
1.1,
1.25,
4 / 3,
7 / 5,
1.5,
1.75,
2,
2.5,
3,
4,
5
]
5 changes: 2 additions & 3 deletions chromium_src/components/zoom/page_zoom_constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@

namespace zoom {

// This list is duplicated in chrome/browser/resources/pdf/viewport.js and in
// chrome/browser/resources/settings/appearance_page/appearance_page.js. Please
// make sure the three match.
// This list is duplicated in brave/browser/resources/settings/zoom_factors.json
// When changing this list, please make sure that gets updated also.
const double kPresetZoomFactors[] = {0.25, 1 / 3.0, 0.5, 2 / 3.0, 0.75, 0.8,
0.9, 1.0, 1.1, 1.25, 4 / 3.0, 7 / 5.0,
1.5, 1.75, 2.0, 2.5,
Expand Down

0 comments on commit 165e4cf

Please sign in to comment.