Skip to content

fix: make webContents.centerSelection() work on Windows and Linux - #55950

Merged
dsanders11 merged 1 commit into
44-x-yfrom
manual-bp/claude/pr/55909/branch/44-x-y
Nov 20, 2026
Merged

dsanders11 merged 1 commit into
44-x-yfrom
manual-bp/claude/pr/55909/branch/44-x-y

Conversation

@claude

@claude claude Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Requested by David Babenko-Sanders · Slack thread

Description of Change

Manually backport #55909. See that PR for details.

CC @dsanders11

Resolved a spec conflict caused by the disableWakeLocks tests that do not exist on 44-x-y, dropped an unrelated .patches line that came in through the union merge, and regenerated the Chromium patch against 44-x-y's Chromium 152 (line offsets and index hashes only).

Checklist

🤖 Generated with Claude Code

https://claude.ai/code/session_01KX1hkPAirbYV7a7v3Ck4FB

Release Notes

Notes: Fixed webContents.centerSelection() so that it works on Windows and Linux.


Generated by Claude Code

…5909)

* fix: make webContents.centerSelection() work on Windows and Linux

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KX1hkNiiBq2fQEsXWusxpm

* test: wait for the centred position in the centerSelection spec

Wait until the middle of the selection is within tolerance of the middle
of the viewport instead of until the page has scrolled at all, and say
why we wait: centerSelection() reaches the renderer asynchronously, but
the scroll itself (RevealSelection -> ScrollRectToVisible) is instant
since the page does not use CSS smooth scrolling.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KX1hkNiiBq2fQEsXWusxpm

---------

Co-authored-by: Claude <[email protected]>
(cherry picked from commit ef8d809)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KX1hkPAirbYV7a7v3Ck4FB
@claude
claude Bot requested a review from a team as a code owner November 19, 2026 06:44
@trop
trop Bot requested review from dsanders11 and jkleinsc November 19, 2026 06:44
@trop trop Bot added 44-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Nov 19, 2026

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed this backport and didn't find any bugs. It adds a new Chromium patch under patches/, which has code owners, and I reviewed it from a standalone clone without the Chromium source, so it's worth having a patch owner look at it too.

What was reviewed:

  • The new patch only removes the #if BUILDFLAG(IS_MAC)/#endif pair around the body of WebContentsImpl::CenterSelection(). Its header and commit message say why the patch is needed and when it can be dropped. It is added at the end of patches/chromium/.patches (line 511).
  • The new centerSelection() spec is tagged serial because it uses a shown, focused window. It uses vitest matchers, and both helpers it uses (focusWebContents, waitUntil) exist in spec/lib/spec-helpers.ts. The docs for contents.centerSelection() and <webview>.centerSelection() have no platform tag, so no docs change is needed.
  • Not done: I didn't check the hunk against Chromium 152's web_contents_impl.cc (it's not in this clone), and I didn't run the spec or a build.
Extended reasoning...

The PR adds a two-line Chromium patch that removes a macOS-only guard in WebContentsImpl::CenterSelection(), lists it in patches/chromium/.patches, and adds a serial-tagged spec in spec/api-web-contents.spec.ts. It doesn't touch any security-sensitive code (no IPC handlers, permissions or webPreferences). /patches/ is owned by patch-owners in .github/CODEOWNERS, so I didn't approve it. The review used a standalone clone, so I couldn't check the upstream file the patch targets, and the PR checklist says the author hasn't built or tested the change.

@dsanders11
dsanders11 enabled auto-merge (squash) November 19, 2026 06:47
@dsanders11
dsanders11 merged commit 3e72c04 into 44-x-y Nov 20, 2026
95 checks passed
@dsanders11
dsanders11 deleted the manual-bp/claude/pr/55909/branch/44-x-y branch November 20, 2026 17:14
@release-clerk

release-clerk Bot commented Nov 20, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed webContents.centerSelection() so that it works on Windows and Linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

44-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants