-
Notifications
You must be signed in to change notification settings - Fork 888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated zoom constants and pages to resolve issue #6943 #4092
Conversation
Very nice! I think we can do this without patches (we have a mechanism that overrides the files at the GN level). Let me see if I can re-work your PR... 😄 |
Ahh, thank you, got it! Just for my reference, is it the subclass/override method listed in the patching chromium wiki, or something else entirely? |
@fow5040 I thought it would be a slam dunk, but it's actually a little trickier... That wiki entry is exactly what would work for the C/C++ ones 😄I made an edit which does that here: e3b534c The JavaScript ones are a bit tougher; we do have a template system in which you can define a "behavior" which would then (at runtime) replace the array. I have this working... but only if I change the array to be My edit (so far) looks like this: diff --git a/browser/resources/settings/brave_settings_overrides.js b/browser/resources/settings/brave_settings_overrides.js
index c55966d30..7a4ab6f2d 100644
--- a/browser/resources/settings/brave_settings_overrides.js
+++ b/browser/resources/settings/brave_settings_overrides.js
@@ -103,8 +103,43 @@ const BraveClearSettingsMenuHighlightBehavior = {
}
}
+const BraveAddZoomLevelsBehavior = {
+ ready: function() {
+ console.log('BSC]] START ', this.pageZoomLevels_)
+ this.pageZoomLevels_Handler = function(levels) {
+ this._setPageZoomLevels_(levels);
+ }
+
+ this.pageZoomLevels_ = [
+ 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,
+ ]
+ console.log('BSC]] END')
+ }
+}
+
// Polymer Component Behavior injection (like superclasses)
BravePatching.RegisterPolymerComponentBehaviors({
+ 'settings-appearance-page': [
+ BraveAddZoomLevelsBehavior
+ ],
'settings-clear-browsing-data-dialog': [
BraveClearBrowsingDataOnExitBehavior
], |
Got it! Thanks for updating this thread with examples, will keep it in mind for any potential future contributions. :) |
You're very welcome! Thanks for taking the time to fix this, it's greatly appreciated 😄 We try to be more careful about patching (as you saw in the guide) to help keep rebases (when new Chromium versions come out) much easier. Will help with this last example (it's a little trickier) then we can accept this! 😎 This fix would be a great one to upstream, honestly- I could help you push it to Chromium if you were interested. Let me know 😄 |
Absolutely - will keep these changes in mind (including the fancy viewport .js overrides). If you think it'd be a valuable change to merge with Chromium I'd be happy to put it there as well! As far as I'm concerned I just did a little bit of digging and some minor tweaking, but always happy to push it if it'll be useful to the user base at large. Thanks again for all the guidance 🙌 |
@fow5040 with the help of @simonhong I was able to solve the last one 😄 No more patches! Please take a look; you should be able to pull this PR down now and verify it works for you BTW - I added a test plan that covers the 3 areas called out in the source @bridiver this is now ready for review 😄👍 |
and whoops; a little too quick there on my part (doh). I loaded up print preview and noticed this error:
It doesn't appear that the pre-processing is happening for this file (the import should be getting replaced with the actual content) |
Fix found! Thanks @simonhong OK - @bridiver, this is ready for review 😄 |
f88e7e1
to
e25def3
Compare
Only updates one of the 3 places... (working through the other 2 now)
This updates the second of 3 places needing to be changed (working through last one)
…s used for Zoom in viewport.js For more info, see: https://chromium.googlesource.com/chromium/src.git/+/master/styleguide/web/web.md#preprocessing
bdb64f2
to
41776c0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 Tested on macOS
Cleanup during review with @bridiver
66afaf1
to
165e4cf
Compare
and merged! Thanks for the PR, @fow5040 😄 |
…evels" Reason for revert: this change has been upstreamed: https://chromium.googlesource.com/chromium/src/+/08b57c09851e2bdcb39ea70e46707f3bab6a0a4a This reverts commit 88c7229, reversing changes made to 01f83c7.
#4092 was reverted in a separate commit because it is now in Chromium: https://chromium.googlesource.com/chromium/src/+/08b57c09851e2bdcb39ea70e46707f3bab6a0a4a The only difference upstream is 2 additional zoom values we had in Brave. This readds those values (4 / 3.0 and 7 / 5.0).
…evels" Reason for revert: this change has been upstreamed: https://chromium.googlesource.com/chromium/src/+/08b57c09851e2bdcb39ea70e46707f3bab6a0a4a This reverts commit 88c7229, reversing changes made to 01f83c7.
#4092 was reverted in a separate commit because it is now in Chromium: https://chromium.googlesource.com/chromium/src/+/08b57c09851e2bdcb39ea70e46707f3bab6a0a4a The only difference upstream is 2 additional zoom values we had in Brave. This readds those values (4 / 3.0 and 7 / 5.0).
…evels" Reason for revert: this change has been upstreamed: https://chromium.googlesource.com/chromium/src/+/08b57c09851e2bdcb39ea70e46707f3bab6a0a4a This reverts commit 88c7229, reversing changes made to 01f83c7.
#4092 was reverted in a separate commit because it is now in Chromium: https://chromium.googlesource.com/chromium/src/+/08b57c09851e2bdcb39ea70e46707f3bab6a0a4a The only difference upstream is 2 additional zoom values we had in Brave. This readds those values (4 / 3.0 and 7 / 5.0).
…evels" Reason for revert: this change has been upstreamed: https://chromium.googlesource.com/chromium/src/+/08b57c09851e2bdcb39ea70e46707f3bab6a0a4a This reverts commit 88c7229, reversing changes made to 01f83c7.
#4092 was reverted in a separate commit because it is now in Chromium: https://chromium.googlesource.com/chromium/src/+/08b57c09851e2bdcb39ea70e46707f3bab6a0a4a The only difference upstream is 2 additional zoom values we had in Brave. This readds those values (4 / 3.0 and 7 / 5.0).
…evels" Reason for revert: this change has been upstreamed: https://chromium.googlesource.com/chromium/src/+/08b57c09851e2bdcb39ea70e46707f3bab6a0a4a This reverts commit 88c7229, reversing changes made to 01f83c7.
#4092 was reverted in a separate commit because it is now in Chromium: https://chromium.googlesource.com/chromium/src/+/08b57c09851e2bdcb39ea70e46707f3bab6a0a4a The only difference upstream is 2 additional zoom values we had in Brave. This readds those values (4 / 3.0 and 7 / 5.0).
Fix brave/brave-browser#6943
Submitter Checklist:
npm run lint
)git rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
Inspect
window.viewer.viewport_.internalZoom_
Reviewer Checklist:
After-merge Checklist:
changes has landed on.