ReactTextShadowNode.smali
.class public Lcom/facebook/react/views/text/ReactTextShadowNode;
.super Lcom/facebook/react/views/text/ReactBaseTextShadowNode;
.source "SourceFile"
# annotations
.annotation build Landroid/annotation/TargetApi;
value = 0x17
.end annotation
# static fields
.field private static final sTextPaintInstance:Landroid/text/TextPaint;
# instance fields
.field private mPreparedSpannableText:Landroid/text/Spannable;
.field private mShouldNotifyOnTextLayout:Z
.field private final mTextMeasureFunction:Lcom/facebook/yoga/YogaMeasureFunction;
# direct methods
.method public static constructor <clinit>()V
.registers 2
new-instance v0, Landroid/text/TextPaint;
const/4 v1, 0x1
invoke-direct {v0, v1}, Landroid/text/TextPaint;-><init>(I)V
sput-object v0, Lcom/facebook/react/views/text/ReactTextShadowNode;->sTextPaintInstance:Landroid/text/TextPaint;
return-void
.end method
.method public constructor <init>()V
.registers 2
const/4 v0, 0x0
.line 1
invoke-direct {p0, v0}, Lcom/facebook/react/views/text/ReactTextShadowNode;-><init>(Lcom/facebook/react/views/text/ReactTextViewManagerCallback;)V
return-void
.end method
.method public constructor <init>(Lcom/facebook/react/views/text/ReactTextViewManagerCallback;)V
.registers 2
.line 2
invoke-direct {p0, p1}, Lcom/facebook/react/views/text/ReactBaseTextShadowNode;-><init>(Lcom/facebook/react/views/text/ReactTextViewManagerCallback;)V
.line 3
new-instance p1, Lcom/facebook/react/views/text/ReactTextShadowNode$1;
invoke-direct {p1, p0}, Lcom/facebook/react/views/text/ReactTextShadowNode$1;-><init>(Lcom/facebook/react/views/text/ReactTextShadowNode;)V
iput-object p1, p0, Lcom/facebook/react/views/text/ReactTextShadowNode;->mTextMeasureFunction:Lcom/facebook/yoga/YogaMeasureFunction;
.line 4
invoke-direct {p0}, Lcom/facebook/react/views/text/ReactTextShadowNode;->initMeasureFunction()V
return-void
.end method
.method public static synthetic access$000(Lcom/facebook/react/views/text/ReactTextShadowNode;)Landroid/text/Spannable;
.registers 1
iget-object p0, p0, Lcom/facebook/react/views/text/ReactTextShadowNode;->mPreparedSpannableText:Landroid/text/Spannable;
return-object p0
.end method
.method public static synthetic access$100(Lcom/facebook/react/views/text/ReactTextShadowNode;Landroid/text/Spannable;FLcom/facebook/yoga/YogaMeasureMode;)Landroid/text/Layout;
.registers 4
invoke-direct {p0, p1, p2, p3}, Lcom/facebook/react/views/text/ReactTextShadowNode;->measureSpannedText(Landroid/text/Spannable;FLcom/facebook/yoga/YogaMeasureMode;)Landroid/text/Layout;
move-result-object p0
return-object p0
.end method
.method public static synthetic access$200(Lcom/facebook/react/views/text/ReactTextShadowNode;)Z
.registers 1
iget-boolean p0, p0, Lcom/facebook/react/views/text/ReactTextShadowNode;->mShouldNotifyOnTextLayout:Z
return p0
.end method
.method public static synthetic access$300()Landroid/text/TextPaint;
.registers 1
sget-object v0, Lcom/facebook/react/views/text/ReactTextShadowNode;->sTextPaintInstance:Landroid/text/TextPaint;
return-object v0
.end method
.method private getTextAlign()I
.registers 6
.line 1
iget v0, p0, Lcom/facebook/react/views/text/ReactBaseTextShadowNode;->mTextAlign:I
.line 2
invoke-virtual {p0}, Lcom/facebook/react/uimanager/ReactShadowNodeImpl;->getLayoutDirection()Lcom/facebook/yoga/YogaDirection;
move-result-object v1
sget-object v2, Lcom/facebook/yoga/YogaDirection;->RTL:Lcom/facebook/yoga/YogaDirection;
const/4 v3, 0x3
const/4 v4, 0x5
if-ne v1, v2, :cond_13
if-ne v0, v4, :cond_10
const/4 v0, 0x3
goto :goto_13
:cond_10
if-ne v0, v3, :cond_13
const/4 v0, 0x5
:cond_13
:goto_13
return v0
.end method
.method private initMeasureFunction()V
.registers 2
.line 1
invoke-virtual {p0}, Lcom/facebook/react/uimanager/ReactShadowNodeImpl;->isVirtual()Z
move-result v0
if-nez v0, :cond_b
.line 2
iget-object v0, p0, Lcom/facebook/react/views/text/ReactTextShadowNode;->mTextMeasureFunction:Lcom/facebook/yoga/YogaMeasureFunction;
invoke-virtual {p0, v0}, Lcom/facebook/react/uimanager/ReactShadowNodeImpl;->setMeasureFunction(Lcom/facebook/yoga/YogaMeasureFunction;)V
:cond_b
return-void
.end method
.method private measureSpannedText(Landroid/text/Spannable;FLcom/facebook/yoga/YogaMeasureMode;)Landroid/text/Layout;
.registers 15
.line 1
sget-object v2, Lcom/facebook/react/views/text/ReactTextShadowNode;->sTextPaintInstance:Landroid/text/TextPaint;
.line 2
iget-object v0, p0, Lcom/facebook/react/views/text/ReactBaseTextShadowNode;->mTextAttributes:Lcom/facebook/react/views/text/TextAttributes;
invoke-virtual {v0}, Lcom/facebook/react/views/text/TextAttributes;->getEffectiveFontSize()I
move-result v0
int-to-float v0, v0
invoke-virtual {v2, v0}, Landroid/graphics/Paint;->setTextSize(F)V
.line 3
invoke-static {p1, v2}, Landroid/text/BoringLayout;->isBoring(Ljava/lang/CharSequence;Landroid/text/TextPaint;)Landroid/text/BoringLayout$Metrics;
move-result-object v6
if-nez v6, :cond_17
.line 4
invoke-static {p1, v2}, Landroid/text/Layout;->getDesiredWidth(Ljava/lang/CharSequence;Landroid/text/TextPaint;)F
move-result v0
goto :goto_19
:cond_17
const/high16 v0, 0x7fc00000 # Float.NaN
.line 5
:goto_19
sget-object v1, Lcom/facebook/yoga/YogaMeasureMode;->UNDEFINED:Lcom/facebook/yoga/YogaMeasureMode;
const/4 v3, 0x0
const/4 v4, 0x0
const/4 v5, 0x1
if-eq p3, v1, :cond_27
cmpg-float p3, p2, v4
if-gez p3, :cond_25
goto :goto_27
:cond_25
const/4 p3, 0x0
goto :goto_28
:cond_27
:goto_27
const/4 p3, 0x1
.line 6
:goto_28
sget-object v1, Landroid/text/Layout$Alignment;->ALIGN_NORMAL:Landroid/text/Layout$Alignment;
.line 7
invoke-direct {p0}, Lcom/facebook/react/views/text/ReactTextShadowNode;->getTextAlign()I
move-result v7
if-eq v7, v5, :cond_3e
const/4 v8, 0x3
if-eq v7, v8, :cond_3b
const/4 v8, 0x5
if-eq v7, v8, :cond_38
:goto_36
move-object v7, v1
goto :goto_41
.line 8
:cond_38
sget-object v1, Landroid/text/Layout$Alignment;->ALIGN_OPPOSITE:Landroid/text/Layout$Alignment;
goto :goto_36
.line 9
:cond_3b
sget-object v1, Landroid/text/Layout$Alignment;->ALIGN_NORMAL:Landroid/text/Layout$Alignment;
goto :goto_36
.line 10
:cond_3e
sget-object v1, Landroid/text/Layout$Alignment;->ALIGN_CENTER:Landroid/text/Layout$Alignment;
goto :goto_36
:goto_41
const/16 v1, 0x1c
const/high16 v8, 0x3f800000 # 1.0f
const/16 v9, 0x17
if-nez v6, :cond_a5
if-nez p3, :cond_55
.line 11
invoke-static {v0}, Lcom/facebook/yoga/YogaConstants;->isUndefined(F)Z
move-result v10
if-nez v10, :cond_a5
cmpg-float v10, v0, p2
if-gtz v10, :cond_a5
:cond_55
float-to-double p2, v0
.line 12
invoke-static {p2, p3}, Ljava/lang/Math;->ceil(D)D
move-result-wide p2
double-to-int p2, p2
.line 13
sget p3, Landroid/os/Build$VERSION;->SDK_INT:I
if-ge p3, v9, :cond_70
.line 14
new-instance p3, Landroid/text/StaticLayout;
const/high16 v5, 0x3f800000 # 1.0f
const/4 v6, 0x0
iget-boolean v8, p0, Lcom/facebook/react/views/text/ReactBaseTextShadowNode;->mIncludeFontPadding:Z
move-object v0, p3
move-object v1, p1
move v3, p2
move-object v4, v7
move v7, v8
invoke-direct/range {v0 .. v7}, Landroid/text/StaticLayout;-><init>(Ljava/lang/CharSequence;Landroid/text/TextPaint;ILandroid/text/Layout$Alignment;FFZ)V
goto/16 :goto_101
.line 15
:cond_70
invoke-interface {p1}, Ljava/lang/CharSequence;->length()I
move-result v0
invoke-static {p1, v3, v0, v2, p2}, Landroid/text/StaticLayout$Builder;->obtain(Ljava/lang/CharSequence;IILandroid/text/TextPaint;I)Landroid/text/StaticLayout$Builder;
move-result-object p1
.line 16
invoke-virtual {p1, v7}, Landroid/text/StaticLayout$Builder;->setAlignment(Landroid/text/Layout$Alignment;)Landroid/text/StaticLayout$Builder;
move-result-object p1
.line 17
invoke-virtual {p1, v4, v8}, Landroid/text/StaticLayout$Builder;->setLineSpacing(FF)Landroid/text/StaticLayout$Builder;
move-result-object p1
iget-boolean p2, p0, Lcom/facebook/react/views/text/ReactBaseTextShadowNode;->mIncludeFontPadding:Z
.line 18
invoke-virtual {p1, p2}, Landroid/text/StaticLayout$Builder;->setIncludePad(Z)Landroid/text/StaticLayout$Builder;
move-result-object p1
iget p2, p0, Lcom/facebook/react/views/text/ReactBaseTextShadowNode;->mTextBreakStrategy:I
.line 19
invoke-virtual {p1, p2}, Landroid/text/StaticLayout$Builder;->setBreakStrategy(I)Landroid/text/StaticLayout$Builder;
move-result-object p1
iget p2, p0, Lcom/facebook/react/views/text/ReactBaseTextShadowNode;->mHyphenationFrequency:I
.line 20
invoke-virtual {p1, p2}, Landroid/text/StaticLayout$Builder;->setHyphenationFrequency(I)Landroid/text/StaticLayout$Builder;
move-result-object p1
const/16 p2, 0x1a
if-lt p3, p2, :cond_9b
.line 21
iget p2, p0, Lcom/facebook/react/views/text/ReactBaseTextShadowNode;->mJustificationMode:I
invoke-virtual {p1, p2}, Landroid/text/StaticLayout$Builder;->setJustificationMode(I)Landroid/text/StaticLayout$Builder;
:cond_9b
if-lt p3, v1, :cond_a0
.line 22
invoke-virtual {p1, v5}, Landroid/text/StaticLayout$Builder;->setUseLineSpacingFromFallbacks(Z)Landroid/text/StaticLayout$Builder;
.line 23
:cond_a0
invoke-virtual {p1}, Landroid/text/StaticLayout$Builder;->build()Landroid/text/StaticLayout;
move-result-object p3
goto :goto_101
:cond_a5
if-eqz v6, :cond_c1
if-nez p3, :cond_b0
.line 24
iget p3, v6, Landroid/text/BoringLayout$Metrics;->width:I
int-to-float p3, p3
cmpg-float p3, p3, p2
if-gtz p3, :cond_c1
.line 25
:cond_b0
iget p2, v6, Landroid/text/BoringLayout$Metrics;->width:I
const/high16 v4, 0x3f800000 # 1.0f
const/4 v5, 0x0
iget-boolean p3, p0, Lcom/facebook/react/views/text/ReactBaseTextShadowNode;->mIncludeFontPadding:Z
move-object v0, p1
move-object v1, v2
move v2, p2
move-object v3, v7
move v7, p3
.line 26
invoke-static/range {v0 .. v7}, Landroid/text/BoringLayout;->make(Ljava/lang/CharSequence;Landroid/text/TextPaint;ILandroid/text/Layout$Alignment;FFLandroid/text/BoringLayout$Metrics;Z)Landroid/text/BoringLayout;
move-result-object p3
goto :goto_101
.line 27
:cond_c1
sget p3, Landroid/os/Build$VERSION;->SDK_INT:I
if-ge p3, v9, :cond_d5
.line 28
new-instance p3, Landroid/text/StaticLayout;
float-to-int v3, p2
const/high16 v5, 0x3f800000 # 1.0f
const/4 v6, 0x0
iget-boolean p2, p0, Lcom/facebook/react/views/text/ReactBaseTextShadowNode;->mIncludeFontPadding:Z
move-object v0, p3
move-object v1, p1
move-object v4, v7
move v7, p2
invoke-direct/range {v0 .. v7}, Landroid/text/StaticLayout;-><init>(Ljava/lang/CharSequence;Landroid/text/TextPaint;ILandroid/text/Layout$Alignment;FFZ)V
goto :goto_101
.line 29
:cond_d5
invoke-interface {p1}, Ljava/lang/CharSequence;->length()I
move-result v0
float-to-int p2, p2
invoke-static {p1, v3, v0, v2, p2}, Landroid/text/StaticLayout$Builder;->obtain(Ljava/lang/CharSequence;IILandroid/text/TextPaint;I)Landroid/text/StaticLayout$Builder;
move-result-object p1
.line 30
invoke-virtual {p1, v7}, Landroid/text/StaticLayout$Builder;->setAlignment(Landroid/text/Layout$Alignment;)Landroid/text/StaticLayout$Builder;
move-result-object p1
.line 31
invoke-virtual {p1, v4, v8}, Landroid/text/StaticLayout$Builder;->setLineSpacing(FF)Landroid/text/StaticLayout$Builder;
move-result-object p1
iget-boolean p2, p0, Lcom/facebook/react/views/text/ReactBaseTextShadowNode;->mIncludeFontPadding:Z
.line 32
invoke-virtual {p1, p2}, Landroid/text/StaticLayout$Builder;->setIncludePad(Z)Landroid/text/StaticLayout$Builder;
move-result-object p1
iget p2, p0, Lcom/facebook/react/views/text/ReactBaseTextShadowNode;->mTextBreakStrategy:I
.line 33
invoke-virtual {p1, p2}, Landroid/text/StaticLayout$Builder;->setBreakStrategy(I)Landroid/text/StaticLayout$Builder;
move-result-object p1
iget p2, p0, Lcom/facebook/react/views/text/ReactBaseTextShadowNode;->mHyphenationFrequency:I
.line 34
invoke-virtual {p1, p2}, Landroid/text/StaticLayout$Builder;->setHyphenationFrequency(I)Landroid/text/StaticLayout$Builder;
move-result-object p1
if-lt p3, v1, :cond_fd
.line 35
invoke-virtual {p1, v5}, Landroid/text/StaticLayout$Builder;->setUseLineSpacingFromFallbacks(Z)Landroid/text/StaticLayout$Builder;
.line 36
:cond_fd
invoke-virtual {p1}, Landroid/text/StaticLayout$Builder;->build()Landroid/text/StaticLayout;
move-result-object p3
:goto_101
return-object p3
.end method
# virtual methods
.method public calculateLayoutOnChildren()Ljava/lang/Iterable;
.registers 7
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Ljava/lang/Iterable<",
"+",
"Lcom/facebook/react/uimanager/ReactShadowNode;",
">;"
}
.end annotation
.line 1
iget-object v0, p0, Lcom/facebook/react/views/text/ReactBaseTextShadowNode;->mInlineViews:Ljava/util/Map;
if-eqz v0, :cond_47
invoke-interface {v0}, Ljava/util/Map;->isEmpty()Z
move-result v0
if-eqz v0, :cond_b
goto :goto_47
.line 2
:cond_b
iget-object v0, p0, Lcom/facebook/react/views/text/ReactTextShadowNode;->mPreparedSpannableText:Landroid/text/Spannable;
const-string v1, "Spannable element has not been prepared in onBeforeLayout"
.line 3
invoke-static {v0, v1}, Lcom/facebook/infer/annotation/Assertions;->assertNotNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/text/Spanned;
.line 4
invoke-interface {v0}, Ljava/lang/CharSequence;->length()I
move-result v1
const-class v2, Lcom/facebook/react/views/text/TextInlineViewPlaceholderSpan;
const/4 v3, 0x0
invoke-interface {v0, v3, v1, v2}, Landroid/text/Spanned;->getSpans(IILjava/lang/Class;)[Ljava/lang/Object;
move-result-object v0
check-cast v0, [Lcom/facebook/react/views/text/TextInlineViewPlaceholderSpan;
.line 5
new-instance v1, Ljava/util/ArrayList;
array-length v2, v0
invoke-direct {v1, v2}, Ljava/util/ArrayList;-><init>(I)V
.line 6
array-length v2, v0
:goto_29
if-ge v3, v2, :cond_46
aget-object v4, v0, v3
.line 7
iget-object v5, p0, Lcom/facebook/react/views/text/ReactBaseTextShadowNode;->mInlineViews:Ljava/util/Map;
invoke-virtual {v4}, Lcom/facebook/react/views/text/TextInlineViewPlaceholderSpan;->getReactTag()I
move-result v4
invoke-static {v4}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v4
invoke-interface {v5, v4}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v4
check-cast v4, Lcom/facebook/react/uimanager/ReactShadowNode;
.line 8
invoke-interface {v4}, Lcom/facebook/react/uimanager/ReactShadowNode;->calculateLayout()V
.line 9
invoke-virtual {v1, v4}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
add-int/lit8 v3, v3, 0x1
goto :goto_29
:cond_46
return-object v1
:cond_47
:goto_47
const/4 v0, 0x0
return-object v0
.end method
.method public hoistNativeChildren()Z
.registers 2
const/4 v0, 0x1
return v0
.end method
.method public isVirtualAnchor()Z
.registers 2
const/4 v0, 0x0
return v0
.end method
.method public markUpdated()V
.registers 1
.line 1
invoke-super {p0}, Lcom/facebook/react/uimanager/ReactShadowNodeImpl;->markUpdated()V
.line 2
invoke-super {p0}, Lcom/facebook/react/uimanager/ReactShadowNodeImpl;->dirty()V
return-void
.end method
.method public onBeforeLayout(Lcom/facebook/react/uimanager/NativeViewHierarchyOptimizer;)V
.registers 4
const/4 v0, 0x0
const/4 v1, 0x1
.line 1
invoke-virtual {p0, p0, v0, v1, p1}, Lcom/facebook/react/views/text/ReactBaseTextShadowNode;->spannedFromShadowNode(Lcom/facebook/react/views/text/ReactBaseTextShadowNode;Ljava/lang/String;ZLcom/facebook/react/uimanager/NativeViewHierarchyOptimizer;)Landroid/text/Spannable;
move-result-object p1
iput-object p1, p0, Lcom/facebook/react/views/text/ReactTextShadowNode;->mPreparedSpannableText:Landroid/text/Spannable;
.line 2
invoke-virtual {p0}, Lcom/facebook/react/views/text/ReactTextShadowNode;->markUpdated()V
return-void
.end method
.method public onCollectExtraUpdates(Lcom/facebook/react/uimanager/UIViewOperationQueue;)V
.registers 14
.line 1
invoke-super {p0, p1}, Lcom/facebook/react/uimanager/ReactShadowNodeImpl;->onCollectExtraUpdates(Lcom/facebook/react/uimanager/UIViewOperationQueue;)V
.line 2
iget-object v1, p0, Lcom/facebook/react/views/text/ReactTextShadowNode;->mPreparedSpannableText:Landroid/text/Spannable;
if-eqz v1, :cond_33
.line 3
new-instance v11, Lcom/facebook/react/views/text/ReactTextUpdate;
const/4 v2, -0x1
iget-boolean v3, p0, Lcom/facebook/react/views/text/ReactBaseTextShadowNode;->mContainsImages:Z
const/4 v0, 0x4
.line 4
invoke-virtual {p0, v0}, Lcom/facebook/react/uimanager/ReactShadowNodeImpl;->getPadding(I)F
move-result v4
const/4 v0, 0x1
.line 5
invoke-virtual {p0, v0}, Lcom/facebook/react/uimanager/ReactShadowNodeImpl;->getPadding(I)F
move-result v5
const/4 v0, 0x5
.line 6
invoke-virtual {p0, v0}, Lcom/facebook/react/uimanager/ReactShadowNodeImpl;->getPadding(I)F
move-result v6
const/4 v0, 0x3
.line 7
invoke-virtual {p0, v0}, Lcom/facebook/react/uimanager/ReactShadowNodeImpl;->getPadding(I)F
move-result v7
.line 8
invoke-direct {p0}, Lcom/facebook/react/views/text/ReactTextShadowNode;->getTextAlign()I
move-result v8
iget v9, p0, Lcom/facebook/react/views/text/ReactBaseTextShadowNode;->mTextBreakStrategy:I
iget v10, p0, Lcom/facebook/react/views/text/ReactBaseTextShadowNode;->mJustificationMode:I
move-object v0, v11
invoke-direct/range {v0 .. v10}, Lcom/facebook/react/views/text/ReactTextUpdate;-><init>(Landroid/text/Spannable;IZFFFFIII)V
.line 9
invoke-virtual {p0}, Lcom/facebook/react/uimanager/ReactShadowNodeImpl;->getReactTag()I
move-result v0
invoke-virtual {p1, v0, v11}, Lcom/facebook/react/uimanager/UIViewOperationQueue;->enqueueUpdateExtraData(ILjava/lang/Object;)V
:cond_33
return-void
.end method
.method public setShouldNotifyOnTextLayout(Z)V
.registers 2
.annotation runtime Lcom/facebook/react/uimanager/annotations/ReactProp;
name = "onTextLayout"
.end annotation
iput-boolean p1, p0, Lcom/facebook/react/views/text/ReactTextShadowNode;->mShouldNotifyOnTextLayout:Z
return-void
.end method