mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix CQS signal modernize-use-designated-initializers in xplat/js/react-native-github/packages (#53963)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53963 Reviewed By: javache Differential Revision: D83322011
This commit is contained in:
committed by
Facebook GitHub Bot
parent
99b7cb77a7
commit
3372ce1227
+3
-2
@@ -164,7 +164,8 @@ class StackingContextTest : public ::testing::Test {
|
||||
node->getFamily(), [&](const ShadowNode& oldShadowNode) {
|
||||
auto viewProps = std::make_shared<ViewShadowNodeProps>();
|
||||
callback(*viewProps);
|
||||
return oldShadowNode.clone(ShadowNodeFragment{viewProps});
|
||||
return oldShadowNode.clone(
|
||||
ShadowNodeFragment{.props = viewProps});
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -260,7 +261,7 @@ TEST_F(StackingContextTest, mostPropsDoNotForceViewsToMaterialize) {
|
||||
yogaStyle.setMargin(yoga::Edge::All, yoga::StyleLength::points(42));
|
||||
yogaStyle.setPositionType(yoga::PositionType::Absolute);
|
||||
props.shadowRadius = 42;
|
||||
props.shadowOffset = Size{42, 42};
|
||||
props.shadowOffset = Size{.width = 42, .height = 42};
|
||||
props.backgroundColor = clearColor();
|
||||
});
|
||||
|
||||
|
||||
+3
-1
@@ -128,7 +128,9 @@ EventTag EventPerformanceLogger::onEventStart(
|
||||
{
|
||||
std::lock_guard lock(eventsInFlightMutex_);
|
||||
eventsInFlight_.emplace(
|
||||
eventTag, EventEntry{reportedName, target, timeStamp});
|
||||
eventTag,
|
||||
EventEntry{
|
||||
.name = reportedName, .target = target, .startTime = timeStamp});
|
||||
}
|
||||
return eventTag;
|
||||
}
|
||||
|
||||
+21
-21
@@ -65,8 +65,8 @@ static Rect getRootNodeBoundingRect(const RootShadowNode& rootShadowNode) {
|
||||
static Rect getBoundingRect(const ShadowNodeFamily::AncestorList& ancestors) {
|
||||
auto layoutMetrics = LayoutableShadowNode::computeRelativeLayoutMetrics(
|
||||
ancestors,
|
||||
{/* .includeTransform = */ true,
|
||||
/* .includeViewportOffset = */ true});
|
||||
{/* .includeTransform = */ .includeTransform = true,
|
||||
/* .includeViewportOffset = */ .includeViewportOffset = true});
|
||||
return layoutMetrics == EmptyLayoutMetrics ? Rect{} : layoutMetrics.frame;
|
||||
}
|
||||
|
||||
@@ -74,9 +74,9 @@ static Rect getClippedTargetBoundingRect(
|
||||
const ShadowNodeFamily::AncestorList& targetAncestors) {
|
||||
auto layoutMetrics = LayoutableShadowNode::computeRelativeLayoutMetrics(
|
||||
targetAncestors,
|
||||
{/* .includeTransform = */ true,
|
||||
/* .includeViewportOffset = */ true,
|
||||
/* .applyParentClipping = */ true});
|
||||
{/* .includeTransform = */ .includeTransform = true,
|
||||
/* .includeViewportOffset = */ .includeViewportOffset = true,
|
||||
/* .applyParentClipping = */ .enableOverflowClipping = true});
|
||||
|
||||
return layoutMetrics == EmptyLayoutMetrics ? Rect{} : layoutMetrics.frame;
|
||||
}
|
||||
@@ -110,8 +110,8 @@ static Rect computeIntersection(
|
||||
getClippedTargetBoundingRect(targetToRootAncestors);
|
||||
|
||||
auto clippedTargetBoundingRect = hasCustomRoot ? Rect{
|
||||
rootBoundingRect.origin + clippedTargetFromRoot.origin,
|
||||
clippedTargetFromRoot.size}
|
||||
.origin=rootBoundingRect.origin + clippedTargetFromRoot.origin,
|
||||
.size=clippedTargetFromRoot.size}
|
||||
: clippedTargetFromRoot;
|
||||
|
||||
return Rect::intersect(rootBoundingRect, clippedTargetBoundingRect);
|
||||
@@ -231,13 +231,13 @@ IntersectionObserver::setIntersectingState(
|
||||
if (state_ != newState) {
|
||||
state_ = newState;
|
||||
IntersectionObserverEntry entry{
|
||||
intersectionObserverId_,
|
||||
targetShadowNodeFamily_,
|
||||
targetBoundingRect,
|
||||
rootBoundingRect,
|
||||
intersectionRect,
|
||||
true,
|
||||
time,
|
||||
.intersectionObserverId = intersectionObserverId_,
|
||||
.shadowNodeFamily = targetShadowNodeFamily_,
|
||||
.targetRect = targetBoundingRect,
|
||||
.rootRect = rootBoundingRect,
|
||||
.intersectionRect = intersectionRect,
|
||||
.isIntersectingAboveThresholds = true,
|
||||
.time = time,
|
||||
};
|
||||
return std::optional<IntersectionObserverEntry>{std::move(entry)};
|
||||
}
|
||||
@@ -254,13 +254,13 @@ IntersectionObserver::setNotIntersectingState(
|
||||
if (state_ != IntersectionObserverState::NotIntersecting()) {
|
||||
state_ = IntersectionObserverState::NotIntersecting();
|
||||
IntersectionObserverEntry entry{
|
||||
intersectionObserverId_,
|
||||
targetShadowNodeFamily_,
|
||||
targetBoundingRect,
|
||||
rootBoundingRect,
|
||||
intersectionRect,
|
||||
false,
|
||||
time,
|
||||
.intersectionObserverId = intersectionObserverId_,
|
||||
.shadowNodeFamily = targetShadowNodeFamily_,
|
||||
.targetRect = targetBoundingRect,
|
||||
.rootRect = rootBoundingRect,
|
||||
.intersectionRect = intersectionRect,
|
||||
.isIntersectingAboveThresholds = false,
|
||||
.time = time,
|
||||
};
|
||||
return std::optional<IntersectionObserverEntry>(std::move(entry));
|
||||
}
|
||||
|
||||
+4
-4
@@ -176,10 +176,10 @@ void MutationObserver::recordMutationsInSubtrees(
|
||||
|
||||
if (!addedNodes.empty() || !removedNodes.empty()) {
|
||||
recordedMutations.emplace_back(MutationRecord{
|
||||
mutationObserverId_,
|
||||
oldNode,
|
||||
std::move(addedNodes),
|
||||
std::move(removedNodes)});
|
||||
.mutationObserverId = mutationObserverId_,
|
||||
.targetShadowNode = oldNode,
|
||||
.addedShadowNodes = std::move(addedNodes),
|
||||
.removedShadowNodes = std::move(removedNodes)});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@ Size SurfaceHandler::measure(
|
||||
std::shared_lock lock(linkMutex_);
|
||||
|
||||
if (link_.status != Status::Running) {
|
||||
return layoutConstraints.clamp({0, 0});
|
||||
return layoutConstraints.clamp({.width = 0, .height = 0});
|
||||
}
|
||||
|
||||
react_native_assert(
|
||||
|
||||
@@ -95,11 +95,11 @@ std::optional<SurfaceManager::SurfaceProps> SurfaceManager::getSurfaceProps(
|
||||
|
||||
visit(surfaceId, [&](const SurfaceHandler& surfaceHandler) {
|
||||
surfaceProps = SurfaceManager::SurfaceProps{
|
||||
surfaceId,
|
||||
surfaceHandler.getModuleName(),
|
||||
surfaceHandler.getProps(),
|
||||
surfaceHandler.getLayoutConstraints(),
|
||||
surfaceHandler.getLayoutContext()};
|
||||
.surfaceId = surfaceId,
|
||||
.moduleName = surfaceHandler.getModuleName(),
|
||||
.props = surfaceHandler.getProps(),
|
||||
.layoutConstraints = surfaceHandler.getLayoutConstraints(),
|
||||
.layoutContext = surfaceHandler.getLayoutContext()};
|
||||
});
|
||||
|
||||
return surfaceProps;
|
||||
|
||||
+8
-5
@@ -21,14 +21,17 @@ TextMeasurement TextLayoutManager::measure(
|
||||
TextMeasurement::Attachments attachments;
|
||||
for (const auto& fragment : attributedStringBox.getValue().getFragments()) {
|
||||
if (fragment.isAttachment()) {
|
||||
attachments.push_back(
|
||||
TextMeasurement::Attachment{{{0, 0}, {0, 0}}, false});
|
||||
attachments.push_back(TextMeasurement::Attachment{
|
||||
.frame =
|
||||
{.origin = {.x = 0, .y = 0}, .size = {.width = 0, .height = 0}},
|
||||
.isClipped = false});
|
||||
}
|
||||
}
|
||||
return TextMeasurement{
|
||||
{layoutConstraints.minimumSize.width,
|
||||
layoutConstraints.minimumSize.height},
|
||||
attachments};
|
||||
.size =
|
||||
{.width = layoutConstraints.minimumSize.width,
|
||||
.height = layoutConstraints.minimumSize.height},
|
||||
.attachments = attachments};
|
||||
}
|
||||
|
||||
} // namespace facebook::react
|
||||
|
||||
+5
-3
@@ -104,10 +104,12 @@ static PointerEventTarget retargetPointerEvent(
|
||||
// More work will be needed to properly take non-trival transforms into
|
||||
// account.
|
||||
auto layoutMetrics = uiManager.getRelativeLayoutMetrics(
|
||||
*latestNodeToTarget, nullptr, {/* .includeTransform */ true});
|
||||
*latestNodeToTarget,
|
||||
nullptr,
|
||||
{/* .includeTransform */ .includeTransform = true});
|
||||
retargetedEvent.offsetPoint = {
|
||||
event.clientPoint.x - layoutMetrics.frame.origin.x,
|
||||
event.clientPoint.y - layoutMetrics.frame.origin.y,
|
||||
.x = event.clientPoint.x - layoutMetrics.frame.origin.x,
|
||||
.y = event.clientPoint.y - layoutMetrics.frame.origin.y,
|
||||
};
|
||||
|
||||
PointerEventTarget result = {};
|
||||
|
||||
@@ -73,7 +73,9 @@ std::shared_ptr<ShadowNode> UIManager::createNode(
|
||||
PropsParserContext propsParserContext{surfaceId, *contextContainer_.get()};
|
||||
|
||||
auto family = componentDescriptor.createFamily(
|
||||
{tag, surfaceId, std::move(instanceHandle)});
|
||||
{.tag = tag,
|
||||
.surfaceId = surfaceId,
|
||||
.instanceHandle = std::move(instanceHandle)});
|
||||
const auto props = componentDescriptor.cloneProps(
|
||||
propsParserContext, nullptr, std::move(rawProps));
|
||||
const auto state = componentDescriptor.createInitialState(props, family);
|
||||
@@ -462,7 +464,7 @@ void UIManager::setNativeProps_DEPRECATED(
|
||||
->getProps(),
|
||||
RawProps(rawProps));
|
||||
|
||||
return oldShadowNode.clone({/* .props = */ props});
|
||||
return oldShadowNode.clone({/* .props = */ .props = props});
|
||||
});
|
||||
|
||||
return std::static_pointer_cast<RootShadowNode>(rootNode);
|
||||
|
||||
@@ -277,8 +277,8 @@ jsi::Value UIManagerBinding::get(
|
||||
auto locationY = (Float)arguments[2].getNumber();
|
||||
auto onSuccessFunction =
|
||||
arguments[3].getObject(runtime).getFunction(runtime);
|
||||
auto targetNode =
|
||||
uiManager->findNodeAtPoint(node, Point{locationX, locationY});
|
||||
auto targetNode = uiManager->findNodeAtPoint(
|
||||
node, Point{.x = locationX, .y = locationY});
|
||||
|
||||
if (!targetNode) {
|
||||
onSuccessFunction.call(runtime, jsi::Value::null());
|
||||
@@ -511,7 +511,7 @@ jsi::Value UIManagerBinding::get(
|
||||
Bridging<std::shared_ptr<const ShadowNode>>::fromJs(
|
||||
runtime, arguments[1])
|
||||
.get(),
|
||||
{/* .includeTransform = */ false});
|
||||
{/* .includeTransform = */ .includeTransform = false});
|
||||
auto frame = layoutMetrics.frame;
|
||||
auto result = jsi::Object(runtime);
|
||||
result.setProperty(runtime, "left", frame.origin.x);
|
||||
|
||||
+4
-2
@@ -43,7 +43,9 @@ class PointerEventsProcessorTest : public ::testing::Test {
|
||||
auto componentDescriptorRegistry =
|
||||
componentDescriptorProviderRegistry.createComponentDescriptorRegistry(
|
||||
ComponentDescriptorParameters{
|
||||
eventDispatcher, std::move(contextContainer), nullptr});
|
||||
.eventDispatcher = eventDispatcher,
|
||||
.contextContainer = std::move(contextContainer),
|
||||
.flavor = nullptr});
|
||||
|
||||
componentDescriptorProviderRegistry.add(
|
||||
concreteComponentDescriptorProvider<RootComponentDescriptor>());
|
||||
@@ -83,7 +85,7 @@ class PointerEventsProcessorTest : public ::testing::Test {
|
||||
auto sharedProps = std::make_shared<RootProps>();
|
||||
auto &props = *sharedProps;
|
||||
listenToAllPointerEvents(props);
|
||||
props.layoutConstraints = LayoutConstraints{{0,0}, {500, 500}};
|
||||
props.layoutConstraints = LayoutConstraints{.minimumSize={.width=0,.height=0}, .maximumSize={.width=500, .height=500}};
|
||||
auto &yogaStyle = props.yogaStyle;
|
||||
yogaStyle.setDimension(yoga::Dimension::Width, yoga::StyleSizeLength::points(400));
|
||||
yogaStyle.setDimension(yoga::Dimension::Height, yoga::StyleSizeLength::points(400));
|
||||
|
||||
@@ -67,8 +67,8 @@ TEST(hash_combineTests, testStrings) {
|
||||
}
|
||||
|
||||
TEST(hash_combineTests, testCustomTypes) {
|
||||
auto person1 = Person{"John", "Doe"};
|
||||
auto person2 = Person{"Jane", "Doe"};
|
||||
auto person1 = Person{.firstName = "John", .lastName = "Doe"};
|
||||
auto person2 = Person{.firstName = "Jane", .lastName = "Doe"};
|
||||
|
||||
std::size_t seed = 0;
|
||||
hash_combine(seed, person1);
|
||||
|
||||
@@ -110,7 +110,10 @@ void FuseboxTracer::addEvent(
|
||||
return;
|
||||
}
|
||||
buffer_.push_back(BufferEvent{
|
||||
start, end, std::string(name), std::string(track.value_or(""))});
|
||||
.start = start,
|
||||
.end = end,
|
||||
.name = std::string(name),
|
||||
.track = std::string(track.value_or(""))});
|
||||
}
|
||||
|
||||
bool FuseboxTracer::stopTracingAndWriteToFile(const std::string& path) {
|
||||
|
||||
Reference in New Issue
Block a user