paintMargin(c, line, ib, padX, rightMargin, background_color); padX += rightMargin;
paintMargin(c, line, ib, padX, ib.margin.right, background_color); padX += ib.margin.right;
    static void paintInline(Context c, InlineBox ib, int lx, int ly, LineBox line, boolean restyle, LinkedList pushedStyles) {        restyle = restyle || ib.restyle;//cascade it down        ib.restyle = false;//reset        int padX = 0;        if (ib.pushstyles != null) {            for (Iterator i = ib.pushstyles.iterator(); i.hasNext();) {                Color background_color = BoxRendering.getBackgroundColor(c);                StylePush sp = (StylePush) i.next();                CascadedStyle style = c.getCss().getCascadedStyle(sp.getElement(), restyle);                c.pushStyle(style);                if (pushedStyles != null) pushedStyles.addLast(style);                //Now we know that an inline element started here, handle borders and such?                Relative.translateRelative(c);                //left padding for this inline element                int padWidth = ib.totalLeftPadding(c.getCurrentStyle(), c);                paintMargin(c, line, ib, padX, ib.margin.left, background_color);                //paintLeftPadding takes the margin into account                paintLeftPadding(c, line, ib, padX, padWidth);                padX += padWidth;            }        }        if (ib.floated) {            paintFloat(c, ib, restyle);            debugInlines(c, ib, lx, ly);        } // Uu.p("paintInline: " + inline);        else if (ib instanceof InlineBlockBox) {            c.pushStyle(c.getCss().getCascadedStyle(ib.element, restyle));            c.translate(line.x,                    line.y +                    (line.getBaseline() -                    VerticalAlign.getBaselineOffset(c, line, ib) -                    ib.height));            BoxRendering.paint(c, ib, true, restyle);            c.translate(-line.x,                    -(line.y +                    (line.getBaseline() -                    VerticalAlign.getBaselineOffset(c, line, ib) -                    ib.height)));            debugInlines(c, ib, lx, ly);            c.popStyle();        } else {            InlineTextBox inline = (InlineTextBox) ib;            c.updateSelection(inline);            // calculate the Xx and y relative to the baseline of the line (ly) and the            // left edge of the line (lx)            int iy = ly - VerticalAlign.getBaselineOffset(c, line, inline);            int ix = lx + inline.x;//TODO: find the right way to work this out            // account for padding            // Uu.p("adjusted inline by: " + inline.totalLeftPadding());            // Uu.p("inline = " + inline);            // Uu.p("padding = " + inline.padding);            // JMM: new adjustments to move the text to account for horizontal insets            //int padding_xoff = inline.totalLeftPadding(c.getCurrentStyle());            c.translate(padX, 0);            LineMetrics lm = FontUtil.getLineMetrics(c, inline);            paintBackground(c, line, inline, padX, lm);            paintSelection(c, inline, lx, ly, lm);            paintText(c, ix, iy, inline, lm);            c.translate(-padX, 0);            debugInlines(c, inline, lx, ly);        }        padX = ib.width - ib.rightPadding;        if (ib.popstyles != 0) {            for (int i = 0; i < ib.popstyles; i++) {                //right padding for this inline element                paintRightPadding(c, line, ib, padX);                padX += ib.totalRightPadding() - ib.margin.right;                int rightMargin = ib.margin.right;                Relative.untranslateRelative(c);                c.popStyle();                if (pushedStyles != null) pushedStyles.removeLast();                Color background_color = BoxRendering.getBackgroundColor(c);                paintMargin(c, line, ib, padX, rightMargin, background_color);                padX += rightMargin;            }        }    }