mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Rename TextLayoutManagerMapBuffer to TextLayoutManager
Summary: Clean this up, now that there is only one TextLayoutManager. Changelog: [Internal] Reviewed By: christophpurrer Differential Revision: D56801446 fbshipit-source-id: 1b81a16031ab520d06d8935000d5019609f8a254
This commit is contained in:
committed by
Facebook GitHub Bot
parent
8871b95cda
commit
bbb52c575d
@@ -7493,7 +7493,7 @@ public class com/facebook/react/views/text/TextAttributes {
|
||||
public fun toString ()Ljava/lang/String;
|
||||
}
|
||||
|
||||
public class com/facebook/react/views/text/TextLayoutManagerMapBuffer {
|
||||
public class com/facebook/react/views/text/TextLayoutManager {
|
||||
public static final field AS_KEY_CACHE_ID S
|
||||
public static final field AS_KEY_FRAGMENTS S
|
||||
public static final field AS_KEY_HASH S
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ public class ReactFeatureFlags {
|
||||
|
||||
public static boolean dispatchPointerEvents = false;
|
||||
|
||||
/** Feature Flag to enable a cache of Spannable objects used by TextLayoutManagerMapBuffer */
|
||||
/** Feature Flag to enable a cache of Spannable objects used by TextLayoutManager */
|
||||
public static boolean enableTextSpannableCache = false;
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -85,7 +85,7 @@ import com.facebook.react.uimanager.events.EventCategoryDef;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
import com.facebook.react.uimanager.events.FabricEventDispatcher;
|
||||
import com.facebook.react.uimanager.events.RCTEventEmitter;
|
||||
import com.facebook.react.views.text.TextLayoutManagerMapBuffer;
|
||||
import com.facebook.react.views.text.TextLayoutManager;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -497,7 +497,7 @@ public class FabricUIManager implements UIManager, LifecycleEventListener, UIBlo
|
||||
float width,
|
||||
float height) {
|
||||
return (NativeArray)
|
||||
TextLayoutManagerMapBuffer.measureLines(
|
||||
TextLayoutManager.measureLines(
|
||||
mReactApplicationContext,
|
||||
attributedString,
|
||||
paragraphAttributes,
|
||||
|
||||
+1
-1
@@ -365,7 +365,7 @@ public class ReactTextView extends AppCompatTextView implements ReactCompoundVie
|
||||
protected void onDraw(Canvas canvas) {
|
||||
if (mAdjustsFontSizeToFit && getSpanned() != null && mShouldAdjustSpannableFontSize) {
|
||||
mShouldAdjustSpannableFontSize = false;
|
||||
TextLayoutManagerMapBuffer.adjustSpannableFontToFit(
|
||||
TextLayoutManager.adjustSpannableFontToFit(
|
||||
getSpanned(),
|
||||
getWidth(),
|
||||
YogaMeasureMode.EXACTLY,
|
||||
|
||||
+5
-6
@@ -145,17 +145,17 @@ public class ReactTextViewManager
|
||||
MapBuffer attributedString = state.getMapBuffer(TX_STATE_KEY_ATTRIBUTED_STRING);
|
||||
MapBuffer paragraphAttributes = state.getMapBuffer(TX_STATE_KEY_PARAGRAPH_ATTRIBUTES);
|
||||
Spannable spanned =
|
||||
TextLayoutManagerMapBuffer.getOrCreateSpannableForText(
|
||||
TextLayoutManager.getOrCreateSpannableForText(
|
||||
view.getContext(), attributedString, mReactTextViewManagerCallback);
|
||||
view.setSpanned(spanned);
|
||||
|
||||
float minimumFontSize =
|
||||
(float) paragraphAttributes.getDouble(TextLayoutManagerMapBuffer.PA_KEY_MINIMUM_FONT_SIZE);
|
||||
(float) paragraphAttributes.getDouble(TextLayoutManager.PA_KEY_MINIMUM_FONT_SIZE);
|
||||
view.setMinimumFontSize(minimumFontSize);
|
||||
|
||||
int textBreakStrategy =
|
||||
TextAttributeProps.getTextBreakStrategy(
|
||||
paragraphAttributes.getString(TextLayoutManagerMapBuffer.PA_KEY_TEXT_BREAK_STRATEGY));
|
||||
paragraphAttributes.getString(TextLayoutManager.PA_KEY_TEXT_BREAK_STRATEGY));
|
||||
int currentJustificationMode =
|
||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.O ? 0 : view.getJustificationMode();
|
||||
|
||||
@@ -163,8 +163,7 @@ public class ReactTextViewManager
|
||||
spanned,
|
||||
-1, // UNUSED FOR TEXT
|
||||
false, // TODO add this into local Data
|
||||
TextLayoutManagerMapBuffer.getTextGravity(
|
||||
attributedString, spanned, view.getGravityHorizontal()),
|
||||
TextLayoutManager.getTextGravity(attributedString, spanned, view.getGravityHorizontal()),
|
||||
textBreakStrategy,
|
||||
TextAttributeProps.getJustificationMode(props, currentJustificationMode));
|
||||
}
|
||||
@@ -193,7 +192,7 @@ public class ReactTextViewManager
|
||||
float height,
|
||||
YogaMeasureMode heightMode,
|
||||
@Nullable float[] attachmentsPositions) {
|
||||
return TextLayoutManagerMapBuffer.measureText(
|
||||
return TextLayoutManager.measureText(
|
||||
context,
|
||||
localData,
|
||||
props,
|
||||
|
||||
+2
-2
@@ -58,7 +58,7 @@ import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/** Class responsible of creating {@link Spanned} object for the JS representation of Text */
|
||||
public class TextLayoutManagerMapBuffer {
|
||||
public class TextLayoutManager {
|
||||
|
||||
// constants for AttributedString serialization
|
||||
public static final short AS_KEY_HASH = 0;
|
||||
@@ -86,7 +86,7 @@ public class TextLayoutManagerMapBuffer {
|
||||
|
||||
private static final boolean ENABLE_MEASURE_LOGGING = ReactBuildConfig.DEBUG && false;
|
||||
|
||||
private static final String TAG = TextLayoutManagerMapBuffer.class.getSimpleName();
|
||||
private static final String TAG = TextLayoutManager.class.getSimpleName();
|
||||
|
||||
// It's important to pass the ANTI_ALIAS_FLAG flag to the constructor rather than setting it
|
||||
// later by calling setFlags. This is because the latter approach triggers a bug on Android 4.4.2.
|
||||
+3
-3
@@ -55,7 +55,7 @@ import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
import com.facebook.react.views.text.ReactTextUpdate;
|
||||
import com.facebook.react.views.text.ReactTypefaceUtils;
|
||||
import com.facebook.react.views.text.TextAttributes;
|
||||
import com.facebook.react.views.text.TextLayoutManagerMapBuffer;
|
||||
import com.facebook.react.views.text.TextLayoutManager;
|
||||
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;
|
||||
@@ -216,7 +216,7 @@ public class ReactEditText extends AppCompatEditText {
|
||||
if (DEBUG_MODE) {
|
||||
FLog.e(TAG, "finalize[" + getId() + "] delete cached spannable");
|
||||
}
|
||||
TextLayoutManagerMapBuffer.deleteCachedSpannableForTag(getId());
|
||||
TextLayoutManager.deleteCachedSpannableForTag(getId());
|
||||
}
|
||||
|
||||
// After the text changes inside an EditText, TextView checks if a layout() has been requested.
|
||||
@@ -1219,7 +1219,7 @@ public class ReactEditText extends AppCompatEditText {
|
||||
}
|
||||
|
||||
addSpansFromStyleAttributes(sb);
|
||||
TextLayoutManagerMapBuffer.setCachedSpannableForTag(getId(), sb);
|
||||
TextLayoutManager.setCachedSpannableForTag(getId(), sb);
|
||||
}
|
||||
|
||||
void setEventDispatcher(@Nullable EventDispatcher eventDispatcher) {
|
||||
|
||||
+4
-4
@@ -67,7 +67,7 @@ import com.facebook.react.views.text.ReactTextUpdate;
|
||||
import com.facebook.react.views.text.ReactTextViewManagerCallback;
|
||||
import com.facebook.react.views.text.ReactTypefaceUtils;
|
||||
import com.facebook.react.views.text.TextAttributeProps;
|
||||
import com.facebook.react.views.text.TextLayoutManagerMapBuffer;
|
||||
import com.facebook.react.views.text.TextLayoutManager;
|
||||
import com.facebook.react.views.text.TextTransform;
|
||||
import com.facebook.react.views.text.internal.span.TextInlineImageSpan;
|
||||
import com.facebook.yoga.YogaConstants;
|
||||
@@ -1389,12 +1389,12 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
||||
MapBuffer paragraphAttributes = state.getMapBuffer(TX_STATE_KEY_PARAGRAPH_ATTRIBUTES);
|
||||
|
||||
Spannable spanned =
|
||||
TextLayoutManagerMapBuffer.getOrCreateSpannableForText(
|
||||
TextLayoutManager.getOrCreateSpannableForText(
|
||||
view.getContext(), attributedString, mReactTextViewManagerCallback);
|
||||
|
||||
int textBreakStrategy =
|
||||
TextAttributeProps.getTextBreakStrategy(
|
||||
paragraphAttributes.getString(TextLayoutManagerMapBuffer.PA_KEY_TEXT_BREAK_STRATEGY));
|
||||
paragraphAttributes.getString(TextLayoutManager.PA_KEY_TEXT_BREAK_STRATEGY));
|
||||
int currentJustificationMode =
|
||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.O ? 0 : view.getJustificationMode();
|
||||
|
||||
@@ -1402,7 +1402,7 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
||||
spanned,
|
||||
state.getInt(TX_STATE_KEY_MOST_RECENT_EVENT_COUNT),
|
||||
TextAttributeProps.getTextAlignment(
|
||||
props, TextLayoutManagerMapBuffer.isRTL(attributedString), view.getGravityHorizontal()),
|
||||
props, TextLayoutManager.isRTL(attributedString), view.getGravityHorizontal()),
|
||||
textBreakStrategy,
|
||||
TextAttributeProps.getJustificationMode(props, currentJustificationMode));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user