From c122236926e1efff1a6f715088ef65abde0d90a3 Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Tue, 30 Apr 2024 22:30:05 -0700 Subject: [PATCH] Remove "deduplicated" Spannable path Summary: This removes the bulk of code added in https://github.com/facebook/react-native/pull/39630. We're not shipping it, as it caused performance regressions. Changelog: [Internal] Reviewed By: christophpurrer Differential Revision: D56796936 fbshipit-source-id: 82f3a51cf145bc1695d70393e1f050685a1e6174 --- .../ReactAndroid/api/ReactAndroid.api | 20 +- .../featureflags/ReactNativeFeatureFlags.kt | 8 +- .../ReactNativeFeatureFlagsCxxAccessor.kt | 12 +- .../ReactNativeFeatureFlagsCxxInterop.kt | 4 +- .../ReactNativeFeatureFlagsDefaults.kt | 4 +- .../ReactNativeFeatureFlagsLocalAccessor.kt | 13 +- .../ReactNativeFeatureFlagsProvider.kt | 4 +- .../views/text/BasicTextAttributeProvider.kt | 48 --- .../text/EffectiveTextAttributeProvider.kt | 22 - .../text/HierarchicTextAttributeProvider.kt | 63 --- .../views/text/ReactBaseTextShadowNode.java | 196 +-------- .../react/views/text/TextAttributeProps.java | 22 +- .../react/views/text/TextLayoutManager.java | 25 -- .../text/TextLayoutManagerMapBuffer.java | 19 - .../react/views/text/TextLayoutUtils.kt | 379 ------------------ .../text/fragments/BridgeTextFragment.kt | 43 -- .../text/fragments/BridgeTextFragmentList.kt | 18 - .../text/fragments/MapBufferTextFragment.kt | 42 -- .../fragments/MapBufferTextFragmentList.kt | 19 - .../views/text/fragments/TextFragment.kt | 29 -- .../views/text/fragments/TextFragmentList.kt | 15 - .../JReactNativeFeatureFlagsCxxInterop.cpp | 16 +- .../JReactNativeFeatureFlagsCxxInterop.h | 5 +- .../featureflags/ReactNativeFeatureFlags.cpp | 6 +- .../featureflags/ReactNativeFeatureFlags.h | 7 +- .../ReactNativeFeatureFlagsAccessor.cpp | 40 +- .../ReactNativeFeatureFlagsAccessor.h | 6 +- .../ReactNativeFeatureFlagsDefaults.h | 6 +- .../ReactNativeFeatureFlagsProvider.h | 3 +- .../NativeReactNativeFeatureFlags.cpp | 7 +- .../NativeReactNativeFeatureFlags.h | 4 +- .../ReactNativeFeatureFlags.config.js | 5 - .../featureflags/ReactNativeFeatureFlags.js | 7 +- .../specs/NativeReactNativeFeatureFlags.js | 3 +- 34 files changed, 34 insertions(+), 1086 deletions(-) delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/BasicTextAttributeProvider.kt delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/EffectiveTextAttributeProvider.kt delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/HierarchicTextAttributeProvider.kt delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutUtils.kt delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/BridgeTextFragment.kt delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/BridgeTextFragmentList.kt delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/MapBufferTextFragment.kt delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/MapBufferTextFragmentList.kt delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/TextFragment.kt delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/TextFragmentList.kt diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index fd25a8d2d65f74..c471cac29d6b73 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -7088,7 +7088,7 @@ public class com/facebook/react/views/text/FontMetricsUtil { public static fun getFontMetrics (Ljava/lang/CharSequence;Landroid/text/Layout;Landroid/text/TextPaint;Landroid/content/Context;)Lcom/facebook/react/bridge/WritableArray; } -public abstract class com/facebook/react/views/text/ReactBaseTextShadowNode : com/facebook/react/uimanager/LayoutShadowNode, com/facebook/react/views/text/BasicTextAttributeProvider { +public abstract class com/facebook/react/views/text/ReactBaseTextShadowNode : com/facebook/react/uimanager/LayoutShadowNode { public static final field DEFAULT_TEXT_SHADOW_COLOR I public static final field PROP_SHADOW_COLOR Ljava/lang/String; public static final field PROP_SHADOW_OFFSET Ljava/lang/String; @@ -7126,22 +7126,6 @@ public abstract class com/facebook/react/views/text/ReactBaseTextShadowNode : co protected field mTextShadowRadius F public fun ()V public fun (Lcom/facebook/react/views/text/ReactTextViewManagerCallback;)V - public fun getAccessibilityRole ()Lcom/facebook/react/uimanager/ReactAccessibilityDelegate$AccessibilityRole; - public fun getBackgroundColor ()I - public fun getColor ()I - public fun getFontFamily ()Ljava/lang/String; - public fun getFontFeatureSettings ()Ljava/lang/String; - public fun getFontStyle ()I - public fun getFontWeight ()I - public fun getRole ()Lcom/facebook/react/uimanager/ReactAccessibilityDelegate$Role; - public fun getTextShadowColor ()I - public fun getTextShadowOffsetDx ()F - public fun getTextShadowOffsetDy ()F - public fun getTextShadowRadius ()F - public fun isBackgroundColorSet ()Z - public fun isColorSet ()Z - public fun isLineThroughTextDecorationSet ()Z - public fun isUnderlineTextDecorationSet ()Z public fun setAccessibilityRole (Ljava/lang/String;)V public fun setAdjustFontSizeToFit (Z)V public fun setAllowFontScaling (Z)V @@ -7382,7 +7366,7 @@ public class com/facebook/react/views/text/ReactVirtualTextViewManager$$PropsSet public fun setProperty (Lcom/facebook/react/views/text/ReactVirtualTextViewManager;Landroid/view/View;Ljava/lang/String;Ljava/lang/Object;)V } -public class com/facebook/react/views/text/TextAttributeProps : com/facebook/react/views/text/EffectiveTextAttributeProvider { +public class com/facebook/react/views/text/TextAttributeProps { public static final field TA_KEY_ACCESSIBILITY_ROLE S public static final field TA_KEY_ALIGNMENT S public static final field TA_KEY_ALLOW_FONT_SCALING S diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt index b6bcf94611904e..2c5c37506e9730 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<71bd0e6d2f2bd2c768b86a073451430c>> + * @generated SignedSource<> */ /** @@ -76,12 +76,6 @@ public object ReactNativeFeatureFlags { @JvmStatic public fun enableMicrotasks(): Boolean = accessor.enableMicrotasks() - /** - * Uses new, deduplicated logic for constructing Android Spannables from text fragments - */ - @JvmStatic - public fun enableSpannableBuildingUnification(): Boolean = accessor.enableSpannableBuildingUnification() - /** * Dispatches state updates synchronously in Fabric (e.g.: updates the scroll position in the shadow tree synchronously from the main thread). */ diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt index 6bc82fd10ebbfc..bd1a148425e77b 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<50c8aeff2f02f26b75bcf62f448ca60d>> */ /** @@ -28,7 +28,6 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso private var enableBackgroundExecutorCache: Boolean? = null private var enableCleanTextInputYogaNodeCache: Boolean? = null private var enableMicrotasksCache: Boolean? = null - private var enableSpannableBuildingUnificationCache: Boolean? = null private var enableSynchronousStateUpdatesCache: Boolean? = null private var enableUIConsistencyCache: Boolean? = null private var fixMountedFlagAndFixPreallocationCloneCache: Boolean? = null @@ -112,15 +111,6 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso return cached } - override fun enableSpannableBuildingUnification(): Boolean { - var cached = enableSpannableBuildingUnificationCache - if (cached == null) { - cached = ReactNativeFeatureFlagsCxxInterop.enableSpannableBuildingUnification() - enableSpannableBuildingUnificationCache = cached - } - return cached - } - override fun enableSynchronousStateUpdates(): Boolean { var cached = enableSynchronousStateUpdatesCache if (cached == null) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt index 0e36729b49bef5..de46df72a3e9a9 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<5d418feb35bbe1bc78c9b2887acf0e3d>> + * @generated SignedSource<> */ /** @@ -44,8 +44,6 @@ public object ReactNativeFeatureFlagsCxxInterop { @DoNotStrip @JvmStatic public external fun enableMicrotasks(): Boolean - @DoNotStrip @JvmStatic public external fun enableSpannableBuildingUnification(): Boolean - @DoNotStrip @JvmStatic public external fun enableSynchronousStateUpdates(): Boolean @DoNotStrip @JvmStatic public external fun enableUIConsistency(): Boolean diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt index 5bc80fc5e99714..9fabc6acba5a1e 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<> */ /** @@ -39,8 +39,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi override fun enableMicrotasks(): Boolean = false - override fun enableSpannableBuildingUnification(): Boolean = false - override fun enableSynchronousStateUpdates(): Boolean = false override fun enableUIConsistency(): Boolean = false diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt index b27efc760d9efd..d2448d11a0ce09 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<5f08267961d732e2f573ed933abf5ab9>> + * @generated SignedSource<<88e9d6c51edd3e6fca3c01b9a8968bba>> */ /** @@ -32,7 +32,6 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces private var enableBackgroundExecutorCache: Boolean? = null private var enableCleanTextInputYogaNodeCache: Boolean? = null private var enableMicrotasksCache: Boolean? = null - private var enableSpannableBuildingUnificationCache: Boolean? = null private var enableSynchronousStateUpdatesCache: Boolean? = null private var enableUIConsistencyCache: Boolean? = null private var fixMountedFlagAndFixPreallocationCloneCache: Boolean? = null @@ -124,16 +123,6 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces return cached } - override fun enableSpannableBuildingUnification(): Boolean { - var cached = enableSpannableBuildingUnificationCache - if (cached == null) { - cached = currentProvider.enableSpannableBuildingUnification() - accessedFeatureFlags.add("enableSpannableBuildingUnification") - enableSpannableBuildingUnificationCache = cached - } - return cached - } - override fun enableSynchronousStateUpdates(): Boolean { var cached = enableSynchronousStateUpdatesCache if (cached == null) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt index 20b551fb6361e8..f5792584024c05 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<0aac08cb953e08d090fedebf12a9e99c>> + * @generated SignedSource<<08acc01776848d8f2b55d68dcc71fdec>> */ /** @@ -39,8 +39,6 @@ public interface ReactNativeFeatureFlagsProvider { @DoNotStrip public fun enableMicrotasks(): Boolean - @DoNotStrip public fun enableSpannableBuildingUnification(): Boolean - @DoNotStrip public fun enableSynchronousStateUpdates(): Boolean @DoNotStrip public fun enableUIConsistency(): Boolean diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/BasicTextAttributeProvider.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/BasicTextAttributeProvider.kt deleted file mode 100644 index bf9693f5971514..00000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/BasicTextAttributeProvider.kt +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.views.text - -import com.facebook.react.uimanager.ReactAccessibilityDelegate - -/** - * Interface for an entity providing basic text attributes of a text node/fragment. "Basic" means - * that they can be provided trivially, without processing the parent element. - */ -internal interface BasicTextAttributeProvider { - val role: ReactAccessibilityDelegate.Role? - - val accessibilityRole: ReactAccessibilityDelegate.AccessibilityRole? - - val isBackgroundColorSet: Boolean - - val backgroundColor: Int - - val isColorSet: Boolean - - val color: Int - - val fontStyle: Int - - val fontWeight: Int - - val fontFamily: String? - - val fontFeatureSettings: String? - - val isUnderlineTextDecorationSet: Boolean - - val isLineThroughTextDecorationSet: Boolean - - val textShadowOffsetDx: Float - - val textShadowOffsetDy: Float - - val textShadowRadius: Float - - val textShadowColor: Int -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/EffectiveTextAttributeProvider.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/EffectiveTextAttributeProvider.kt deleted file mode 100644 index 78b3562785d5a9..00000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/EffectiveTextAttributeProvider.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.views.text - -import com.facebook.react.common.ReactConstants.UNSET - -/** Interface for an entity providing effective text attributes of a text node/fragment */ -internal interface EffectiveTextAttributeProvider : BasicTextAttributeProvider { - val textTransform: TextTransform - - val effectiveLetterSpacing: Float - - /** @return The effective font size, or [UNSET] if not set */ - val effectiveFontSize: Int - - val effectiveLineHeight: Float -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/HierarchicTextAttributeProvider.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/HierarchicTextAttributeProvider.kt deleted file mode 100644 index b322c08bb38ff8..00000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/HierarchicTextAttributeProvider.kt +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.views.text - -import com.facebook.react.common.ReactConstants - -/** - * Implementation of [EffectiveTextAttributeProvider] that provides effective text attributes based - * on a [ReactBaseTextShadowNode] instance and its parent. - */ -internal class HierarchicTextAttributeProvider( - private val textShadowNode: ReactBaseTextShadowNode, - private val parentTextAttributes: TextAttributes?, - private val textAttributes: TextAttributes -) : EffectiveTextAttributeProvider, BasicTextAttributeProvider by textShadowNode { - override val textTransform: TextTransform - get() = textAttributes.textTransform - - override val effectiveLetterSpacing: Float - get() { - val letterSpacing = textAttributes.effectiveLetterSpacing - - val isParentLetterSpacingDifferent = - parentTextAttributes == null || - parentTextAttributes.effectiveLetterSpacing != letterSpacing - - return if (!letterSpacing.isNaN() && isParentLetterSpacingDifferent) { - letterSpacing - } else { - Float.NaN - } - } - - override val effectiveFontSize: Int - get() { - val fontSize = textAttributes.effectiveFontSize - - return if (parentTextAttributes == null || - parentTextAttributes.effectiveFontSize != fontSize) { - fontSize - } else { - ReactConstants.UNSET - } - } - - override val effectiveLineHeight: Float - get() { - val lineHeight = textAttributes.effectiveLineHeight - val isParentLineHeightDifferent = - parentTextAttributes == null || parentTextAttributes.effectiveLineHeight != lineHeight - - return if (!lineHeight.isNaN() && isParentLineHeightDifferent) { - lineHeight - } else { - Float.NaN - } - } -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java index 1da3e2f7b9fec5..6cb16d00028de2 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java @@ -21,7 +21,6 @@ import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableMap; import com.facebook.react.common.ReactConstants; -import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags; import com.facebook.react.uimanager.IllegalViewOperationException; import com.facebook.react.uimanager.LayoutShadowNode; import com.facebook.react.uimanager.NativeViewHierarchyOptimizer; @@ -65,8 +64,7 @@ *

This also node calculates {@link Spannable} object based on subnodes of the same type, which * can be used in concrete classes to feed native views and compute layout. */ -public abstract class ReactBaseTextShadowNode extends LayoutShadowNode - implements BasicTextAttributeProvider { +public abstract class ReactBaseTextShadowNode extends LayoutShadowNode { // Use a direction weak character so the placeholder doesn't change the direction of the previous // character. @@ -93,23 +91,6 @@ private static void buildSpannedFromShadowNode( boolean supportsInlineViews, @Nullable Map inlineViews, int start) { - if (ReactNativeFeatureFlags.enableSpannableBuildingUnification()) { - buildSpannedFromShadowNodeUnified( - textShadowNode, sb, ops, parentTextAttributes, supportsInlineViews, inlineViews, start); - } else { - buildSpannedFromShadowNodeDuplicated( - textShadowNode, sb, ops, parentTextAttributes, supportsInlineViews, inlineViews, start); - } - } - - private static void buildSpannedFromShadowNodeDuplicated( - ReactBaseTextShadowNode textShadowNode, - SpannableStringBuilder sb, - List ops, - @Nullable TextAttributes parentTextAttributes, - boolean supportsInlineViews, - @Nullable Map inlineViews, - int start) { TextAttributes textAttributes; if (parentTextAttributes != null) { @@ -126,7 +107,7 @@ private static void buildSpannedFromShadowNodeDuplicated( TextTransform.apply( ((ReactRawTextShadowNode) child).getText(), textAttributes.getTextTransform())); } else if (child instanceof ReactBaseTextShadowNode) { - buildSpannedFromShadowNodeDuplicated( + buildSpannedFromShadowNode( (ReactBaseTextShadowNode) child, sb, ops, @@ -254,99 +235,6 @@ private static void buildSpannedFromShadowNodeDuplicated( } } - private static void buildSpannedFromShadowNodeUnified( - ReactBaseTextShadowNode textShadowNode, - SpannableStringBuilder sb, - List ops, - @Nullable TextAttributes parentTextAttributes, - boolean supportsInlineViews, - @Nullable Map inlineViews, - int start) { - - TextAttributes textAttributes; - if (parentTextAttributes != null) { - textAttributes = parentTextAttributes.applyChild(textShadowNode.mTextAttributes); - } else { - textAttributes = textShadowNode.mTextAttributes; - } - - final HierarchicTextAttributeProvider textAttributeProvider = - new HierarchicTextAttributeProvider(textShadowNode, parentTextAttributes, textAttributes); - - for (int i = 0, length = textShadowNode.getChildCount(); i < length; i++) { - ReactShadowNode child = textShadowNode.getChildAt(i); - - if (child instanceof ReactRawTextShadowNode) { - TextLayoutUtils.addText( - sb, ((ReactRawTextShadowNode) child).getText(), textAttributeProvider); - } else if (child instanceof ReactBaseTextShadowNode) { - buildSpannedFromShadowNodeUnified( - (ReactBaseTextShadowNode) child, - sb, - ops, - textAttributes, - supportsInlineViews, - inlineViews, - sb.length()); - } else if (child instanceof ReactTextInlineImageShadowNode) { - addInlineImageSpan(ops, sb, (ReactTextInlineImageShadowNode) child); - } else if (supportsInlineViews) { - addInlineViewPlaceholderSpan(ops, sb, child); - - inlineViews.put(child.getReactTag(), child); - } else { - throw new IllegalViewOperationException( - "Unexpected view type nested under a or node: " + child.getClass()); - } - child.markUpdateSeen(); - } - int end = sb.length(); - if (end >= start) { - final int reactTag = textShadowNode.getReactTag(); - - TextLayoutUtils.addApplicableTextAttributeSpans( - ops, textAttributeProvider, reactTag, textShadowNode.getThemedContext(), start, end); - } - } - - private static void addInlineImageSpan( - List ops, SpannableStringBuilder sb, ReactTextInlineImageShadowNode child) { - // We make the image take up 1 character in the span and put a corresponding character into - // the text so that the image doesn't run over any following text. - sb.append(INLINE_VIEW_PLACEHOLDER); - ops.add( - new SetSpanOperation( - sb.length() - INLINE_VIEW_PLACEHOLDER.length(), - sb.length(), - child.buildInlineImageSpan())); - } - - private static void addInlineViewPlaceholderSpan( - List ops, SpannableStringBuilder sb, ReactShadowNode child) { - YogaValue widthValue = child.getStyleWidth(); - YogaValue heightValue = child.getStyleHeight(); - - float width; - float height; - if (widthValue.unit != YogaUnit.POINT || heightValue.unit != YogaUnit.POINT) { - // If the measurement of the child isn't calculated, we calculate the layout for the - // view using Yoga - child.calculateLayout(); - width = child.getLayoutWidth(); - height = child.getLayoutHeight(); - } else { - width = widthValue.value; - height = heightValue.value; - } - - // We make the inline view take up 1 character in the span and put a corresponding character - // into the text so that - // the inline view doesn't run over any following text. - sb.append(INLINE_VIEW_PLACEHOLDER); - - TextLayoutUtils.addInlineViewPlaceholderSpan(ops, sb, child.getReactTag(), width, height); - } - // `nativeViewHierarchyOptimizer` can be `null` as long as `supportsInlineViews` is `false`. protected Spannable spannedFromShadowNode( ReactBaseTextShadowNode textShadowNode, @@ -582,11 +470,6 @@ public void setFontSize(float fontSize) { markUpdated(); } - @Override - public int getColor() { - return mColor; - } - @ReactProp(name = ViewProps.COLOR, customType = "Color") public void setColor(@Nullable Integer color) { mIsColorSet = (color != null); @@ -596,16 +479,6 @@ public void setColor(@Nullable Integer color) { markUpdated(); } - @Override - public boolean isColorSet() { - return mIsColorSet; - } - - @Override - public int getBackgroundColor() { - return mBackgroundColor; - } - @ReactProp(name = ViewProps.BACKGROUND_COLOR, customType = "Color") public void setBackgroundColor(@Nullable Integer color) { // Background color needs to be handled here for virtual nodes so it can be incorporated into @@ -621,16 +494,6 @@ public void setBackgroundColor(@Nullable Integer color) { } } - @Override - public boolean isBackgroundColorSet() { - return mIsBackgroundColorSet; - } - - @Override - public @Nullable AccessibilityRole getAccessibilityRole() { - return mAccessibilityRole; - } - @ReactProp(name = ViewProps.ACCESSIBILITY_ROLE) public void setAccessibilityRole(@Nullable String accessibilityRole) { if (isVirtual()) { @@ -639,11 +502,6 @@ public void setAccessibilityRole(@Nullable String accessibilityRole) { } } - @Override - public @Nullable Role getRole() { - return mRole; - } - @ReactProp(name = ViewProps.ROLE) public void setRole(@Nullable String role) { if (isVirtual()) { @@ -652,22 +510,12 @@ public void setRole(@Nullable String role) { } } - @Override - public String getFontFamily() { - return mFontFamily; - } - @ReactProp(name = ViewProps.FONT_FAMILY) public void setFontFamily(@Nullable String fontFamily) { mFontFamily = fontFamily; markUpdated(); } - @Override - public int getFontWeight() { - return mFontWeight; - } - @ReactProp(name = ViewProps.FONT_WEIGHT) public void setFontWeight(@Nullable String fontWeightString) { int fontWeight = ReactTypefaceUtils.parseFontWeight(fontWeightString); @@ -687,16 +535,6 @@ public void setFontVariant(@Nullable ReadableArray fontVariantArray) { } } - @Override - public String getFontFeatureSettings() { - return mFontFeatureSettings; - } - - @Override - public int getFontStyle() { - return mFontStyle; - } - @ReactProp(name = ViewProps.FONT_STYLE) public void setFontStyle(@Nullable String fontStyleString) { int fontStyle = ReactTypefaceUtils.parseFontStyle(fontStyleString); @@ -727,16 +565,6 @@ public void setTextDecorationLine(@Nullable String textDecorationLineString) { markUpdated(); } - @Override - public boolean isUnderlineTextDecorationSet() { - return mIsUnderlineTextDecorationSet; - } - - @Override - public boolean isLineThroughTextDecorationSet() { - return mIsLineThroughTextDecorationSet; - } - @ReactProp(name = ViewProps.TEXT_BREAK_STRATEGY) public void setTextBreakStrategy(@Nullable String textBreakStrategy) { if (textBreakStrategy == null || "highQuality".equals(textBreakStrategy)) { @@ -774,21 +602,6 @@ public void setTextShadowOffset(ReadableMap offsetMap) { markUpdated(); } - @Override - public float getTextShadowOffsetDx() { - return mTextShadowOffsetDx; - } - - @Override - public float getTextShadowOffsetDy() { - return mTextShadowOffsetDy; - } - - @Override - public float getTextShadowRadius() { - return mTextShadowRadius; - } - @ReactProp(name = PROP_SHADOW_RADIUS, defaultInt = 1) public void setTextShadowRadius(float textShadowRadius) { if (textShadowRadius != mTextShadowRadius) { @@ -797,11 +610,6 @@ public void setTextShadowRadius(float textShadowRadius) { } } - @Override - public int getTextShadowColor() { - return mTextShadowColor; - } - @ReactProp(name = PROP_SHADOW_COLOR, defaultInt = DEFAULT_TEXT_SHADOW_COLOR, customType = "Color") public void setTextShadowColor(int textShadowColor) { if (textShadowColor != mTextShadowColor) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java index 0ee4a8ab04feca..f5dc16e69bd81e 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java @@ -31,7 +31,7 @@ // TODO: T63643819 refactor naming of TextAttributeProps to make explicit that this represents // TextAttributes and not TextProps. As part of this refactor extract methods that don't belong to // TextAttributeProps (e.g. TextAlign) -public class TextAttributeProps implements EffectiveTextAttributeProvider { +public class TextAttributeProps { // constants for Text Attributes serialization public static final short TA_KEY_FOREGROUND_COLOR = 0; @@ -347,7 +347,6 @@ private static float getFloatProp(ReactStylesDiffMap mProps, String name, float // Returns a line height which takes into account the requested line height // and the height of the inline images. - @Override public float getEffectiveLineHeight() { boolean useInlineViewHeight = !Float.isNaN(mLineHeight) @@ -376,7 +375,6 @@ private void setLetterSpacing(float letterSpacing) { mLetterSpacingInput = letterSpacing; } - @Override @NonNull public TextTransform getTextTransform() { return mTextTransform; @@ -397,12 +395,10 @@ public float getLetterSpacing() { return letterSpacingPixels / mFontSize; } - @Override public float getEffectiveLetterSpacing() { return getLetterSpacing(); } - @Override public int getEffectiveFontSize() { return mFontSize; } @@ -427,7 +423,6 @@ private void setFontSize(float fontSize) { mFontSize = (int) fontSize; } - @Override public int getColor() { return mColor; } @@ -439,12 +434,10 @@ private void setColor(@Nullable Integer color) { } } - @Override public boolean isColorSet() { return mIsColorSet; } - @Override public int getBackgroundColor() { return mBackgroundColor; } @@ -460,17 +453,14 @@ private void setBackgroundColor(Integer color) { // } } - @Override public boolean isBackgroundColorSet() { return mIsBackgroundColorSet; } - @Override public int getFontStyle() { return mFontStyle; } - @Override public String getFontFamily() { return mFontFamily; } @@ -577,12 +567,10 @@ private void setFontVariant(@Nullable MapBuffer fontVariant) { mFontFeatureSettings = TextUtils.join(", ", features); } - @Override public String getFontFeatureSettings() { return mFontFeatureSettings; } - @Override public int getFontWeight() { return mFontWeight; } @@ -613,12 +601,10 @@ private void setTextDecorationLine(@Nullable String textDecorationLineString) { } } - @Override public boolean isUnderlineTextDecorationSet() { return mIsUnderlineTextDecorationSet; } - @Override public boolean isLineThroughTextDecorationSet() { return mIsLineThroughTextDecorationSet; } @@ -641,7 +627,6 @@ private void setTextShadowOffset(ReadableMap offsetMap) { } } - @Override public float getTextShadowOffsetDx() { return mTextShadowOffsetDx; } @@ -650,7 +635,6 @@ private void setTextShadowOffsetDx(float dx) { mTextShadowOffsetDx = PixelUtil.toPixelFromDIP(dx); } - @Override public float getTextShadowOffsetDy() { return mTextShadowOffsetDy; } @@ -678,7 +662,6 @@ private void setLayoutDirection(@Nullable String layoutDirection) { mLayoutDirection = getLayoutDirection(layoutDirection); } - @Override public float getTextShadowRadius() { return mTextShadowRadius; } @@ -689,7 +672,6 @@ private void setTextShadowRadius(float textShadowRadius) { } } - @Override public int getTextShadowColor() { return mTextShadowColor; } @@ -715,7 +697,6 @@ private void setTextTransform(@Nullable String textTransform) { } } - @Override public AccessibilityRole getAccessibilityRole() { return mAccessibilityRole; } @@ -729,7 +710,6 @@ private void setAccessibilityRole(@Nullable String accessibilityRole) { } @Nullable - @Override public Role getRole() { return mRole; } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java index b99fbc8c9a96fd..25db6bfdb07fa6 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java @@ -31,13 +31,11 @@ import com.facebook.react.bridge.WritableArray; import com.facebook.react.common.ReactConstants; import com.facebook.react.common.build.ReactBuildConfig; -import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags; import com.facebook.react.uimanager.PixelUtil; import com.facebook.react.uimanager.ReactAccessibilityDelegate.AccessibilityRole; import com.facebook.react.uimanager.ReactAccessibilityDelegate.Role; import com.facebook.react.uimanager.ReactStylesDiffMap; import com.facebook.react.uimanager.ViewProps; -import com.facebook.react.views.text.fragments.BridgeTextFragmentList; import com.facebook.react.views.text.internal.span.CustomLetterSpacingSpan; import com.facebook.react.views.text.internal.span.CustomLineHeightSpan; import com.facebook.react.views.text.internal.span.CustomStyleSpan; @@ -118,18 +116,6 @@ private static void buildSpannableFromFragments( ReadableArray fragments, SpannableStringBuilder sb, List ops) { - if (ReactNativeFeatureFlags.enableSpannableBuildingUnification()) { - buildSpannableFromFragmentsUnified(context, fragments, sb, ops); - } else { - buildSpannableFromFragmentsDuplicated(context, fragments, sb, ops); - } - } - - private static void buildSpannableFromFragmentsDuplicated( - Context context, - ReadableArray fragments, - SpannableStringBuilder sb, - List ops) { for (int i = 0, length = fragments.size(); i < length; i++) { ReadableMap fragment = fragments.getMap(i); @@ -223,17 +209,6 @@ private static void buildSpannableFromFragmentsDuplicated( } } - private static void buildSpannableFromFragmentsUnified( - Context context, - ReadableArray fragments, - SpannableStringBuilder sb, - List ops) { - - final BridgeTextFragmentList textFragmentList = new BridgeTextFragmentList(fragments); - - TextLayoutUtils.buildSpannableFromTextFragmentList(context, textFragmentList, sb, ops); - } - // public because both ReactTextViewManager and ReactTextInputManager need to use this public static Spannable getOrCreateSpannableForText( Context context, diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManagerMapBuffer.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManagerMapBuffer.java index d1605fc9c2e29d..22f590515b38f1 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManagerMapBuffer.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManagerMapBuffer.java @@ -34,11 +34,9 @@ import com.facebook.react.common.build.ReactBuildConfig; import com.facebook.react.common.mapbuffer.MapBuffer; import com.facebook.react.common.mapbuffer.ReadableMapBuffer; -import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags; import com.facebook.react.uimanager.PixelUtil; import com.facebook.react.uimanager.ReactAccessibilityDelegate.AccessibilityRole; import com.facebook.react.uimanager.ReactAccessibilityDelegate.Role; -import com.facebook.react.views.text.fragments.MapBufferTextFragmentList; import com.facebook.react.views.text.internal.span.CustomLetterSpacingSpan; import com.facebook.react.views.text.internal.span.CustomLineHeightSpan; import com.facebook.react.views.text.internal.span.CustomStyleSpan; @@ -202,15 +200,6 @@ public static int getTextGravity( private static void buildSpannableFromFragments( Context context, MapBuffer fragments, SpannableStringBuilder sb, List ops) { - if (ReactNativeFeatureFlags.enableSpannableBuildingUnification()) { - buildSpannableFromFragmentsUnified(context, fragments, sb, ops); - } else { - buildSpannableFromFragmentsDuplicated(context, fragments, sb, ops); - } - } - - private static void buildSpannableFromFragmentsDuplicated( - Context context, MapBuffer fragments, SpannableStringBuilder sb, List ops) { for (int i = 0, length = fragments.getCount(); i < length; i++) { MapBuffer fragment = fragments.getMapBuffer(i); @@ -303,14 +292,6 @@ private static void buildSpannableFromFragmentsDuplicated( } } - private static void buildSpannableFromFragmentsUnified( - Context context, MapBuffer fragments, SpannableStringBuilder sb, List ops) { - - final MapBufferTextFragmentList textFragmentList = new MapBufferTextFragmentList(fragments); - - TextLayoutUtils.buildSpannableFromTextFragmentList(context, textFragmentList, sb, ops); - } - // public because both ReactTextViewManager and ReactTextInputManager need to use this public static Spannable getOrCreateSpannableForText( Context context, diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutUtils.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutUtils.kt deleted file mode 100644 index e72afed9458222..00000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutUtils.kt +++ /dev/null @@ -1,379 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.views.text - -import android.content.Context -import android.graphics.Color -import android.text.Spannable -import android.text.SpannableStringBuilder -import android.view.View -import com.facebook.react.common.ReactConstants -import com.facebook.react.uimanager.PixelUtil -import com.facebook.react.uimanager.ReactAccessibilityDelegate -import com.facebook.react.views.text.fragments.TextFragment -import com.facebook.react.views.text.fragments.TextFragmentList -import com.facebook.react.views.text.internal.span.CustomLetterSpacingSpan -import com.facebook.react.views.text.internal.span.CustomLineHeightSpan -import com.facebook.react.views.text.internal.span.CustomStyleSpan -import com.facebook.react.views.text.internal.span.ReactAbsoluteSizeSpan -import com.facebook.react.views.text.internal.span.ReactBackgroundColorSpan -import com.facebook.react.views.text.internal.span.ReactClickableSpan -import com.facebook.react.views.text.internal.span.ReactForegroundColorSpan -import com.facebook.react.views.text.internal.span.ReactStrikethroughSpan -import com.facebook.react.views.text.internal.span.ReactTagSpan -import com.facebook.react.views.text.internal.span.ReactUnderlineSpan -import com.facebook.react.views.text.internal.span.SetSpanOperation -import com.facebook.react.views.text.internal.span.ShadowStyleSpan -import com.facebook.react.views.text.internal.span.TextInlineViewPlaceholderSpan - -/** Utility methods for building [Spannable]s */ -internal object TextLayoutUtils { - private const val INLINE_VIEW_PLACEHOLDER = "0" - - @JvmStatic - fun buildSpannableFromTextFragmentList( - context: Context, - textFragmentList: TextFragmentList, - sb: SpannableStringBuilder, - ops: MutableList, - ) { - for (i in 0 until textFragmentList.count) { - val fragment = textFragmentList.getFragment(i) - - addApplicableFragmentSpans( - context = context, - fragment = fragment, - sb = sb, - ops = ops, - ) - } - } - - private fun addApplicableFragmentSpans( - context: Context, - fragment: TextFragment, - sb: SpannableStringBuilder, - ops: MutableList, - ) { - val start = sb.length - - // ReactRawText - val textAttributes = fragment.textAttributeProps - - addText(sb, fragment.string, textAttributes) - - val end = sb.length - val reactTag = if (fragment.hasReactTag()) fragment.reactTag else View.NO_ID - if (fragment.hasIsAttachment() && fragment.isAttachment) { - val width = PixelUtil.toPixelFromSP(fragment.width) - val height = PixelUtil.toPixelFromSP(fragment.height) - - addInlineViewPlaceholderSpan( - ops = ops, - sb = sb, - reactTag = reactTag, - width = width, - height = height, - ) - } else if (end >= start) { - addApplicableTextAttributeSpans( - ops = ops, - textAttributeProvider = textAttributes, - reactTag = reactTag, - context = context, - start = start, - end = end, - ) - } - } - - @JvmStatic - fun addText( - sb: SpannableStringBuilder, - text: String?, - textAttributeProvider: EffectiveTextAttributeProvider - ) { - sb.append(TextTransform.apply(text, textAttributeProvider.textTransform)) - } - - @JvmStatic - fun addInlineViewPlaceholderSpan( - ops: MutableList, - sb: SpannableStringBuilder, - reactTag: Int, - width: Float, - height: Float - ) { - ops.add( - SetSpanOperation( - sb.length - INLINE_VIEW_PLACEHOLDER.length, - sb.length, - TextInlineViewPlaceholderSpan(reactTag, width.toInt(), height.toInt()))) - } - - @JvmStatic - fun addApplicableTextAttributeSpans( - ops: MutableList, - textAttributeProvider: EffectiveTextAttributeProvider, - reactTag: Int, - context: Context, - start: Int, - end: Int - ) { - addColorSpanIfApplicable( - ops = ops, - textAttributeProvider = textAttributeProvider, - start = start, - end = end, - ) - - addBackgroundColorSpanIfApplicable( - ops = ops, - textAttributeProvider = textAttributeProvider, - start = start, - end = end, - ) - - addLinkSpanIfApplicable( - ops = ops, - textAttributeProvider = textAttributeProvider, - reactTag, - start = start, - end = end, - ) - - addLetterSpacingSpanIfApplicable( - ops = ops, - textAttributeProvider = textAttributeProvider, - start = start, - end = end, - ) - - addFontSizeSpanIfApplicable( - ops = ops, - textAttributeProvider = textAttributeProvider, - start = start, - end = end, - ) - - addCustomStyleSpanIfApplicable( - ops = ops, - textAttributeProvider = textAttributeProvider, - context, - start = start, - end = end, - ) - - addUnderlineSpanIfApplicable( - ops = ops, - textAttributeProvider = textAttributeProvider, - start = start, - end = end, - ) - - addStrikethroughSpanIfApplicable( - ops = ops, - textAttributeProvider = textAttributeProvider, - start = start, - end = end, - ) - - addShadowStyleSpanIfApplicable( - ops = ops, - textAttributeProvider = textAttributeProvider, - start = start, - end = end, - ) - - addLineHeightSpanIfApplicable( - ops = ops, - textAttributeProvider = textAttributeProvider, - start = start, - end = end, - ) - - addReactTagSpan( - ops = ops, - start = start, - end = end, - reactTag = reactTag, - ) - } - - @JvmStatic - private fun addLinkSpanIfApplicable( - ops: MutableList, - textAttributeProvider: EffectiveTextAttributeProvider, - reactTag: Int, - start: Int, - end: Int - ) { - val roleIsLink = - textAttributeProvider.role?.let { it == ReactAccessibilityDelegate.Role.LINK } - ?: (textAttributeProvider.accessibilityRole == - ReactAccessibilityDelegate.AccessibilityRole.LINK) - if (roleIsLink) { - ops.add(SetSpanOperation(start, end, ReactClickableSpan(reactTag))) - } - } - - @JvmStatic - private fun addColorSpanIfApplicable( - ops: MutableList, - textAttributeProvider: EffectiveTextAttributeProvider, - start: Int, - end: Int - ) { - if (textAttributeProvider.isColorSet) { - ops.add(SetSpanOperation(start, end, ReactForegroundColorSpan(textAttributeProvider.color))) - } - } - - @JvmStatic - private fun addBackgroundColorSpanIfApplicable( - ops: MutableList, - textAttributeProvider: EffectiveTextAttributeProvider, - start: Int, - end: Int - ) { - if (textAttributeProvider.isBackgroundColorSet) { - ops.add( - SetSpanOperation( - start, end, ReactBackgroundColorSpan(textAttributeProvider.backgroundColor))) - } - } - - @JvmStatic - private fun addLetterSpacingSpanIfApplicable( - ops: MutableList, - textAttributeProvider: EffectiveTextAttributeProvider, - start: Int, - end: Int - ) { - val effectiveLetterSpacing = textAttributeProvider.effectiveLetterSpacing - - if (!effectiveLetterSpacing.isNaN()) { - ops.add(SetSpanOperation(start, end, CustomLetterSpacingSpan(effectiveLetterSpacing))) - } - } - - @JvmStatic - private fun addFontSizeSpanIfApplicable( - ops: MutableList, - textAttributeProvider: EffectiveTextAttributeProvider, - start: Int, - end: Int - ) { - val effectiveFontSize = textAttributeProvider.effectiveFontSize - - if (effectiveFontSize != ReactConstants.UNSET) { - ops.add(SetSpanOperation(start, end, ReactAbsoluteSizeSpan(effectiveFontSize))) - } - } - - @JvmStatic - private fun addCustomStyleSpanIfApplicable( - ops: MutableList, - textAttributeProvider: EffectiveTextAttributeProvider, - context: Context, - start: Int, - end: Int - ) { - val fontStyle = textAttributeProvider.fontStyle - val fontWeight = textAttributeProvider.fontWeight - val fontFamily = textAttributeProvider.fontFamily - - if (fontStyle != ReactConstants.UNSET || - fontWeight != ReactConstants.UNSET || - fontFamily != null) { - ops.add( - SetSpanOperation( - start, - end, - CustomStyleSpan( - fontStyle, - fontWeight, - textAttributeProvider.fontFeatureSettings, - fontFamily, - context.assets))) - } - } - - @JvmStatic - private fun addUnderlineSpanIfApplicable( - ops: MutableList, - textAttributeProvider: EffectiveTextAttributeProvider, - start: Int, - end: Int - ) { - if (textAttributeProvider.isUnderlineTextDecorationSet) { - ops.add(SetSpanOperation(start, end, ReactUnderlineSpan())) - } - } - - @JvmStatic - private fun addStrikethroughSpanIfApplicable( - ops: MutableList, - textAttributeProvider: EffectiveTextAttributeProvider, - start: Int, - end: Int - ) { - if (textAttributeProvider.isLineThroughTextDecorationSet) { - ops.add(SetSpanOperation(start, end, ReactStrikethroughSpan())) - } - } - - @JvmStatic - private fun addShadowStyleSpanIfApplicable( - ops: MutableList, - textAttributeProvider: EffectiveTextAttributeProvider, - start: Int, - end: Int - ) { - val hasTextShadowOffset = - textAttributeProvider.textShadowOffsetDx != 0f || - textAttributeProvider.textShadowOffsetDy != 0f - val hasTextShadowRadius = textAttributeProvider.textShadowRadius != 0f - val hasTextShadowColorAlpha = Color.alpha(textAttributeProvider.textShadowColor) != 0 - - if ((hasTextShadowOffset || hasTextShadowRadius) && hasTextShadowColorAlpha) { - ops.add( - SetSpanOperation( - start, - end, - ShadowStyleSpan( - textAttributeProvider.textShadowOffsetDx, - textAttributeProvider.textShadowOffsetDy, - textAttributeProvider.textShadowRadius, - textAttributeProvider.textShadowColor))) - } - } - - @JvmStatic - private fun addLineHeightSpanIfApplicable( - ops: MutableList, - textAttributeProvider: EffectiveTextAttributeProvider, - start: Int, - end: Int - ) { - val effectiveLineHeight = textAttributeProvider.effectiveLineHeight - if (!effectiveLineHeight.isNaN()) { - ops.add(SetSpanOperation(start, end, CustomLineHeightSpan(effectiveLineHeight))) - } - } - - @JvmStatic - private fun addReactTagSpan( - ops: MutableList, - start: Int, - end: Int, - reactTag: Int - ) { - ops.add(SetSpanOperation(start, end, ReactTagSpan(reactTag))) - } -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/BridgeTextFragment.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/BridgeTextFragment.kt deleted file mode 100644 index 45ae17b05a8e2a..00000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/BridgeTextFragment.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.views.text.fragments - -import com.facebook.react.bridge.ReadableMap -import com.facebook.react.uimanager.ReactStylesDiffMap -import com.facebook.react.uimanager.ViewProps -import com.facebook.react.views.text.TextAttributeProps - -/** A [TextFragment] implementation backed by a a [ReadableMap] */ -internal class BridgeTextFragment(private val fragment: ReadableMap) : TextFragment { - override val textAttributeProps: TextAttributeProps - get() { - val textAttributesMap = - fragment.getMap("textAttributes") - ?: throw IllegalStateException("Missing required field `textAttributes`") - return TextAttributeProps.fromReadableMap(ReactStylesDiffMap(textAttributesMap)) - } - - override val string: String? - get() = fragment.getString("string") - - override fun hasReactTag(): Boolean = fragment.hasKey("reactTag") - - override val reactTag: Int - get() = fragment.getInt("reactTag") - - override fun hasIsAttachment(): Boolean = fragment.hasKey(ViewProps.IS_ATTACHMENT) - - override val isAttachment: Boolean - get() = fragment.getBoolean(ViewProps.IS_ATTACHMENT) - - override val width: Double - get() = fragment.getDouble(ViewProps.WIDTH) - - override val height: Double - get() = fragment.getDouble(ViewProps.HEIGHT) -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/BridgeTextFragmentList.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/BridgeTextFragmentList.kt deleted file mode 100644 index 898b91d965b323..00000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/BridgeTextFragmentList.kt +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.views.text.fragments - -import com.facebook.react.bridge.ReadableArray - -/** A list of [TextFragment]s backed by a [ReadableArray] */ -internal class BridgeTextFragmentList(private val fragments: ReadableArray) : TextFragmentList { - override fun getFragment(index: Int): TextFragment = BridgeTextFragment(fragments.getMap(index)) - - override val count: Int - get() = fragments.size() -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/MapBufferTextFragment.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/MapBufferTextFragment.kt deleted file mode 100644 index ccaf93478c656b..00000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/MapBufferTextFragment.kt +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.views.text.fragments - -import com.facebook.react.common.mapbuffer.MapBuffer -import com.facebook.react.views.text.TextAttributeProps -import com.facebook.react.views.text.TextLayoutManagerMapBuffer.FR_KEY_HEIGHT -import com.facebook.react.views.text.TextLayoutManagerMapBuffer.FR_KEY_IS_ATTACHMENT -import com.facebook.react.views.text.TextLayoutManagerMapBuffer.FR_KEY_REACT_TAG -import com.facebook.react.views.text.TextLayoutManagerMapBuffer.FR_KEY_STRING -import com.facebook.react.views.text.TextLayoutManagerMapBuffer.FR_KEY_TEXT_ATTRIBUTES -import com.facebook.react.views.text.TextLayoutManagerMapBuffer.FR_KEY_WIDTH - -/** A [TextFragment] implementation backed by a [MapBuffer] */ -internal class MapBufferTextFragment(private val fragment: MapBuffer) : TextFragment { - override val textAttributeProps: TextAttributeProps - get() = TextAttributeProps.fromMapBuffer(fragment.getMapBuffer(FR_KEY_TEXT_ATTRIBUTES.toInt())) - - override val string: String - get() = fragment.getString(FR_KEY_STRING.toInt()) - - override fun hasReactTag(): Boolean = fragment.contains(FR_KEY_REACT_TAG.toInt()) - - override val reactTag: Int - get() = fragment.getInt(FR_KEY_REACT_TAG.toInt()) - - override fun hasIsAttachment(): Boolean = fragment.contains(FR_KEY_IS_ATTACHMENT.toInt()) - - override val isAttachment: Boolean - get() = fragment.getBoolean(FR_KEY_IS_ATTACHMENT.toInt()) - - override val width: Double - get() = fragment.getDouble(FR_KEY_WIDTH.toInt()) - - override val height: Double - get() = fragment.getDouble(FR_KEY_HEIGHT.toInt()) -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/MapBufferTextFragmentList.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/MapBufferTextFragmentList.kt deleted file mode 100644 index d6816e04df9eea..00000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/MapBufferTextFragmentList.kt +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.views.text.fragments - -import com.facebook.react.common.mapbuffer.MapBuffer - -/** A list of [TextFragment]s backed by a [MapBuffer] */ -internal class MapBufferTextFragmentList(private val fragments: MapBuffer) : TextFragmentList { - override fun getFragment(index: Int): TextFragment = - MapBufferTextFragment(fragments.getMapBuffer(index)) - - override val count: Int - get() = fragments.count -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/TextFragment.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/TextFragment.kt deleted file mode 100644 index b1692809499cf7..00000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/TextFragment.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.views.text.fragments - -import com.facebook.react.views.text.TextAttributeProps - -/** Interface for a text fragment */ -internal interface TextFragment { - val textAttributeProps: TextAttributeProps - - val string: String? - - fun hasReactTag(): Boolean - - val reactTag: Int - - fun hasIsAttachment(): Boolean - - val isAttachment: Boolean - - val width: Double - - val height: Double -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/TextFragmentList.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/TextFragmentList.kt deleted file mode 100644 index 84488da8448f23..00000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/fragments/TextFragmentList.kt +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.views.text.fragments - -/** Interface for a list of [TextFragment]s */ -internal interface TextFragmentList { - fun getFragment(index: Int): TextFragment - - val count: Int -} diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp index 51cdf6e4d33aef..d995bd365679e2 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +++ b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<725d39e6d2dd9905afe14b1e8ce6f6d2>> + * @generated SignedSource<> */ /** @@ -87,12 +87,6 @@ class ReactNativeFeatureFlagsProviderHolder return method(javaProvider_); } - bool enableSpannableBuildingUnification() override { - static const auto method = - getReactNativeFeatureFlagsProviderJavaClass()->getMethod("enableSpannableBuildingUnification"); - return method(javaProvider_); - } - bool enableSynchronousStateUpdates() override { static const auto method = getReactNativeFeatureFlagsProviderJavaClass()->getMethod("enableSynchronousStateUpdates"); @@ -197,11 +191,6 @@ bool JReactNativeFeatureFlagsCxxInterop::enableMicrotasks( return ReactNativeFeatureFlags::enableMicrotasks(); } -bool JReactNativeFeatureFlagsCxxInterop::enableSpannableBuildingUnification( - facebook::jni::alias_ref /*unused*/) { - return ReactNativeFeatureFlags::enableSpannableBuildingUnification(); -} - bool JReactNativeFeatureFlagsCxxInterop::enableSynchronousStateUpdates( facebook::jni::alias_ref /*unused*/) { return ReactNativeFeatureFlags::enableSynchronousStateUpdates(); @@ -293,9 +282,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() { makeNativeMethod( "enableMicrotasks", JReactNativeFeatureFlagsCxxInterop::enableMicrotasks), - makeNativeMethod( - "enableSpannableBuildingUnification", - JReactNativeFeatureFlagsCxxInterop::enableSpannableBuildingUnification), makeNativeMethod( "enableSynchronousStateUpdates", JReactNativeFeatureFlagsCxxInterop::enableSynchronousStateUpdates), diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h index 59a4e35d9526ff..85c313ec3f4735 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +++ b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<02a3e59da7f57a5643f6bbb1a66b9e73>> + * @generated SignedSource<<7a018c3e2121cfef064bcca21e286d08>> */ /** @@ -54,9 +54,6 @@ class JReactNativeFeatureFlagsCxxInterop static bool enableMicrotasks( facebook::jni::alias_ref); - static bool enableSpannableBuildingUnification( - facebook::jni::alias_ref); - static bool enableSynchronousStateUpdates( facebook::jni::alias_ref); diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp index fddacc7dc21282..45cc6e2a197c5b 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<4670cd532d74243e679e1fcd7731d8c8>> + * @generated SignedSource<> */ /** @@ -53,10 +53,6 @@ bool ReactNativeFeatureFlags::enableMicrotasks() { return getAccessor().enableMicrotasks(); } -bool ReactNativeFeatureFlags::enableSpannableBuildingUnification() { - return getAccessor().enableSpannableBuildingUnification(); -} - bool ReactNativeFeatureFlags::enableSynchronousStateUpdates() { return getAccessor().enableSynchronousStateUpdates(); } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h index 11606fd8432e7c..f21271e8973fe4 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<> */ /** @@ -77,11 +77,6 @@ class ReactNativeFeatureFlags { */ RN_EXPORT static bool enableMicrotasks(); - /** - * Uses new, deduplicated logic for constructing Android Spannables from text fragments - */ - RN_EXPORT static bool enableSpannableBuildingUnification(); - /** * Dispatches state updates synchronously in Fabric (e.g.: updates the scroll position in the shadow tree synchronously from the main thread). */ diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp index 909b9821a5d067..26c552f7415e4c 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<7e0846074030ffa7bc0006de4bee533b>> + * @generated SignedSource<<58b7a5fa22b58e21dfc953716db9eba6>> */ /** @@ -173,24 +173,6 @@ bool ReactNativeFeatureFlagsAccessor::enableMicrotasks() { return flagValue.value(); } -bool ReactNativeFeatureFlagsAccessor::enableSpannableBuildingUnification() { - auto flagValue = enableSpannableBuildingUnification_.load(); - - if (!flagValue.has_value()) { - // This block is not exclusive but it is not necessary. - // If multiple threads try to initialize the feature flag, we would only - // be accessing the provider multiple times but the end state of this - // instance and the returned flag value would be the same. - - markFlagAsAccessed(8, "enableSpannableBuildingUnification"); - - flagValue = currentProvider_->enableSpannableBuildingUnification(); - enableSpannableBuildingUnification_ = flagValue; - } - - return flagValue.value(); -} - bool ReactNativeFeatureFlagsAccessor::enableSynchronousStateUpdates() { auto flagValue = enableSynchronousStateUpdates_.load(); @@ -200,7 +182,7 @@ bool ReactNativeFeatureFlagsAccessor::enableSynchronousStateUpdates() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(9, "enableSynchronousStateUpdates"); + markFlagAsAccessed(8, "enableSynchronousStateUpdates"); flagValue = currentProvider_->enableSynchronousStateUpdates(); enableSynchronousStateUpdates_ = flagValue; @@ -218,7 +200,7 @@ bool ReactNativeFeatureFlagsAccessor::enableUIConsistency() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(10, "enableUIConsistency"); + markFlagAsAccessed(9, "enableUIConsistency"); flagValue = currentProvider_->enableUIConsistency(); enableUIConsistency_ = flagValue; @@ -236,7 +218,7 @@ bool ReactNativeFeatureFlagsAccessor::fixMountedFlagAndFixPreallocationClone() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(11, "fixMountedFlagAndFixPreallocationClone"); + markFlagAsAccessed(10, "fixMountedFlagAndFixPreallocationClone"); flagValue = currentProvider_->fixMountedFlagAndFixPreallocationClone(); fixMountedFlagAndFixPreallocationClone_ = flagValue; @@ -254,7 +236,7 @@ bool ReactNativeFeatureFlagsAccessor::forceBatchingMountItemsOnAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(12, "forceBatchingMountItemsOnAndroid"); + markFlagAsAccessed(11, "forceBatchingMountItemsOnAndroid"); flagValue = currentProvider_->forceBatchingMountItemsOnAndroid(); forceBatchingMountItemsOnAndroid_ = flagValue; @@ -272,7 +254,7 @@ bool ReactNativeFeatureFlagsAccessor::inspectorEnableCxxInspectorPackagerConnect // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(13, "inspectorEnableCxxInspectorPackagerConnection"); + markFlagAsAccessed(12, "inspectorEnableCxxInspectorPackagerConnection"); flagValue = currentProvider_->inspectorEnableCxxInspectorPackagerConnection(); inspectorEnableCxxInspectorPackagerConnection_ = flagValue; @@ -290,7 +272,7 @@ bool ReactNativeFeatureFlagsAccessor::inspectorEnableModernCDPRegistry() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(14, "inspectorEnableModernCDPRegistry"); + markFlagAsAccessed(13, "inspectorEnableModernCDPRegistry"); flagValue = currentProvider_->inspectorEnableModernCDPRegistry(); inspectorEnableModernCDPRegistry_ = flagValue; @@ -308,7 +290,7 @@ bool ReactNativeFeatureFlagsAccessor::preventDoubleTextMeasure() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(15, "preventDoubleTextMeasure"); + markFlagAsAccessed(14, "preventDoubleTextMeasure"); flagValue = currentProvider_->preventDoubleTextMeasure(); preventDoubleTextMeasure_ = flagValue; @@ -326,7 +308,7 @@ bool ReactNativeFeatureFlagsAccessor::useModernRuntimeScheduler() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(16, "useModernRuntimeScheduler"); + markFlagAsAccessed(15, "useModernRuntimeScheduler"); flagValue = currentProvider_->useModernRuntimeScheduler(); useModernRuntimeScheduler_ = flagValue; @@ -344,7 +326,7 @@ bool ReactNativeFeatureFlagsAccessor::useNativeViewConfigsInBridgelessMode() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(17, "useNativeViewConfigsInBridgelessMode"); + markFlagAsAccessed(16, "useNativeViewConfigsInBridgelessMode"); flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode(); useNativeViewConfigsInBridgelessMode_ = flagValue; @@ -362,7 +344,7 @@ bool ReactNativeFeatureFlagsAccessor::useStateAlignmentMechanism() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(18, "useStateAlignmentMechanism"); + markFlagAsAccessed(17, "useStateAlignmentMechanism"); flagValue = currentProvider_->useStateAlignmentMechanism(); useStateAlignmentMechanism_ = flagValue; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h index 8ea93f0f29f58e..0353f13913356c 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<0da2db91c1f04980d3bb69869acb94c6>> + * @generated SignedSource<<9e91caddfdc8fdf56f9229c2d4c43355>> */ /** @@ -39,7 +39,6 @@ class ReactNativeFeatureFlagsAccessor { bool enableBackgroundExecutor(); bool enableCleanTextInputYogaNode(); bool enableMicrotasks(); - bool enableSpannableBuildingUnification(); bool enableSynchronousStateUpdates(); bool enableUIConsistency(); bool fixMountedFlagAndFixPreallocationClone(); @@ -60,7 +59,7 @@ class ReactNativeFeatureFlagsAccessor { std::unique_ptr currentProvider_; bool wasOverridden_; - std::array, 19> accessedFeatureFlags_; + std::array, 18> accessedFeatureFlags_; std::atomic> commonTestFlag_; std::atomic> allowCollapsableChildren_; @@ -70,7 +69,6 @@ class ReactNativeFeatureFlagsAccessor { std::atomic> enableBackgroundExecutor_; std::atomic> enableCleanTextInputYogaNode_; std::atomic> enableMicrotasks_; - std::atomic> enableSpannableBuildingUnification_; std::atomic> enableSynchronousStateUpdates_; std::atomic> enableUIConsistency_; std::atomic> fixMountedFlagAndFixPreallocationClone_; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h index 0637d6546789b0..dfce2707950978 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<35a53d5dae3f58a924034a4a55bddb07>> + * @generated SignedSource<> */ /** @@ -59,10 +59,6 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider { return false; } - bool enableSpannableBuildingUnification() override { - return false; - } - bool enableSynchronousStateUpdates() override { return false; } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h index 1f433c419c4606..69da73000cea59 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<9ac60948920b54f78a7a339a05a7f246>> */ /** @@ -33,7 +33,6 @@ class ReactNativeFeatureFlagsProvider { virtual bool enableBackgroundExecutor() = 0; virtual bool enableCleanTextInputYogaNode() = 0; virtual bool enableMicrotasks() = 0; - virtual bool enableSpannableBuildingUnification() = 0; virtual bool enableSynchronousStateUpdates() = 0; virtual bool enableUIConsistency() = 0; virtual bool fixMountedFlagAndFixPreallocationClone() = 0; diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp index d04b346e83aa23..745117a2148fb0 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +++ b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<> */ /** @@ -77,11 +77,6 @@ bool NativeReactNativeFeatureFlags::enableMicrotasks( return ReactNativeFeatureFlags::enableMicrotasks(); } -bool NativeReactNativeFeatureFlags::enableSpannableBuildingUnification( - jsi::Runtime& /*runtime*/) { - return ReactNativeFeatureFlags::enableSpannableBuildingUnification(); -} - bool NativeReactNativeFeatureFlags::enableSynchronousStateUpdates( jsi::Runtime& /*runtime*/) { return ReactNativeFeatureFlags::enableSynchronousStateUpdates(); diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h index 11bc054322b80f..1c6183807ecce2 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +++ b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<> */ /** @@ -51,8 +51,6 @@ class NativeReactNativeFeatureFlags bool enableMicrotasks(jsi::Runtime& runtime); - bool enableSpannableBuildingUnification(jsi::Runtime& runtime); - bool enableSynchronousStateUpdates(jsi::Runtime& runtime); bool enableUIConsistency(jsi::Runtime& runtime); diff --git a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js index f62142da2f75f5..7e210ff41204cb 100644 --- a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js +++ b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js @@ -73,11 +73,6 @@ const definitions: FeatureFlagDefinitions = { description: 'Enables the use of microtasks in Hermes (scheduling) and RuntimeScheduler (execution).', }, - enableSpannableBuildingUnification: { - defaultValue: false, - description: - 'Uses new, deduplicated logic for constructing Android Spannables from text fragments', - }, enableSynchronousStateUpdates: { defaultValue: false, description: diff --git a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js index 7997c2ed281d98..fd9992634a4ee7 100644 --- a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js +++ b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<1c619af9daa978beca7856be0705638d>> + * @generated SignedSource<> * @flow strict-local */ @@ -48,7 +48,6 @@ export type ReactNativeFeatureFlags = { enableBackgroundExecutor: Getter, enableCleanTextInputYogaNode: Getter, enableMicrotasks: Getter, - enableSpannableBuildingUnification: Getter, enableSynchronousStateUpdates: Getter, enableUIConsistency: Getter, fixMountedFlagAndFixPreallocationClone: Getter, @@ -133,10 +132,6 @@ export const enableCleanTextInputYogaNode: Getter = createNativeFlagGet * Enables the use of microtasks in Hermes (scheduling) and RuntimeScheduler (execution). */ export const enableMicrotasks: Getter = createNativeFlagGetter('enableMicrotasks', false); -/** - * Uses new, deduplicated logic for constructing Android Spannables from text fragments - */ -export const enableSpannableBuildingUnification: Getter = createNativeFlagGetter('enableSpannableBuildingUnification', false); /** * Dispatches state updates synchronously in Fabric (e.g.: updates the scroll position in the shadow tree synchronously from the main thread). */ diff --git a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js index ebb685f8e456d3..28573167b63816 100644 --- a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +++ b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<33058307ecf739d0e8c9e2240a4f7b98>> * @flow strict-local */ @@ -31,7 +31,6 @@ export interface Spec extends TurboModule { +enableBackgroundExecutor?: () => boolean; +enableCleanTextInputYogaNode?: () => boolean; +enableMicrotasks?: () => boolean; - +enableSpannableBuildingUnification?: () => boolean; +enableSynchronousStateUpdates?: () => boolean; +enableUIConsistency?: () => boolean; +fixMountedFlagAndFixPreallocationClone?: () => boolean;