Skip to content

Commit 230d1f4

Browse files
coadometa-codesync[bot]
authored andcommitted
Seal renderer Graphics public boundary (#58523)
Summary: Pull Request resolved: #58523 Move parsePlatformColorFn, fromRawValueShared, parsePlatformColor, hashGetColourArguments, and configurePlatformColorCacheInvalidationHook out of the public Graphics API and into private implementation scope. Preserve the CSS-free four-argument fromRawValue entry point, and remove unsupported dormant parser headers from the React Native macOS mirror. Stop exporting CSS from the Buck target, and express implementation-only dependencies privately in Buck and CMake. Removing the helper headers also prevents CocoaPods, SwiftPM, Android Prefab, and Apple prebuild staging from publishing them. Regenerate C++ API snapshots to remove those private helper declarations while retaining public fromRawValue. Changelog: [Internal] Differential Revision: D119500886
1 parent 131864c commit 230d1f4

11 files changed

Lines changed: 30 additions & 41 deletions

File tree

packages/react-native/ReactCommon/react/renderer/graphics/CMakeLists.txt

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,17 @@ target_include_directories(react_renderer_graphics INTERFACE ${REACT_COMMON_DIR}
2727

2828
react_native_android_selector(fbjni fbjni "")
2929
target_link_libraries(react_renderer_graphics
30-
glog
31-
${fbjni}
32-
folly_runtime
33-
react_cxxstableapi
34-
react_debug
35-
react_renderer_css
36-
react_renderer_debug
37-
react_utils
30+
PUBLIC
31+
${fbjni}
32+
folly_runtime
33+
react_cxxstableapi
34+
react_renderer_debug
35+
react_utils
36+
PRIVATE
37+
glog
38+
react_debug
39+
react_featureflags
40+
react_renderer_css
3841
)
3942
target_compile_reactnative_options(react_renderer_graphics PRIVATE)
4043
target_compile_options(react_renderer_graphics PRIVATE -Wpedantic)

packages/react-native/ReactCommon/react/renderer/graphics/React/Graphics.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@
5555
#include <react/renderer/graphics/fromRawValueShared.h>
5656
#include <react/renderer/graphics/rounding.h>
5757

58-
#ifdef ANDROID
59-
#include <react/renderer/graphics/configurePlatformColorCacheInvalidationHook.h>
60-
#endif
61-
6258
#if defined(__APPLE__) && defined(__OBJC__)
6359
#include <react/renderer/graphics/RCTPlatformColorUtils.h>
6460
#endif

packages/react-native/ReactCommon/react/renderer/graphics/platform/android/react/renderer/graphics/PlatformColorParser.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
#include <react/renderer/graphics/PlatformColorParser.h>
99

10-
#include "configurePlatformColorCacheInvalidationHook.h"
11-
1210
#include <fbjni/fbjni.h>
1311
#include <folly/container/EvictingCacheMap.h>
1412
#include <react/renderer/css/CSSColor.h>
@@ -20,6 +18,15 @@
2018

2119
namespace facebook::react {
2220

21+
SharedColor parsePlatformColor(
22+
const ContextContainer& contextContainer,
23+
int32_t surfaceId,
24+
const RawValue& value);
25+
26+
void configurePlatformColorCacheInvalidationHook(std::function<void()>&& hook);
27+
28+
namespace {
29+
2330
size_t hashGetColourArguments(
2431
int32_t surfaceId,
2532
const std::vector<std::string>& resourcePaths) {
@@ -31,6 +38,8 @@ size_t hashGetColourArguments(
3138
return seed;
3239
}
3340

41+
} // namespace
42+
3443
SharedColor parsePlatformColor(
3544
const ContextContainer& contextContainer,
3645
int32_t surfaceId,

packages/react-native/ReactCommon/react/renderer/graphics/platform/android/react/renderer/graphics/PlatformColorParser.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,9 @@
1212
#include <react/renderer/graphics/Color.h>
1313
#include <react/renderer/graphics/fromRawValueShared.h>
1414
#include <react/utils/ContextContainer.h>
15-
#include <cstddef>
16-
#include <string>
17-
#include <vector>
1815

1916
namespace facebook::react {
2017

21-
size_t hashGetColourArguments(int32_t surfaceId, const std::vector<std::string> &resourcePaths);
22-
2318
SharedColor parsePlatformColor(const ContextContainer &contextContainer, int32_t surfaceId, const RawValue &value);
2419

2520
inline void

packages/react-native/ReactCommon/react/renderer/graphics/platform/android/react/renderer/graphics/configurePlatformColorCacheInvalidationHook.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#include "configurePlatformColorCacheInvalidationHook.h"
9-
108
#include <fbjni/NativeRunnable.h>
119
#include <fbjni/fbjni.h>
10+
#include <functional>
1211

1312
namespace facebook::react {
1413
void configurePlatformColorCacheInvalidationHook(std::function<void()>&& hook) {

packages/react-native/ReactCommon/react/renderer/graphics/platform/android/react/renderer/graphics/configurePlatformColorCacheInvalidationHook.h

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/react-native/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/PlatformColorParser.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99

1010
namespace facebook::react {
1111

12+
SharedColor parsePlatformColor(
13+
const ContextContainer& contextContainer,
14+
int32_t surfaceId,
15+
const RawValue& value);
16+
1217
SharedColor parsePlatformColor(
1318
const ContextContainer& /*contextContainer*/,
1419
int32_t /*surfaceId*/,

packages/react-native/ReactCommon/react/renderer/graphics/platform/ios/react/renderer/graphics/PlatformColorParser.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
namespace facebook::react {
2626

27+
SharedColor parsePlatformColor(const ContextContainer &contextContainer, int32_t surfaceId, const RawValue &value);
28+
2729
inline facebook::react::SharedColor RCTPlatformColorComponentsFromDynamicItems(
2830
const facebook::react::ContextContainer &contextContainer,
2931
int32_t surfaceId,

scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,6 @@ size_t facebook::react::attributedStringFragmentHashDisplayWise(const facebook::
943943
size_t facebook::react::attributedStringFragmentHashLayoutWise(const facebook::react::AttributedString::Fragment& fragment);
944944
size_t facebook::react::attributedStringHashDisplayWise(const facebook::react::AttributedString& attributedString);
945945
size_t facebook::react::attributedStringHashLayoutWise(const facebook::react::AttributedString& attributedString);
946-
size_t facebook::react::hashGetColourArguments(int32_t surfaceId, const std::vector<std::string>& resourcePaths);
947946
size_t facebook::react::textAttributesHashLayoutWise(const facebook::react::TextAttributes& textAttributes);
948947
std::function<void(folly::dynamic)> facebook::react::makeCallback(std::weak_ptr<facebook::react::Instance> instance, const folly::dynamic& callbackId);
949948
std::optional<facebook::react::BlendMode> facebook::react::blendModeFromString(std::string_view blendModeName);
@@ -1073,7 +1072,6 @@ void facebook::react::bindHasComponentProvider(facebook::jsi::Runtime& runtime,
10731072
void facebook::react::bindNativeLogger(facebook::jsi::Runtime& runtime, facebook::react::Logger logger);
10741073
void facebook::react::bindNativePerformanceNow(facebook::jsi::Runtime& runtime);
10751074
void facebook::react::cloneProp(facebook::react::BaseViewProps& viewProps, const facebook::react::AnimatedPropBase& animatedProp);
1076-
void facebook::react::configurePlatformColorCacheInvalidationHook(std::function<void()>&& hook);
10771075
void facebook::react::defineReadOnlyGlobal(facebook::jsi::Runtime& runtime, const std::string& propName, facebook::jsi::Value&& value);
10781076
void facebook::react::ensureThreadDurationJNIEnvAttached();
10791077
void facebook::react::fromRawValue(const facebook::react::ContextContainer& contextContainer, int32_t surfaceId, const facebook::react::RawValue& value, facebook::react::SharedColor& result);

scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,6 @@ size_t facebook::react::attributedStringFragmentHashDisplayWise(const facebook::
942942
size_t facebook::react::attributedStringFragmentHashLayoutWise(const facebook::react::AttributedString::Fragment& fragment);
943943
size_t facebook::react::attributedStringHashDisplayWise(const facebook::react::AttributedString& attributedString);
944944
size_t facebook::react::attributedStringHashLayoutWise(const facebook::react::AttributedString& attributedString);
945-
size_t facebook::react::hashGetColourArguments(int32_t surfaceId, const std::vector<std::string>& resourcePaths);
946945
size_t facebook::react::textAttributesHashLayoutWise(const facebook::react::TextAttributes& textAttributes);
947946
std::optional<facebook::react::BlendMode> facebook::react::blendModeFromString(std::string_view blendModeName);
948947
std::optional<facebook::react::BoxShadow> facebook::react::fromCSSShadow(const facebook::react::CSSShadow& cssShadow);
@@ -1069,7 +1068,6 @@ void facebook::react::bindHasComponentProvider(facebook::jsi::Runtime& runtime,
10691068
void facebook::react::bindNativeLogger(facebook::jsi::Runtime& runtime, facebook::react::Logger logger);
10701069
void facebook::react::bindNativePerformanceNow(facebook::jsi::Runtime& runtime);
10711070
void facebook::react::cloneProp(facebook::react::BaseViewProps& viewProps, const facebook::react::AnimatedPropBase& animatedProp);
1072-
void facebook::react::configurePlatformColorCacheInvalidationHook(std::function<void()>&& hook);
10731071
void facebook::react::defineReadOnlyGlobal(facebook::jsi::Runtime& runtime, const std::string& propName, facebook::jsi::Value&& value);
10741072
void facebook::react::ensureThreadDurationJNIEnvAttached();
10751073
void facebook::react::fromRawValue(const facebook::react::ContextContainer& contextContainer, int32_t surfaceId, const facebook::react::RawValue& value, facebook::react::SharedColor& result);

0 commit comments

Comments
 (0)