Upgrade react/renderer/dom visibility to "for frameworks" (#59032)

Summary:
Pull Request resolved: https://github.com/react/react-native/pull/59032

Reclassifies `react/renderer/dom` from private to "for frameworks" under the C++ stable API three-tier visibility model.

Third-party frameworks rely on these shadow tree helpers; for example, `react-native-reanimated` calls `dom::getParentNode` to resolve a node's parent in the current revision. As a private header, `DOM.h` would hard-error for such consumers once they opt into `RN_STRICT_API`, with no escape hatch. As a "for frameworks" header it emits a suppressible warning that can be acknowledged with `RN_ALLOW_FRAMEWORKS`. Without `RN_STRICT_API` the guards are inert, so no existing build changes behaviour.

`DOM.h` only reaches `RootShadowNode.h` ("for frameworks") and `ShadowNode.h` (public), so the retier introduces no tier boundary breaks. `react/nativemodule/dom` (the `NativeDOM` TurboModule) stays private.

Changelog: [Internal]

___

landed-with-radar-review

Differential Revision: D124966422

fbshipit-source-id: 907dccb0a764fa3e094b1e0f57257b71c7e25ef8
This commit is contained in:
Jakub Piasecki authored and meta-codesync[bot] committed 2026-10-14 02:31:21 -07:00
1 parent d6d816c881
commit 8aa97bb8cb
4 files changed
+187 -1

No files matched your search

@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/PrivateGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <react/renderer/components/root/RootShadowNode.h>
#include <react/renderer/core/ShadowNode.h>
@@ -8732,6 +8732,68 @@ concept facebook::react::detail::css::keywords::hasWrapReverse = (CSSKeywordSet<
constexpr facebook::react::Color facebook::react::HostPlatformColor::UndefinedColor;
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_CONTAINED_BY;
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_CONTAINS;
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_DISCONNECTED;
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_FOLLOWING;
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_PRECEDING;
bool facebook::react::dom::isConnected(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
facebook::react::dom::DOMBorderWidthRounded facebook::react::dom::getBorderWidth(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
facebook::react::dom::DOMOffset facebook::react::dom::getOffset(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
facebook::react::dom::DOMPoint facebook::react::dom::getScrollPosition(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
facebook::react::dom::DOMRect facebook::react::dom::getBoundingClientRect(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode, bool includeTransform);
facebook::react::dom::DOMRect facebook::react::dom::measureInWindow(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
facebook::react::dom::DOMSizeRounded facebook::react::dom::getInnerSize(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
facebook::react::dom::DOMSizeRounded facebook::react::dom::getScrollSize(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
facebook::react::dom::RNMeasureRect facebook::react::dom::measure(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
std::optional<facebook::react::dom::DOMRect> facebook::react::dom::measureLayout(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode, const facebook::react::ShadowNode& relativeToShadowNode);
std::shared_ptr<const facebook::react::ShadowNode> facebook::react::dom::getElementById(const std::shared_ptr<const facebook::react::ShadowNode>& currentRevision, const std::string& id);
std::shared_ptr<const facebook::react::ShadowNode> facebook::react::dom::getParentNode(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
std::string facebook::react::dom::getTagName(const facebook::react::ShadowNode& shadowNode);
std::string facebook::react::dom::getTextContent(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
std::vector<std::shared_ptr<const facebook::react::ShadowNode>> facebook::react::dom::getChildNodes(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
uint_fast16_t facebook::react::dom::compareDocumentPosition(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode, const facebook::react::ShadowNode& otherShadowNode);
struct facebook::react::dom::DOMBorderWidthRounded {
public int bottom;
public int left;
public int right;
public int top;
}
struct facebook::react::dom::DOMOffset {
public double left;
public double top;
public std::shared_ptr<const facebook::react::ShadowNode> offsetParent;
}
struct facebook::react::dom::DOMPoint {
public double x;
public double y;
}
struct facebook::react::dom::DOMRect {
public double height;
public double width;
public double x;
public double y;
}
struct facebook::react::dom::DOMSizeRounded {
public int height;
public int width;
}
struct facebook::react::dom::RNMeasureRect {
public double height;
public double pageX;
public double pageY;
public double width;
public double x;
public double y;
}
std::shared_ptr<const facebook::react::ComponentDescriptorProviderRegistry> facebook::react::CoreComponentsRegistry::sharedProviderRegistry();
void facebook::react::CoreComponentsRegistry::addCoreComponents(std::shared_ptr<const facebook::react::ComponentDescriptorProviderRegistry> registry);
@@ -10644,6 +10644,68 @@ template <typename T>
concept facebook::react::detail::css::keywords::hasWrapReverse = (CSSKeywordSet<T> && requires() { T::WrapReverse; });
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_CONTAINED_BY;
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_CONTAINS;
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_DISCONNECTED;
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_FOLLOWING;
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_PRECEDING;
bool facebook::react::dom::isConnected(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
facebook::react::dom::DOMBorderWidthRounded facebook::react::dom::getBorderWidth(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
facebook::react::dom::DOMOffset facebook::react::dom::getOffset(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
facebook::react::dom::DOMPoint facebook::react::dom::getScrollPosition(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
facebook::react::dom::DOMRect facebook::react::dom::getBoundingClientRect(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode, bool includeTransform);
facebook::react::dom::DOMRect facebook::react::dom::measureInWindow(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
facebook::react::dom::DOMSizeRounded facebook::react::dom::getInnerSize(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
facebook::react::dom::DOMSizeRounded facebook::react::dom::getScrollSize(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
facebook::react::dom::RNMeasureRect facebook::react::dom::measure(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
std::optional<facebook::react::dom::DOMRect> facebook::react::dom::measureLayout(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode, const facebook::react::ShadowNode& relativeToShadowNode);
std::shared_ptr<const facebook::react::ShadowNode> facebook::react::dom::getElementById(const std::shared_ptr<const facebook::react::ShadowNode>& currentRevision, const std::string& id);
std::shared_ptr<const facebook::react::ShadowNode> facebook::react::dom::getParentNode(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
std::string facebook::react::dom::getTagName(const facebook::react::ShadowNode& shadowNode);
std::string facebook::react::dom::getTextContent(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
std::vector<std::shared_ptr<const facebook::react::ShadowNode>> facebook::react::dom::getChildNodes(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
uint_fast16_t facebook::react::dom::compareDocumentPosition(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode, const facebook::react::ShadowNode& otherShadowNode);
struct facebook::react::dom::DOMBorderWidthRounded {
public int bottom;
public int left;
public int right;
public int top;
}
struct facebook::react::dom::DOMOffset {
public double left;
public double top;
public std::shared_ptr<const facebook::react::ShadowNode> offsetParent;
}
struct facebook::react::dom::DOMPoint {
public double x;
public double y;
}
struct facebook::react::dom::DOMRect {
public double height;
public double width;
public double x;
public double y;
}
struct facebook::react::dom::DOMSizeRounded {
public int height;
public int width;
}
struct facebook::react::dom::RNMeasureRect {
public double height;
public double pageX;
public double pageY;
public double width;
public double x;
public double y;
}
facebook::jsi::Value facebook::react::TurboModuleConvertUtils::convertObjCObjectToJSIValue(facebook::jsi::Runtime& runtime, id value);
id facebook::react::TurboModuleConvertUtils::convertJSIValueToObjCObject(facebook::jsi::Runtime& runtime, const facebook::jsi::Value& value, const std::shared_ptr<facebook::react::CallInvoker>& jsInvoker, BOOL useNSNull = NO, BOOL mustCopyBytes = YES);
@@ -5971,6 +5971,68 @@ template <typename T>
concept facebook::react::detail::css::keywords::hasWrapReverse = (CSSKeywordSet<T> && requires() { T::WrapReverse; });
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_CONTAINED_BY;
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_CONTAINS;
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_DISCONNECTED;
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_FOLLOWING;
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_PRECEDING;
bool facebook::react::dom::isConnected(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
facebook::react::dom::DOMBorderWidthRounded facebook::react::dom::getBorderWidth(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
facebook::react::dom::DOMOffset facebook::react::dom::getOffset(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
facebook::react::dom::DOMPoint facebook::react::dom::getScrollPosition(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
facebook::react::dom::DOMRect facebook::react::dom::getBoundingClientRect(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode, bool includeTransform);
facebook::react::dom::DOMRect facebook::react::dom::measureInWindow(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
facebook::react::dom::DOMSizeRounded facebook::react::dom::getInnerSize(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
facebook::react::dom::DOMSizeRounded facebook::react::dom::getScrollSize(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
facebook::react::dom::RNMeasureRect facebook::react::dom::measure(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
std::optional<facebook::react::dom::DOMRect> facebook::react::dom::measureLayout(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode, const facebook::react::ShadowNode& relativeToShadowNode);
std::shared_ptr<const facebook::react::ShadowNode> facebook::react::dom::getElementById(const std::shared_ptr<const facebook::react::ShadowNode>& currentRevision, const std::string& id);
std::shared_ptr<const facebook::react::ShadowNode> facebook::react::dom::getParentNode(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
std::string facebook::react::dom::getTagName(const facebook::react::ShadowNode& shadowNode);
std::string facebook::react::dom::getTextContent(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
std::vector<std::shared_ptr<const facebook::react::ShadowNode>> facebook::react::dom::getChildNodes(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
uint_fast16_t facebook::react::dom::compareDocumentPosition(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode, const facebook::react::ShadowNode& otherShadowNode);
struct facebook::react::dom::DOMBorderWidthRounded {
public int bottom;
public int left;
public int right;
public int top;
}
struct facebook::react::dom::DOMOffset {
public double left;
public double top;
public std::shared_ptr<const facebook::react::ShadowNode> offsetParent;
}
struct facebook::react::dom::DOMPoint {
public double x;
public double y;
}
struct facebook::react::dom::DOMRect {
public double height;
public double width;
public double x;
public double y;
}
struct facebook::react::dom::DOMSizeRounded {
public int height;
public int width;
}
struct facebook::react::dom::RNMeasureRect {
public double height;
public double pageX;
public double pageY;
public double width;
public double x;
public double y;
}
template <typename JSReturnT, typename ReturnT>
constexpr bool facebook::react::bridging::supportsToJs<JSReturnT, ReturnT, std::void_t<decltype(toJs(std::declval<facebook::jsi::Runtime&>(), std::declval<JSReturnT>(), nullptr))>>;
template <typename ReturnT>