package o;

import android.graphics.Canvas;
import android.graphics.Paint;
import android.text.style.ReplacementSpan;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class YW extends ReplacementSpan {
    public Paint.FontMetricsInt l;
    public int m;
    public int n;

    /* renamed from: o, reason: collision with root package name */
    public boolean f423o;

    public final int a() {
        if (!this.f423o) {
            AbstractC2228qH.b("PlaceholderSpan is not laid out yet.");
        }
        return this.n;
    }

    @Override // android.text.style.ReplacementSpan
    public final int getSize(Paint paint, CharSequence charSequence, int i, int i2, Paint.FontMetricsInt fontMetricsInt) {
        this.f423o = true;
        paint.getTextSize();
        Paint.FontMetricsInt fontMetricsInt2 = paint.getFontMetricsInt();
        this.l = fontMetricsInt2;
        int i3 = (fontMetricsInt2 != null ? fontMetricsInt2 : null).descent;
        if (fontMetricsInt2 == null) {
            fontMetricsInt2 = null;
        }
        if (i3 <= fontMetricsInt2.ascent) {
            AbstractC2228qH.a("Invalid fontMetrics: line height can not be negative.");
        }
        this.m = (int) Math.ceil(0.0f);
        this.n = (int) Math.ceil(0.0f);
        if (fontMetricsInt != null) {
            Paint.FontMetricsInt fontMetricsInt3 = this.l;
            int i4 = (fontMetricsInt3 != null ? fontMetricsInt3 : null).ascent;
            fontMetricsInt.ascent = i4;
            fontMetricsInt.descent = (fontMetricsInt3 != null ? fontMetricsInt3 : null).descent;
            if (fontMetricsInt3 == null) {
                fontMetricsInt3 = null;
            }
            fontMetricsInt.leading = fontMetricsInt3.leading;
            if (i4 > (-a())) {
                fontMetricsInt.ascent = -a();
            }
            Paint.FontMetricsInt fontMetricsInt4 = this.l;
            if (fontMetricsInt4 == null) {
                fontMetricsInt4 = null;
            }
            fontMetricsInt.top = Math.min(fontMetricsInt4.top, fontMetricsInt.ascent);
            Paint.FontMetricsInt fontMetricsInt5 = this.l;
            fontMetricsInt.bottom = Math.max((fontMetricsInt5 != null ? fontMetricsInt5 : null).bottom, fontMetricsInt.descent);
        }
        if (!this.f423o) {
            AbstractC2228qH.b("PlaceholderSpan is not laid out yet.");
        }
        return this.m;
    }

    @Override // android.text.style.ReplacementSpan
    public final void draw(Canvas canvas, CharSequence charSequence, int i, int i2, float f, int i3, int i4, int i5, Paint paint) {
    }
}
