Skip to content

Mark Rect::containsPoint const - #60356

Open
lazerg wants to merge 1 commit into
react:mainfrom
lazerg:fix/issue-60349-rect-contains-point-const
Open

lazerg wants to merge 1 commit into
react:mainfrom
lazerg:fix/issue-60349-rect-contains-point-const

Conversation

@lazerg

@lazerg lazerg commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Summary:

Rect::containsPoint only reads origin and size, but unlike getMaxX(), getCenter() and the other getters next to it, it isn't marked const. So code holding a const Rect & can't call it without copying the rect first. This adds const and updates the C++ API snapshots to match.

Fixes #60349

Changelog:

[GENERAL] [FIXED] - Rect::containsPoint can now be called on a const Rect

Test Plan:

Compiled the probe from the issue (containsPoint on a const Rect &) with clang++ -std=c++20 -fsyntax-only against ReactCommon. It fails with "function is not marked const" on main and compiles with this change. The two existing callers in LayoutableShadowNode.cpp use non-const rects, so they're unaffected.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 28, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Nov 28, 2026
@github-actions github-actions Bot added the Meta Review Required This PR is considered risky and requires Meta to import it to do more testing before merging. label Nov 28, 2026

This branch has not been deployed

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Meta Review Required This PR is considered risky and requires Meta to import it to do more testing before merging. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rect::containsPoint is not const, so a const Rect cannot be asked whether it holds a point

1 participant