Bug 8089

Summary: REGRESSION: Caret position is off in native text field with text-align:right
Product: WebKit Reporter: mitz
Component: FormsAssignee: Darin Adler <darin>
Severity: Normal Keywords: Regression
Priority: P1    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
URL: data:text/html,<input%20style="text-align:%20right;">
Description Flags
patch with detailed change log mjs: review+

Description mitz 2006-03-30 12:52:39 PST
In a new text field with text-align: right, the caret is positioned 1 pixel to the right of where it is supposed to be when the field is empty, and 1 pixel to the left when the field contains text (which is 2px to the left from the initial position).
Comment 1 Darin Adler 2006-04-01 13:39:38 PST
Looking at the behavior it seems that it's correct when there is text. I looked at it side by side with an LTR field and it seems to be fine.

So I'll try to fix the bug about where it is without the text.
Comment 2 Darin Adler 2006-04-01 13:46:07 PST
I assume the relevant function is RenderBox::caretRect.
Comment 3 Darin Adler 2006-04-01 14:36:43 PST
No, turns out it's RenderFlow::caretRect.
Comment 4 Darin Adler 2006-04-01 14:42:14 PST
The code wasn't taking into account the width of the caret itself. But once I added code to do that, we end up with what Mitz called the right result, which unfortunately is one pixel to the right of what we get once we start typing. Working on it.
Comment 5 Darin Adler 2006-04-01 14:59:09 PST
1px was the width of the caret, 1px was the padding.
Comment 6 Darin Adler 2006-04-01 15:16:20 PST
Created attachment 7449 [details]
patch with detailed change log
Comment 7 Maciej Stachowiak 2006-04-01 15:58:26 PST
Comment on attachment 7449 [details]
patch with detailed change log

Comment 8 mitz 2006-04-04 01:52:26 PDT
Verified in r13675 nightly.