From 726d0012106316a40e36286f5eba0e881ef3bbba Mon Sep 17 00:00:00 2001 From: David Vacca Date: Mon, 11 Mar 2019 19:16:51 -0700 Subject: [PATCH] Cleanup TextLayoutManager Summary: Easy cleanup of commented code in TextLayoutManager, I kept the TODOs to complete the code in the future Reviewed By: shergin Differential Revision: D14372356 fbshipit-source-id: ff87f9b09e9f40ed021256f463e39299467b3e0e --- .../react/views/text/TextLayoutManager.java | 34 ++----------------- 1 file changed, 2 insertions(+), 32 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java index 23c7778d683..13c50424778 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java @@ -63,24 +63,7 @@ public class TextLayoutManager { fragment.getString("string"), textAttributes.mTextTransform)); -// TODO: add support for TextInlineImage and BaseText -// if (child instanceof ReactRawTextShadowNode) { -// sb.append(((ReactRawTextShadowNode) child).getText()); -// } else if (child instanceof ReactBaseTextShadowNode) { -// buildSpannableFromFragment((ReactBaseTextShadowNode) child, sb, ops); -// } else if (child instanceof ReactTextInlineImageShadowNode) { -// // 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_IMAGE_PLACEHOLDER); -// ops.add( -// new SetSpanOperation( -// sb.length() - INLINE_IMAGE_PLACEHOLDER.length(), -// sb.length(), -// ((ReactTextInlineImageShadowNode) child).buildInlineImageSpan())); -// } else { -// throw new IllegalViewOperationException( -// "Unexpected view type nested under text node: " + child.getClass()); -// } + // TODO: add support for TextInlineImage and BaseText int end = sb.length(); if (end >= start) { @@ -179,23 +162,10 @@ public class TextLayoutManager { buildSpannableFromFragment(context, attributedString.getArray("fragments"), sb, ops); -// TODO T31905686: add support for inline Images -// textShadowNode.mContainsImages = false; -// textShadowNode.mHeightOfTallestInlineImage = Float.NaN; - + // TODO T31905686: add support for inline Images // While setting the Spans on the final text, we also check whether any of them are images. int priority = 0; for (SetSpanOperation op : ops) { -// TODO T31905686: add support for TextInlineImage in C++ -// if (op.what instanceof TextInlineImageSpan) { -// int height = ((TextInlineImageSpan) op.what).getHeight(); -// textShadowNode.mContainsImages = true; -// if (Float.isNaN(textShadowNode.mHeightOfTallestInlineImage) -// || height > textShadowNode.mHeightOfTallestInlineImage) { -// textShadowNode.mHeightOfTallestInlineImage = height; -// } -// } - // Actual order of calling {@code execute} does NOT matter, // but the {@code priority} DOES matter. op.execute(sb, priority);