Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 850dffa0 authored by Fabrice Di Meglio's avatar Fabrice Di Meglio
Browse files

Follow up to TextView's baseline is correctly computed for empty text

Was bug http://code.google.com/p/android/issues/detail?id=15598

- optimize https://android-git.corp.google.com/g/#/c/107901/1

Change-Id: I20abd82a97adc71f04a5afba54eb679f708236f8
parent f2ce877c
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -706,9 +706,19 @@ class TextLine {
            Canvas c, float x, int top, int y, int bottom,
            FontMetricsInt fmi, boolean needWidth) {

        float ret = 0;
        // Get metrics first (even for empty strings or "0" width runs)
        if (fmi != null) {
            expandMetricsFromPaint(fmi, wp);
        }

        int runLen = end - start;
        // No need to do anything if the run width is "0"
        if (runLen == 0) {
            return 0f;
        }

        float ret = 0;

        int contextLen = contextEnd - contextStart;
        if (needWidth || (c != null && (wp.bgColor != 0 || runIsRtl))) {
            int flags = runIsRtl ? Paint.DIRECTION_RTL : Paint.DIRECTION_LTR;
@@ -723,10 +733,6 @@ class TextLine {
            }
        }

        if (fmi != null) {
            expandMetricsFromPaint(fmi, wp);
        }

        if (c != null) {
            if (runIsRtl) {
                x -= ret;