WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
patch w/ layout test
caret.v1 (text/plain), 10.46 KB, created by
Xiaomei Ji
on 2009-06-02 18:00:29 PDT
(
hide
)
Description:
patch w/ layout test
Filename:
MIME Type:
Creator:
Xiaomei Ji
Created:
2009-06-02 18:00:29 PDT
Size:
10.46 KB
patch
obsolete
>Index: WebCore/ChangeLog >=================================================================== >--- WebCore/ChangeLog (revision 44375) >+++ WebCore/ChangeLog (working copy) >@@ -1,3 +1,22 @@ >+2009-06-02 Xiaomei Ji <xji@chromium.org> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Fix 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 >+ >+ Tests: editing/inserting/caret-right-align-after-insert.html >+ fast/forms/caret-rtl-div.html >+ >+ * rendering/RenderText.cpp: >+ (WebCore::RenderText::localCaretRect): Instead of distributing >+ caretWidth to either side of the offset, distribute the caret width to >+ the left side of the offset if the alignment is RIGHT and distribute it >+ to the right side otherwise. >+ >+ > 2009-06-02 Eric Seidel <eric@webkit.org> > > Reviewed by Maciej Stachowiak. >Index: WebCore/rendering/RenderText.cpp >=================================================================== >--- WebCore/rendering/RenderText.cpp (revision 44201) >+++ WebCore/rendering/RenderText.cpp (working copy) >@@ -392,8 +392,27 @@ IntRect RenderText::localCaretRect(Inlin > > int left = box->positionForOffset(caretOffset); > >- // Distribute the caret's width to either side of the offset. >- int caretWidthLeftOfOffset = caretWidth / 2; >+ int caretWidthLeftOfOffset = 0; >+ RenderStyle* currentStyle = firstLineStyle(); >+ ETextAlign alignment = currentStyle->textAlign(); >+ bool alignRight = false; >+ switch (alignment) { >+ case TAAUTO: >+ case JUSTIFY: >+ if (currentStyle->direction() == RTL) >+ alignRight = true; >+ break; >+ case RIGHT: >+ case WEBKIT_RIGHT: >+ alignRight = true; >+ break; >+ default: >+ break; >+ } >+ // Distribute the caretWidth to the left side of the offset if the alignment >+ // is RIGHT, otherwise, distribute it to the right side. >+ if (alignRight) >+ caretWidthLeftOfOffset = caretWidth; > left -= caretWidthLeftOfOffset; > int caretWidthRightOfOffset = caretWidth - caretWidthLeftOfOffset; > >Index: LayoutTests/ChangeLog >=================================================================== >--- LayoutTests/ChangeLog (revision 44375) >+++ LayoutTests/ChangeLog (working copy) >@@ -1,3 +1,19 @@ >+2009-06-02 Xiaomei Ji <set EMAIL_ADDRESS environment variable> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Fix 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-right-align-after-insert-expected.txt: Added. >+ * editing/inserting/caret-right-align-after-insert.html: Added. >+ * fast/forms/caret-rtl-div-expected.txt: Added. >+ * fast/forms/caret-rtl-div.html: Added. >+ * platform/mac/editing/input/caret-primary-bidi-expected.txt: >+ * platform/mac/editing/selection/move-left-right-expected.txt: >+ > 2009-06-02 Eric Seidel <eric@webkit.org> > > Reviewed by Maciej Stachowiak. >Index: LayoutTests/editing/inserting/caret-right-align-after-insert-expected.txt >=================================================================== >--- LayoutTests/editing/inserting/caret-right-align-after-insert-expected.txt (revision 0) >+++ LayoutTests/editing/inserting/caret-right-align-after-insert-expected.txt (revision 0) >@@ -0,0 +1,4 @@ >+This tests that adding a character in a contenteditable right aligned div will display the caret in the right edge of the div >+x >+199 >+Success >Index: LayoutTests/editing/inserting/caret-right-align-after-insert.html >=================================================================== >--- LayoutTests/editing/inserting/caret-right-align-after-insert.html (revision 0) >+++ LayoutTests/editing/inserting/caret-right-align-after-insert.html (revision 0) >@@ -0,0 +1,46 @@ >+<html> >+<head> >+<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script> >+<script> >+ >+function log(str) { >+ var li = document.createElement("li"); >+ li.appendChild(document.createTextNode(str)); >+ var console = document.getElementById("console"); >+ console.appendChild(li); >+} >+ >+function assert(bool) { >+ if (!bool) >+ log("Failure"); >+ else >+ log("Success"); >+} >+ >+function runTest() >+{ >+ if (window.layoutTestController) >+ layoutTestController.dumpAsText(); >+ var e = document.getElementById("test-right-align"); >+ e.focus(); >+ selectAllCommand(); >+ typeCharacterCommand(); >+ if (window.textInputController) { >+ var caretRect = textInputController.firstRectForCharacterRange(0, 0); >+ log(caretRect[0]); >+ assert(caretRect[0] == 199); >+ } >+} >+ >+</script> >+</head> >+<body> >+This tests that adding a character in a contenteditable right aligned div >+will display the caret in the right edge of the div >+<br> >+<div CONTENTEDITABLE id="test-right-align" style="text-align: right; width:200px;"; outline: solid thin; overflow: hidden></div> >+<ul id="console"></ul> >+</body> >+<script> runTest(); </script> >+</html> >+ >Index: LayoutTests/fast/forms/caret-rtl-div-expected.txt >=================================================================== >--- LayoutTests/fast/forms/caret-rtl-div-expected.txt (revision 0) >+++ LayoutTests/fast/forms/caret-rtl-div-expected.txt (revision 0) >@@ -0,0 +1,4 @@ >+This tests that the right-most position of the caret in a contenteditable RTL div is at the right edge of the div, not overflow from the div. >+a >+200 >+Success >Index: LayoutTests/fast/forms/caret-rtl-div.html >=================================================================== >--- LayoutTests/fast/forms/caret-rtl-div.html (revision 0) >+++ LayoutTests/fast/forms/caret-rtl-div.html (revision 0) >@@ -0,0 +1,43 @@ >+<html> >+<head> >+<script> >+ >+function log(str) { >+ var li = document.createElement("li"); >+ li.appendChild(document.createTextNode(str)); >+ var console = document.getElementById("console"); >+ console.appendChild(li); >+} >+ >+function assert(bool) { >+ if (!bool) >+ log("Failure"); >+ else >+ log("Success"); >+} >+ >+function runTest() >+{ >+ if (window.layoutTestController) >+ layoutTestController.dumpAsText(); >+ var e = document.getElementById("test"); >+ e.focus(); >+ if (window.textInputController) { >+ var caretRect = textInputController.firstRectForCharacterRange(1, 0); >+ log(caretRect[0]); >+ assert(caretRect[0] == 200); >+ } >+} >+ >+</script> >+</head> >+<body> >+This tests that the right-most position of the caret in a contenteditable RTL >+div is at the right edge of the div, not overflow from the div. >+<br> >+<div CONTENTEDITABLE id="test" style="direction: rtl; width:200px;" outline: solid thin; overflow: hidden>a</div> >+<ul id="console"></ul> >+</body> >+<script> runTest(); </script> >+</html> >+ >Index: LayoutTests/platform/mac/editing/input/caret-primary-bidi-expected.txt >=================================================================== >--- LayoutTests/platform/mac/editing/input/caret-primary-bidi-expected.txt (revision 44201) >+++ LayoutTests/platform/mac/editing/input/caret-primary-bidi-expected.txt (working copy) >@@ -41,47 +41,47 @@ > 40: 114,478,0,28 > 41: 97,478,0,28 > 42: 126,478,0,28 >-43: 792,450,0,28 >-44: 764,450,0,28 >-45: 779,450,0,28 >-46: 751,450,0,28 >-47: 736,450,0,28 >-48: 722,450,0,28 >-49: 711,450,0,28 >-50: 680,450,0,28 >-51: 695,450,0,28 >-52: 665,450,0,28 >-53: 653,450,0,28 >-54: 636,450,0,28 >-55: 628,450,0,28 >-56: 605,450,0,28 >-57: 618,450,0,28 >-58: 590,450,0,28 >-59: 792,422,0,28 >-60: 777,422,0,28 >-61: 763,422,0,28 >-62: 752,422,0,28 >-63: 721,422,0,28 >-64: 736,422,0,28 >-65: 706,422,0,28 >-66: 694,422,0,28 >-67: 677,422,0,28 >-68: 669,422,0,28 >-69: 792,394,0,28 >-70: 777,394,0,28 >-71: 763,394,0,28 >-72: 752,394,0,28 >-73: 660,394,0,28 >-74: 643,394,0,28 >-75: 635,394,0,28 >-76: 792,364,0,28 >-77: 764,364,0,28 >-78: 779,364,0,28 >-79: 751,364,0,28 >-80: 736,364,0,28 >-81: 722,364,0,28 >-82: 711,364,0,28 >-83: 688,364,0,28 >-84: 701,364,0,28 >-85: 673,364,0,28 >+43: 791,450,0,28 >+44: 763,450,0,28 >+45: 778,450,0,28 >+46: 750,450,0,28 >+47: 735,450,0,28 >+48: 721,450,0,28 >+49: 710,450,0,28 >+50: 679,450,0,28 >+51: 694,450,0,28 >+52: 664,450,0,28 >+53: 652,450,0,28 >+54: 635,450,0,28 >+55: 627,450,0,28 >+56: 604,450,0,28 >+57: 617,450,0,28 >+58: 589,450,0,28 >+59: 791,422,0,28 >+60: 776,422,0,28 >+61: 762,422,0,28 >+62: 751,422,0,28 >+63: 720,422,0,28 >+64: 735,422,0,28 >+65: 705,422,0,28 >+66: 693,422,0,28 >+67: 676,422,0,28 >+68: 668,422,0,28 >+69: 791,394,0,28 >+70: 776,394,0,28 >+71: 762,394,0,28 >+72: 751,394,0,28 >+73: 659,394,0,28 >+74: 642,394,0,28 >+75: 634,394,0,28 >+76: 791,364,0,28 >+77: 763,364,0,28 >+78: 778,364,0,28 >+79: 750,364,0,28 >+80: 735,364,0,28 >+81: 721,364,0,28 >+82: 710,364,0,28 >+83: 687,364,0,28 >+84: 700,364,0,28 >+85: 672,364,0,28 > >Index: LayoutTests/platform/mac/editing/selection/move-left-right-expected.txt >=================================================================== >--- LayoutTests/platform/mac/editing/selection/move-left-right-expected.txt (revision 44201) >+++ LayoutTests/platform/mac/editing/selection/move-left-right-expected.txt (working copy) >@@ -234,9 +234,9 @@ WARNING: Moved in the wrong direction in > WARNING: Moved in the wrong direction in step 4: from (0, 600) to (65, 569). > Test 39, RTL: > Moving left: "abc"[0, 2, 1, 3], "def"[0, 2, 1, 3] >-WARNING: Moved in the wrong direction in step 4: from (740, 569) to (0, 600). >+WARNING: Moved in the wrong direction in step 4: from (739, 569) to (0, 600). > Moving right: "def"[3, 1, 2, 0], "abc"[3, 1, 2, 0] >-WARNING: Moved in the wrong direction in step 4: from (0, 600) to (740, 569). >+WARNING: Moved in the wrong direction in step 4: from (0, 600) to (739, 569). > Test 40, LTR: > Moving right: "ABC"[0, 2, 1, 3], "DEF"[0, 2, 1, 3] > WARNING: Moved in the wrong direction in step 4: from (64, 569) to (0, 600). >@@ -244,7 +244,7 @@ WARNING: Moved in the wrong direction in > WARNING: Moved in the wrong direction in step 4: from (0, 600) to (64, 569). > Test 40, RTL: > Moving left: "ABC"[0, 1, 2, 3], "DEF"[0, 1, 2, 3] >-WARNING: Moved in the wrong direction in step 4: from (741, 569) to (0, 600). >+WARNING: Moved in the wrong direction in step 4: from (740, 569) to (0, 600). > Moving right: "DEF"[3, 2, 1, 0], "ABC"[3, 2, 1, 0] >-WARNING: Moved in the wrong direction in step 4: from (0, 600) to (741, 569). >+WARNING: Moved in the wrong direction in step 4: from (0, 600) to (740, 569). >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
eric
:
review-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 25319
:
29671
|
30583
|
30720
|
30887
|
53499
|
53685
|
54199
|
54202