Changeset 58191 in webkit


Ignore:
Timestamp:
Apr 23, 2010 3:07:46 PM (14 years ago)
Author:
xji@chromium.org
Message:

2010-04-23 Xiaomei Ji <xji@chromium.org>

Reviewed by Dan Bernstein and Darin Adler

Fix issue "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"
https://bugs.webkit.org/show_bug.cgi?id=25319

Test: editing/inserting/caret-position.html

  • rendering/RenderText.cpp: (WebCore::RenderText::localCaretRect):

2010-04-23 Xiaomei Ji <xji@chromium.org>

Reviewed by Dan Bernstein and Darin Adler

Fix issue "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"
https://bugs.webkit.org/show_bug.cgi?id=25319

  • editing/inserting/caret-position-expected.txt: Added.
  • editing/inserting/caret-position.html: Added.
  • platform/mac/editing/input/caret-primary-bidi-expected.txt:
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r58187 r58191  
     12010-04-23  Xiaomei Ji  <xji@chromium.org>
     2
     3        Reviewed by Dan Bernstein and Darin Adler
     4
     5        Fix issue "caret does not paint after type in characters in right
     6        aligned div or after delete all characters in RTL div or
     7        0px right padding RTL textarea"
     8        https://bugs.webkit.org/show_bug.cgi?id=25319
     9
     10        * editing/inserting/caret-position-expected.txt: Added.
     11        * editing/inserting/caret-position.html: Added.
     12        * platform/mac/editing/input/caret-primary-bidi-expected.txt:
     13
    1142010-04-23  MORITA Hajime  <morrita@google.com>
    215
  • trunk/LayoutTests/platform/mac/editing/input/caret-primary-bidi-expected.txt

    r32508 r58191  
    424241: 97,478,0,28
    434342: 126,478,0,28
    44 43: 792,450,0,28
     4443: 791,450,0,28
    454544: 764,450,0,28
    464645: 779,450,0,28
     
    585857: 618,450,0,28
    595958: 590,450,0,28
    60 59: 792,422,0,28
     6059: 791,422,0,28
    616160: 777,422,0,28
    626261: 763,422,0,28
     
    686867: 677,422,0,28
    696968: 669,422,0,28
    70 69: 792,394,0,28
     7069: 791,394,0,28
    717170: 777,394,0,28
    727271: 763,394,0,28
     
    757574: 643,394,0,28
    767675: 635,394,0,28
    77 76: 792,364,0,28
     7776: 791,364,0,28
    787877: 764,364,0,28
    797978: 779,364,0,28
  • trunk/WebCore/ChangeLog

    r58190 r58191  
     12010-04-23  Xiaomei Ji  <xji@chromium.org>
     2
     3        Reviewed by Dan Bernstein and Darin Adler
     4
     5        Fix issue "caret does not paint after type in characters in right
     6        aligned div or after delete all characters in RTL div or
     7        0px right padding RTL textarea"
     8        https://bugs.webkit.org/show_bug.cgi?id=25319
     9
     10        Test: editing/inserting/caret-position.html
     11
     12        * rendering/RenderText.cpp:
     13        (WebCore::RenderText::localCaretRect):
     14
    1152010-04-23  No'am Rosenthal  <noam.rosenthal@nokia.com>
    216
  • trunk/WebCore/rendering/RenderText.cpp

    r57940 r58191  
    456456
    457457    RenderBlock* cb = containingBlock();
     458    RenderStyle* cbStyle = cb->style();
     459    int leftEdge;
     460    int rightEdge;
    458461    if (style()->autoWrap()) {
    459         int availableWidth = cb->lineWidth(top, false);
    460         if (box->direction() == LTR)
    461             left = min(left, rootLeft + availableWidth - caretWidthRightOfOffset);
    462         else
    463             left = max(left, cb->x());
     462        leftEdge = cb->x();
     463        rightEdge = cb->frameRect().right();
    464464    } else {
    465         // If there is no wrapping, the caret can leave its containing block, but not its root line box.
    466         if (cb->style()->direction() == LTR) {
    467             int rightEdge = max(cb->width(), rootRight);
    468             left = min(left, rightEdge - caretWidthRightOfOffset);
    469             left = max(left, rootLeft);
    470         } else {
    471             int leftEdge = min(cb->x(), rootLeft);
    472             left = max(left, leftEdge);
    473             left = min(left, rootRight - caretWidth);
    474         }
     465        leftEdge = min(cb->x(), rootLeft);
     466        rightEdge = max(cb->frameRect().right(), rootRight);
     467    }
     468
     469    bool rightAligned = false;
     470    switch (cbStyle->textAlign()) {
     471    case TAAUTO:
     472    case JUSTIFY:
     473        rightAligned = cbStyle->direction() == RTL;
     474        break;
     475    case RIGHT:
     476    case WEBKIT_RIGHT:
     477        rightAligned = true;
     478        break;
     479    case LEFT:
     480    case WEBKIT_LEFT:
     481    case CENTER:
     482    case WEBKIT_CENTER:
     483        break;
     484    }
     485
     486    if (rightAligned) {
     487        left = max(left, leftEdge);
     488        left = min(left, rootRight - caretWidth);
     489    } else {
     490        left = min(left, rightEdge - caretWidthRightOfOffset);
     491        left = max(left, rootLeft);
    475492    }
    476493
Note: See TracChangeset for help on using the changeset viewer.