[Webkit-unassigned] [Bug 49334] Implement Default Ruby Overhang Behavior

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jan 6 15:21:44 PST 2011


https://bugs.webkit.org/show_bug.cgi?id=49334





--- Comment #7 from Eric Mader <emader at apple.com>  2011-01-06 15:21:43 PST ---
Here's an updated version of RenderRubyRun::getOverhangMargins that checks font size:


void RenderRubyRun::getOverhangMargins(RenderObject* last, RenderObject* next, int& beforeMargin, int& afterMargin)
{
    RenderRubyText* text = rubyText();
    RenderRubyBase* base = rubyBase();
    int rubyLength = text? text->maxPreferredLogicalWidth() : 0;
    int baseLength = base? base->maxPreferredLogicalWidth() : 0;
    int baseFontSize = base? base->style()->fontSize() : 0;

    beforeMargin = afterMargin = 0;

    if (baseLength < rubyLength) {
        bool canOverhangLast = last && last->isText() && last->style()->fontSize() <= baseFontSize;
        bool canOverhangNext = next && next->isText() && next->style()->fontSize() <= baseFontSize;
        int overhang = rubyLength - baseLength;

        if (canOverhangLast)
            beforeMargin = - ((overhang + 1) / 2);

        if (canOverhangNext)
            afterMargin = - (overhang / 2);
    }
}

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list