Skip to content

Commit 8aa97bb

Browse files
j-piaseckimeta-codesync[bot]
authored andcommitted
Upgrade react/renderer/dom visibility to "for frameworks" (#59032)
Summary: Pull Request resolved: #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
1 parent d6d816c commit 8aa97bb

4 files changed

Lines changed: 187 additions & 1 deletion

File tree

‎packages/react-native/ReactCommon/react/renderer/dom/DOM.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#pragma once
99

10-
#include <react/cxxstableapi/PrivateGuard.h>
10+
#include <react/cxxstableapi/FrameworksGuard.h>
1111

1212
#include <react/renderer/components/root/RootShadowNode.h>
1313
#include <react/renderer/core/ShadowNode.h>

‎scripts/cxx-api/api-snapshots/ReactAndroidFrameworksCxx.api‎

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8732,6 +8732,68 @@ concept facebook::react::detail::css::keywords::hasWrapReverse = (CSSKeywordSet<
87328732
constexpr facebook::react::Color facebook::react::HostPlatformColor::UndefinedColor;
87338733

87348734

8735+
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_CONTAINED_BY;
8736+
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_CONTAINS;
8737+
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_DISCONNECTED;
8738+
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_FOLLOWING;
8739+
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_PRECEDING;
8740+
bool facebook::react::dom::isConnected(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
8741+
facebook::react::dom::DOMBorderWidthRounded facebook::react::dom::getBorderWidth(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
8742+
facebook::react::dom::DOMOffset facebook::react::dom::getOffset(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
8743+
facebook::react::dom::DOMPoint facebook::react::dom::getScrollPosition(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
8744+
facebook::react::dom::DOMRect facebook::react::dom::getBoundingClientRect(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode, bool includeTransform);
8745+
facebook::react::dom::DOMRect facebook::react::dom::measureInWindow(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
8746+
facebook::react::dom::DOMSizeRounded facebook::react::dom::getInnerSize(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
8747+
facebook::react::dom::DOMSizeRounded facebook::react::dom::getScrollSize(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
8748+
facebook::react::dom::RNMeasureRect facebook::react::dom::measure(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
8749+
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);
8750+
std::shared_ptr<const facebook::react::ShadowNode> facebook::react::dom::getElementById(const std::shared_ptr<const facebook::react::ShadowNode>& currentRevision, const std::string& id);
8751+
std::shared_ptr<const facebook::react::ShadowNode> facebook::react::dom::getParentNode(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
8752+
std::string facebook::react::dom::getTagName(const facebook::react::ShadowNode& shadowNode);
8753+
std::string facebook::react::dom::getTextContent(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
8754+
std::vector<std::shared_ptr<const facebook::react::ShadowNode>> facebook::react::dom::getChildNodes(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
8755+
uint_fast16_t facebook::react::dom::compareDocumentPosition(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode, const facebook::react::ShadowNode& otherShadowNode);
8756+
8757+
struct facebook::react::dom::DOMBorderWidthRounded {
8758+
public int bottom;
8759+
public int left;
8760+
public int right;
8761+
public int top;
8762+
}
8763+
8764+
struct facebook::react::dom::DOMOffset {
8765+
public double left;
8766+
public double top;
8767+
public std::shared_ptr<const facebook::react::ShadowNode> offsetParent;
8768+
}
8769+
8770+
struct facebook::react::dom::DOMPoint {
8771+
public double x;
8772+
public double y;
8773+
}
8774+
8775+
struct facebook::react::dom::DOMRect {
8776+
public double height;
8777+
public double width;
8778+
public double x;
8779+
public double y;
8780+
}
8781+
8782+
struct facebook::react::dom::DOMSizeRounded {
8783+
public int height;
8784+
public int width;
8785+
}
8786+
8787+
struct facebook::react::dom::RNMeasureRect {
8788+
public double height;
8789+
public double pageX;
8790+
public double pageY;
8791+
public double width;
8792+
public double x;
8793+
public double y;
8794+
}
8795+
8796+
87358797
std::shared_ptr<const facebook::react::ComponentDescriptorProviderRegistry> facebook::react::CoreComponentsRegistry::sharedProviderRegistry();
87368798
void facebook::react::CoreComponentsRegistry::addCoreComponents(std::shared_ptr<const facebook::react::ComponentDescriptorProviderRegistry> registry);
87378799

‎scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api‎

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10644,6 +10644,68 @@ template <typename T>
1064410644
concept facebook::react::detail::css::keywords::hasWrapReverse = (CSSKeywordSet<T> && requires() { T::WrapReverse; });
1064510645

1064610646

10647+
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_CONTAINED_BY;
10648+
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_CONTAINS;
10649+
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_DISCONNECTED;
10650+
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_FOLLOWING;
10651+
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_PRECEDING;
10652+
bool facebook::react::dom::isConnected(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
10653+
facebook::react::dom::DOMBorderWidthRounded facebook::react::dom::getBorderWidth(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
10654+
facebook::react::dom::DOMOffset facebook::react::dom::getOffset(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
10655+
facebook::react::dom::DOMPoint facebook::react::dom::getScrollPosition(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
10656+
facebook::react::dom::DOMRect facebook::react::dom::getBoundingClientRect(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode, bool includeTransform);
10657+
facebook::react::dom::DOMRect facebook::react::dom::measureInWindow(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
10658+
facebook::react::dom::DOMSizeRounded facebook::react::dom::getInnerSize(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
10659+
facebook::react::dom::DOMSizeRounded facebook::react::dom::getScrollSize(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
10660+
facebook::react::dom::RNMeasureRect facebook::react::dom::measure(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
10661+
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);
10662+
std::shared_ptr<const facebook::react::ShadowNode> facebook::react::dom::getElementById(const std::shared_ptr<const facebook::react::ShadowNode>& currentRevision, const std::string& id);
10663+
std::shared_ptr<const facebook::react::ShadowNode> facebook::react::dom::getParentNode(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
10664+
std::string facebook::react::dom::getTagName(const facebook::react::ShadowNode& shadowNode);
10665+
std::string facebook::react::dom::getTextContent(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
10666+
std::vector<std::shared_ptr<const facebook::react::ShadowNode>> facebook::react::dom::getChildNodes(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
10667+
uint_fast16_t facebook::react::dom::compareDocumentPosition(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode, const facebook::react::ShadowNode& otherShadowNode);
10668+
10669+
struct facebook::react::dom::DOMBorderWidthRounded {
10670+
public int bottom;
10671+
public int left;
10672+
public int right;
10673+
public int top;
10674+
}
10675+
10676+
struct facebook::react::dom::DOMOffset {
10677+
public double left;
10678+
public double top;
10679+
public std::shared_ptr<const facebook::react::ShadowNode> offsetParent;
10680+
}
10681+
10682+
struct facebook::react::dom::DOMPoint {
10683+
public double x;
10684+
public double y;
10685+
}
10686+
10687+
struct facebook::react::dom::DOMRect {
10688+
public double height;
10689+
public double width;
10690+
public double x;
10691+
public double y;
10692+
}
10693+
10694+
struct facebook::react::dom::DOMSizeRounded {
10695+
public int height;
10696+
public int width;
10697+
}
10698+
10699+
struct facebook::react::dom::RNMeasureRect {
10700+
public double height;
10701+
public double pageX;
10702+
public double pageY;
10703+
public double width;
10704+
public double x;
10705+
public double y;
10706+
}
10707+
10708+
1064710709
facebook::jsi::Value facebook::react::TurboModuleConvertUtils::convertObjCObjectToJSIValue(facebook::jsi::Runtime& runtime, id value);
1064810710
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);
1064910711

‎scripts/cxx-api/api-snapshots/ReactCommonFrameworksCxx.api‎

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5971,6 +5971,68 @@ template <typename T>
59715971
concept facebook::react::detail::css::keywords::hasWrapReverse = (CSSKeywordSet<T> && requires() { T::WrapReverse; });
59725972

59735973

5974+
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_CONTAINED_BY;
5975+
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_CONTAINS;
5976+
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_DISCONNECTED;
5977+
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_FOLLOWING;
5978+
constexpr uint_fast16_t facebook::react::dom::DOCUMENT_POSITION_PRECEDING;
5979+
bool facebook::react::dom::isConnected(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
5980+
facebook::react::dom::DOMBorderWidthRounded facebook::react::dom::getBorderWidth(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
5981+
facebook::react::dom::DOMOffset facebook::react::dom::getOffset(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
5982+
facebook::react::dom::DOMPoint facebook::react::dom::getScrollPosition(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
5983+
facebook::react::dom::DOMRect facebook::react::dom::getBoundingClientRect(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode, bool includeTransform);
5984+
facebook::react::dom::DOMRect facebook::react::dom::measureInWindow(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
5985+
facebook::react::dom::DOMSizeRounded facebook::react::dom::getInnerSize(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
5986+
facebook::react::dom::DOMSizeRounded facebook::react::dom::getScrollSize(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
5987+
facebook::react::dom::RNMeasureRect facebook::react::dom::measure(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
5988+
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);
5989+
std::shared_ptr<const facebook::react::ShadowNode> facebook::react::dom::getElementById(const std::shared_ptr<const facebook::react::ShadowNode>& currentRevision, const std::string& id);
5990+
std::shared_ptr<const facebook::react::ShadowNode> facebook::react::dom::getParentNode(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
5991+
std::string facebook::react::dom::getTagName(const facebook::react::ShadowNode& shadowNode);
5992+
std::string facebook::react::dom::getTextContent(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
5993+
std::vector<std::shared_ptr<const facebook::react::ShadowNode>> facebook::react::dom::getChildNodes(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode);
5994+
uint_fast16_t facebook::react::dom::compareDocumentPosition(const facebook::react::RootShadowNode::Shared& currentRevision, const facebook::react::ShadowNode& shadowNode, const facebook::react::ShadowNode& otherShadowNode);
5995+
5996+
struct facebook::react::dom::DOMBorderWidthRounded {
5997+
public int bottom;
5998+
public int left;
5999+
public int right;
6000+
public int top;
6001+
}
6002+
6003+
struct facebook::react::dom::DOMOffset {
6004+
public double left;
6005+
public double top;
6006+
public std::shared_ptr<const facebook::react::ShadowNode> offsetParent;
6007+
}
6008+
6009+
struct facebook::react::dom::DOMPoint {
6010+
public double x;
6011+
public double y;
6012+
}
6013+
6014+
struct facebook::react::dom::DOMRect {
6015+
public double height;
6016+
public double width;
6017+
public double x;
6018+
public double y;
6019+
}
6020+
6021+
struct facebook::react::dom::DOMSizeRounded {
6022+
public int height;
6023+
public int width;
6024+
}
6025+
6026+
struct facebook::react::dom::RNMeasureRect {
6027+
public double height;
6028+
public double pageX;
6029+
public double pageY;
6030+
public double width;
6031+
public double x;
6032+
public double y;
6033+
}
6034+
6035+
59746036
template <typename JSReturnT, typename ReturnT>
59756037
constexpr bool facebook::react::bridging::supportsToJs<JSReturnT, ReturnT, std::void_t<decltype(toJs(std::declval<facebook::jsi::Runtime&>(), std::declval<JSReturnT>(), nullptr))>>;
59766038
template <typename ReturnT>

0 commit comments

Comments
 (0)