Skip to content

Commit b27cd7c

Browse files
j-piaseckifacebook-github-bot
authored andcommitted
Upgrade react/renderer/dom visibility to "for frameworks"
Summary: 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] Differential Revision: D124966422
1 parent 95941fd commit b27cd7c

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
@@ -8726,6 +8726,68 @@ concept facebook::react::detail::css::keywords::hasWrapReverse = (CSSKeywordSet<
87268726
constexpr facebook::react::Color facebook::react::HostPlatformColor::UndefinedColor;
87278727

87288728

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

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

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

1064010640

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

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

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

59675967

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

0 commit comments

Comments
 (0)