WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
56061
selectionStart reports wrong caret position when the last characters are newlines
https://bugs.webkit.org/show_bug.cgi?id=56061
Summary
selectionStart reports wrong caret position when the last characters are newl...
Ryosuke Niwa
Reported
2011-03-09 16:33:36 PST
http://crbug.com/56971
What steps will reproduce the problem? 1. Put some newlines in an empty textarea. 2. Read its selectionStart property via Javascript. What is the expected result? It should return the a number equal to the number of newlines. What happens instead? It always returns 1. It may be a bug in Webkit, since Safari fails too. I did a reduction that shows the problem very easily:
http://martinml.com/textarea.html
This is especially annoying in a phpBB forum editor, since if you want to put some newlines and then click the button to insert a bbcode tag, it's inserted just after the last text, and not after the newlines.
Attachments
demo
(1.27 KB, text/html)
2011-03-09 17:02 PST
,
Ryosuke Niwa
no flags
Details
fixes the bug
(3.60 KB, patch)
2011-03-09 17:15 PST
,
Ryosuke Niwa
tkent
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Ryosuke Niwa
Comment 1
2011-03-09 17:02:58 PST
Created
attachment 85260
[details]
demo This is a failed attempt to write a layout out for this bug. It seems like the bug can be reproduced only if we ran it manually.
Ryosuke Niwa
Comment 2
2011-03-09 17:15:11 PST
Created
attachment 85262
[details]
fixes the bug
Kent Tamura
Comment 3
2011-03-09 17:24:41 PST
Comment on
attachment 85262
[details]
fixes the bug View in context:
https://bugs.webkit.org/attachment.cgi?id=85262&action=review
> Source/WebCore/editing/SelectionController.cpp:171 > + // See
https://bugs.webkit.org/show_bug.cgi?id=56061
nit: I feel the bug entry doesn't have additional information and ChangeLog is enough.
Ryosuke Niwa
Comment 4
2011-03-09 17:34:31 PST
(In reply to
comment #3
)
> (From update of
attachment 85262
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=85262&action=review
> > > Source/WebCore/editing/SelectionController.cpp:171 > > + // See
https://bugs.webkit.org/show_bug.cgi?id=56061
> > nit: I feel the bug entry doesn't have additional information and ChangeLog is enough.
Ok. Do you think I can also get rid of the line above where I say "// Even if selection was not changed, selection offset may have been changed." ?
Kent Tamura
Comment 5
2011-03-09 17:36:17 PST
(In reply to
comment #4
)
> Do you think I can also get rid of the line above where I say "// Even if selection was not changed, selection offset may have been changed." ?
No. This line looks helpful.
Ryosuke Niwa
Comment 6
2011-03-09 17:43:57 PST
(In reply to
comment #5
)
> (In reply to
comment #4
) > > Do you think I can also get rid of the line above where I say "// Even if selection was not changed, selection offset may have been changed." ? > > No. This line looks helpful.
Ok. Thanks for the review. Landing it now.
Ryosuke Niwa
Comment 7
2011-03-09 17:46:58 PST
Committed
r80679
: <
http://trac.webkit.org/changeset/80679
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug