WebCore:
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 Dec 2008 23:02:11 +0000 (23:02 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 Dec 2008 23:02:11 +0000 (23:02 +0000)
commit9fc14ee0fb94a71b48aa038085654b7a3652f361
tree062e3911f43cd7f5b94bde6c9b46fba1cff70d42
parenta567bec55027d04f70314fa7c2f5de993338017d
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: https://svn.webkit.org/repository/webkit/trunk@39281 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/forms/textarea-selection-preservation-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/textarea-selection-preservation.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/html/HTMLTextAreaElement.cpp
WebCore/rendering/RenderTextControl.cpp