WebCore:
2008-12-13 Darin Adler <darin@apple.com>
Reviewed by Dan Bernstein.
- fix https://bugs.webkit.org/show_bug.cgi?id=18734
REGRESSION (r31081): Focus problems in Gmail 2/Plain text message text
<rdar://problem/5892415>
Test: fast/forms/textarea-selection-preservation.html
The regression reported was caused by the fact that the renderer code had
a bug where it would constantly think the newline at the end of text was
missing, and so it would replace all the text even though it wasn't changing,
which would destroy the selection.
When writing the regression test I discovered another problem: The value
property in HTMLTextAreaElement was intentionally changing the selection
to the end of the textarea, but doing that even when the value wasn't changing.
This patch fixes both and the test checks both.
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::setValue): Exit early if the value is
not changing.
* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::text): Add a newline character for each <br>
element encountered in the control
LayoutTests:
2008-12-13 Darin Adler <darin@apple.com>
Reviewed by Dan Bernstein.
- test for https://bugs.webkit.org/show_bug.cgi?id=18734
REGRESSION (r31081): Focus problems in Gmail 2/Plain text message text
<rdar://problem/5892415>
* fast/forms/textarea-selection-preservation-expected.txt: Added.
* fast/forms/textarea-selection-preservation.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@39281 268f45cc-cd09-0410-ab3c-d52691b4dbfc
6 files changed