Bug 8089 - REGRESSION: Caret position is off in native text field with text-align:right
Summary: REGRESSION: Caret position is off in native text field with text-align:right
Status: VERIFIED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 420+
Hardware: Macintosh OS X 10.4
: P1 Normal
Assignee: Darin Adler
URL: data:text/html,<input%20style="text-a...
Keywords: Regression
Depends on:
Blocks:
 
Reported: 2006-03-30 12:52 PST by mitz
Modified: 2006-04-04 01:52 PDT (History)
0 users

See Also:


Attachments
patch with detailed change log (7.33 KB, patch)
2006-04-01 15:16 PST, Darin Adler
mjs: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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

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