Skip to content

chore: remove macos hittest workaround patch#51699

Merged
jkleinsc merged 3 commits into
41-x-yfrom
chore/view-macos-fixup--41-x-y
May 27, 2026
Merged

chore: remove macos hittest workaround patch#51699
jkleinsc merged 3 commits into
41-x-yfrom
chore/view-macos-fixup--41-x-y

Conversation

@ckerr

@ckerr ckerr commented May 19, 2026

Copy link
Copy Markdown
Member

Manual backport of #50330 and followup bugfix #51586. See those PRs for details.

These required a little bit of manual work due to shear between Electron branches.

All reviews welcomed! CC @codebytere and @nmggithub as stakeholders since they were the original authors of 50330 and 51586.

Notes: none.

codebytere and others added 2 commits May 19, 2026 11:46
Reverts the temporary Chromium patch and restores the original macOS hit-test workaround behavior in Electron.

Co-authored-by: Charles Kerr <charles@charleskerr.com>
Restore the macOS hit-testing behavior that keeps BrowserWindow web contents interactive when content_view_ has no matching child.

Co-authored-by: Charles Kerr <charles@charleskerr.com>
@ckerr ckerr requested a review from nmggithub May 19, 2026 17:04
@ckerr ckerr requested a review from a team as a code owner May 19, 2026 17:04
@ckerr ckerr added backport This is a backport PR semver/patch backwards-compatible bug fixes no-backport 41-x-y labels May 19, 2026
@nmggithub

Copy link
Copy Markdown
Contributor

Not sure what the plan is around @MarshallOfSound's follow-up here (#51617), but I think their approach is actually the better one long-term. Reading that PR, though, it seems this issue does not exhibit in 41?

@ckerr

ckerr commented May 19, 2026

Copy link
Copy Markdown
Member Author

Not sure what the plan is around @MarshallOfSound's follow-up here (#51617), but I think their approach is actually the better one long-term. Reading that PR, though, it seems this issue does not exhibit in 41?

This is a good point. There are two things going on here:

  1. The reason 51617 says 51586 doesn't affect 41-x-y is because 50330 wasn't backported to 40-x-y.

  2. But this current PR does backport 50330 to 40-x-y, which is why I was combining both this and the followup fix.

So probably what I ought to do is replace 51586 with 51617 in this PR.

@ckerr ckerr marked this pull request as draft May 19, 2026 20:49
fix: simplify content_view_ hit-test transparency on macOS

Replace the RootViewMac-level TargetForRect override added in #51586 with
a DoesIntersectRect override on content_view_'s own targeter, restoring
the structure of #50330 but fixing its actual defect.

The original bug (#51576) was that ContentViewTargeterDelegate::TargetForRect
returned nullptr when no descendant covered the hit rect, violating the
ViewTargeterDelegate contract. RootView::UpdateCursor and
RootView::HandleMouseEnteredOrMoved dereference GetEventHandlerForPoint()
without null checks, so the nullptr crashed with SIGSEGV when a right-click
in a -webkit-app-region: drag region disabled the HTCAPTION early-exit.

re-implementing the parent targeter's child-walk loop so it could skip
content_view_ and return a sibling instead. That re-implementation duplicates
~25 lines of upstream logic with a subtle rounding divergence
(ToEnclosedRectIgnoringError vs ToEnclosingRect), and threads a new
content_view_hit_test_transparent_ flag through the platform-neutral
NativeWindow/BrowserWindow headers.

The same fall-through can be achieved with the existing hit-test hook:
override DoesIntersectRect on content_view_ to return false when no
visible, processable child intersects the rect. The parent's default
TargetForRect loop already skips children whose HitTestRect is false, so
hit-testing naturally continues to the WebContentsView sibling and resolves
to its NativeViewHost (kSubView) without ever returning nullptr from
TargetForRect or re-implementing the walk.

This reverts the NativeWindow flag, the BrowserWindow constructor change,
and the RootViewMacTargeterDelegate, leaving the fix entirely in
native_window_mac.mm at the same install site as #50330.

Co-authored-by: GitHub Copilot <copilot@github.com>
@ckerr ckerr marked this pull request as ready for review May 20, 2026 02:15
@jkleinsc jkleinsc merged commit 17020b8 into 41-x-y May 27, 2026
67 checks passed
@jkleinsc jkleinsc deleted the chore/view-macos-fixup--41-x-y branch May 27, 2026 14:16
@release-clerk

release-clerk Bot commented May 27, 2026

Copy link
Copy Markdown

No Release Notes

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

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants