[Webkit-unassigned] [Bug 25319] caret does not paint after type in characters in right aligned div or after delete all characters in RTL div or 0px right padding RTL textarea

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Apr 16 17:52:46 PDT 2010


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





--- Comment #22 from Xiaomei Ji <xji at chromium.org>  2010-04-16 17:52:45 PST ---
(In reply to comment #21)
> I think using cb->x() here is wrong. See bug 33503. 

Hi Mitz,
Thanks for the quick review.

In the previous logic, when the style is autoWrap, the left position of caret
is computed using the InlineTextBox's direction. For the test case in
caret-rtl-2.html, the textBox is RTL, and the computation falls in:
left = max(left, cb-x());

I changed the logic to use containing block's alignment (same as no-wrap case).
The test case's containing block is LTR, and the computation falls in:
left = min(left, cb->x() + cb->width() - caretWidthRightOffset);
left = max(left, rootleft);

I tried caret-rtl-2.html, the patch will place the cursor at the very left of
the rtl text, which is the "Bad" scenario you refer.

>This condition looks
> suspicious because of its asymmetry:
> (cbStyle->direction() == RTL || cbStyle->textAlign() == RIGHT ||
> cbStyle->textAlign() == WEBKIT_RIGHT)
> it is not immediately clear why left-aligned RTL-text should fall into this
> case.

Yes, you are right.
I think it should be changed to the same logic of computing alignment in
RenderBlock::localCaretRect():

    switch (currentStyle->textAlign()) {
        case TAAUTO:
        case JUSTIFY:
            if (currentStyle->direction() == RTL)
                alignment = alignRight;
            break;
        case LEFT:
        case WEBKIT_LEFT:
            break;
        case CENTER:
        case WEBKIT_CENTER:
            alignment = alignCenter;
            break;
        case RIGHT:
        case WEBKIT_RIGHT:
            alignment = alignRight;
            break;
    }

-- 
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