LayoutTests:
authoradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Nov 2006 04:29:00 +0000 (04:29 +0000)
committeradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Nov 2006 04:29:00 +0000 (04:29 +0000)
        Reviewed by Anders.

        Test for http://bugs.webkit.org/show_bug.cgi?id=9581
        REGRESSION: The new NativeTextArea scrolls to the top when the control is unfocused.

        * fast/forms/textarea-no-scroll-on-blur-expected.txt: Added.
        * fast/forms/textarea-no-scroll-on-blur.html: Added.

WebCore:

        Reviewed by Anders.

        - Fix for http://bugs.webkit.org/show_bug.cgi?id=9581
        REGRESSION: The new NativeTextArea scrolls to the top when the control is unfocused.

        Test: fast/forms/textarea-no-scroll-on-blur.html

        * rendering/RenderTextControl.cpp: (WebCore::RenderTextControl::forwardEvent):
          On blur, only scroll back to the start for text fields.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@17560 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/forms/textarea-no-scroll-on-blur-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/textarea-no-scroll-on-blur.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderTextControl.cpp

index f9f745f4694dceb64a4bb67cb38b8a0b4371c481..02495e2e988986991b67dbdc60fcafb099c6f1b6 100644 (file)
@@ -1,3 +1,13 @@
+2006-11-02  Adele Peterson  <adele@apple.com>
+
+        Reviewed by Anders.
+
+        Test for http://bugs.webkit.org/show_bug.cgi?id=9581
+        REGRESSION: The new NativeTextArea scrolls to the top when the control is unfocused.
+
+        * fast/forms/textarea-no-scroll-on-blur-expected.txt: Added.
+        * fast/forms/textarea-no-scroll-on-blur.html: Added.
+
 2006-11-02  W. Andy Carrel  <wac@google.com>
 
         Reviewed by Maciej, landed by Anders.
 2006-11-02  W. Andy Carrel  <wac@google.com>
 
         Reviewed by Maciej, landed by Anders.
diff --git a/LayoutTests/fast/forms/textarea-no-scroll-on-blur-expected.txt b/LayoutTests/fast/forms/textarea-no-scroll-on-blur-expected.txt
new file mode 100644 (file)
index 0000000..e684ef8
--- /dev/null
@@ -0,0 +1,6 @@
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+This tests that we don't scroll back to the top when leaving a textarea 
+
+Test Passed
+
diff --git a/LayoutTests/fast/forms/textarea-no-scroll-on-blur.html b/LayoutTests/fast/forms/textarea-no-scroll-on-blur.html
new file mode 100644 (file)
index 0000000..97cb405
--- /dev/null
@@ -0,0 +1,28 @@
+<html>
+<head>
+<script>
+    function test() {
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+            
+        var ta = document.getElementById('ta');
+        ta.focus();
+        ta.blur();
+        if (ta.scrollTop != 0)
+            document.getElementById('res').innerHTML = "Test Passed";
+    }
+</script>
+</head>
+<body onload="test()">
+This tests that we don't scroll back to the top when leaving a textarea
+<br>
+<textarea id="ta">
+1
+2
+3
+4
+5
+</textarea>
+<div id="res">Test Failed</div>
+</body>
+</html>
index 9614174cf6a9785a456affbef97276663c9dc839..9863556fb539355c2486a15d41237b41b8e1b042 100644 (file)
@@ -1,3 +1,15 @@
+2006-11-02  Adele Peterson  <adele@apple.com>
+
+        Reviewed by Anders.
+
+        - Fix for http://bugs.webkit.org/show_bug.cgi?id=9581
+        REGRESSION: The new NativeTextArea scrolls to the top when the control is unfocused.
+
+        Test: fast/forms/textarea-no-scroll-on-blur.html
+
+        * rendering/RenderTextControl.cpp: (WebCore::RenderTextControl::forwardEvent):
+          On blur, only scroll back to the start for text fields.
+
 2006-11-02  Anders Carlsson  <acarlsson@apple.com>
 
         Another build fix.
 2006-11-02  Anders Carlsson  <acarlsson@apple.com>
 
         Another build fix.
index a43b1ef3ffa7f20dd2fbb0069fb5ebd122bb0779..7e27f42dc393c16a019851991c2ad868e7f4d133 100644 (file)
@@ -423,7 +423,7 @@ void RenderTextControl::forwardEvent(Event* evt)
         RenderObject* innerRenderer = m_div->renderer();
         if (innerRenderer) {
             RenderLayer* innerLayer = innerRenderer->layer();
         RenderObject* innerRenderer = m_div->renderer();
         if (innerRenderer) {
             RenderLayer* innerLayer = innerRenderer->layer();
-            if (innerLayer)
+            if (innerLayer && !m_multiLine)
                 innerLayer->scrollToOffset(style()->direction() == RTL ? innerLayer->scrollWidth() : 0, 0);
         }
     } else
                 innerLayer->scrollToOffset(style()->direction() == RTL ? innerLayer->scrollWidth() : 0, 0);
         }
     } else