#56089: fix: position the video Picture-in-Picture mute button
Description of Change
Since Electron 42, the mute button in the video Picture-in-Picture window (HTMLVideoElement.requestPictureInPicture()) is drawn at the top-left corner, on top of the favicon and the source title. Like in Chrome, it should be on the bottom row next to the timestamp, at the bottom-right in left-to-right layouts and at the bottom-left in right-to-left layouts.
Cause
Chromium 148 (CL 7682308) added a mute button to the video PiP window and positioned it relative to the live caption button. picture-in-picture.patch compiles the live caption code in VideoOverlayWindowViews::OnUpdateControlsBounds() out with #if 0, and the mute button's SetPosition() call sits inside that same block. The button is still created, since media::kPictureInPictureMuteControl is enabled by default, but it never gets a position and stays at (0,0).
Fix
The #if 0 block now closes before the live caption code, and the mute button is placed in the slot the live caption button would have used, at the trailing edge of the bottom controls. The rest of the live status and live caption code stays compiled out. Views mirrors the layout automatically, so the right-to-left placement needs no extra handling.
The only change to fix_move_autopipsettingshelper_behind_branding_buildflag.patch is new index hashes and line numbers, because it edits the same file after picture-in-picture.patch.
Test
A new spec, places the mute button at the trailing edge of the bottom controls, opens a video PiP window and reads the window's layout through a new testing-only binding, getVideoPictureInPictureLayoutForTesting(). It checks that the mute button is on the bottom row at the trailing edge and below the source title. The binding returns logical (unmirrored) bounds, so the check holds in right-to-left locales too. Without the fix the spec fails (expected 0 to be greater than 247: the button is at x = 0). With the fix it passes, as does the existing PiP spec.
Manual verification
Unfixed main (top row) and main plus this fix (bottom row), each in an LTR (en-US) and an RTL (he) locale:
pip-mute-button-position-fix.mp4
Checklist
- I have built and tested this change
- I have filled out the PR description
- I have reviewed and verified the changes
-
npm testpasses - tests are changed or added
- relevant API documentation, tutorials, and examples are updated and follow the documentation style guide
- PR release notes describe the change in a way relevant to app developers, and are capitalized, punctuated, past tense, and no longer than 80 characters.
This PR fixes #56006.
Assisted-By: Claude Opus 5.5, Claude Code
Release Notes
Notes: Fixed the video Picture-in-Picture mute button being drawn over the window title.
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