#54381: fix: keep the zoom level of file: and other host-less pages across fragment navigations
Description of Change
Fixes #44526.
After this change a loadFile() page (or any URL without a host) keeps its zoom level across location.hash changes; today the next zoomIn/zoomOut after a hash change starts over from 100%.
HostZoomMap keys zoom levels by host, and by the full URL spec, fragment included, when there is no host. A hash change therefore moved the page to a new key: getZoomLevel() fell back to the default while the renderer kept the old zoom, and the next step was computed from the default. Pages with a host were never affected.
This carries the upstream fix, https://chromium-review.googlesource.com/c/chromium/src/+/8467669 (https://crbug.com/565900884), as a patch until it rolls in: the keying URL drops its fragment in the one helper every zoom call site uses, including Electron's WebContentsZoomController. A spec loads a file page, sets level 2, changes the hash and expects 2; main reads 0.
Checklist
- I have built and tested this change
- I have filled out the PR description
- I have reviewed and verified the changes
- tests are changed or added
Release Notes
Notes: Fixed the zoom level resetting on file: and other host-less pages after a location.hash change.
Backports
Semver Impact
Semantic Versioning helps users understand the impact of updates:
- Major (X.y.z): Breaking changes that may require code modifications
- Minor (x.Y.z): New features that maintain backward compatibility
- Patch (x.y.Z): Bug fixes that don't change the API
- None: Changes that don't affect using facing parts of Electron