LayoutTests:
authoradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Jun 2007 18:15:40 +0000 (18:15 +0000)
committeradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Jun 2007 18:15:40 +0000 (18:15 +0000)
        Reviewed by Ada and Kevin McCullough.

        Test for <rdar://problem/5301322> REGRESSION: Select All selects the whole page when used in readonly textareas

        * fast/forms/input-readonly-select-all-expected.checksum: Added.
        * fast/forms/input-readonly-select-all-expected.png: Added.
        * fast/forms/input-readonly-select-all-expected.txt: Added.
        * fast/forms/input-readonly-select-all.html: Added.
        * fast/forms/textarea-readonly-select-all-expected.checksum: Added.
        * fast/forms/textarea-readonly-select-all-expected.png: Added.
        * fast/forms/textarea-readonly-select-all-expected.txt: Added.
        * fast/forms/textarea-readonly-select-all.html: Added.

WebCore:

        Reviewed by Ada and Kevin McCullough.

        Fix for <rdar://problem/5301322> REGRESSION: Select All selects the whole page when used in readonly textareas

        Implemented canSelectAll and selectAll for text fields and textareas, since they're special cases even when they're not editable.

        Tests:
        fast/forms/input-readonly-select-all.html
        fast/forms/textarea-readonly-select-all.html

        * html/HTMLInputElement.h:
        (WebCore::HTMLInputElement::canSelectAll):
        (WebCore::HTMLInputElement::selectAll):
        * html/HTMLTextAreaElement.h:
        (WebCore::HTMLTextAreaElement::canSelectAll):
        (WebCore::HTMLTextAreaElement::selectAll):

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

12 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/forms/input-readonly-select-all-expected.checksum [new file with mode: 0644]
LayoutTests/fast/forms/input-readonly-select-all-expected.png [new file with mode: 0644]
LayoutTests/fast/forms/input-readonly-select-all-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/input-readonly-select-all.html [new file with mode: 0644]
LayoutTests/fast/forms/textarea-readonly-select-all-expected.checksum [new file with mode: 0644]
LayoutTests/fast/forms/textarea-readonly-select-all-expected.png [new file with mode: 0644]
LayoutTests/fast/forms/textarea-readonly-select-all-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/textarea-readonly-select-all.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/html/HTMLInputElement.h
WebCore/html/HTMLTextAreaElement.h

index 0ecbf6f..fb4791e 100644 (file)
@@ -1,3 +1,18 @@
+2007-06-29  Adele Peterson  <adele@apple.com>
+
+        Reviewed by Ada and Kevin McCullough.
+
+        Test for <rdar://problem/5301322> REGRESSION: Select All selects the whole page when used in readonly textareas
+
+        * fast/forms/input-readonly-select-all-expected.checksum: Added.
+        * fast/forms/input-readonly-select-all-expected.png: Added.
+        * fast/forms/input-readonly-select-all-expected.txt: Added.
+        * fast/forms/input-readonly-select-all.html: Added.
+        * fast/forms/textarea-readonly-select-all-expected.checksum: Added.
+        * fast/forms/textarea-readonly-select-all-expected.png: Added.
+        * fast/forms/textarea-readonly-select-all-expected.txt: Added.
+        * fast/forms/textarea-readonly-select-all.html: Added.
+
 2007-06-28  Mitz Pettel  <mitz@webkit.org>
 
         Reviewed by Beth.
diff --git a/LayoutTests/fast/forms/input-readonly-select-all-expected.checksum b/LayoutTests/fast/forms/input-readonly-select-all-expected.checksum
new file mode 100644 (file)
index 0000000..a06e874
--- /dev/null
@@ -0,0 +1 @@
+bad0bba0462b2eb28be7b9478d47d272
\ No newline at end of file
diff --git a/LayoutTests/fast/forms/input-readonly-select-all-expected.png b/LayoutTests/fast/forms/input-readonly-select-all-expected.png
new file mode 100644 (file)
index 0000000..b0257b1
Binary files /dev/null and b/LayoutTests/fast/forms/input-readonly-select-all-expected.png differ
diff --git a/LayoutTests/fast/forms/input-readonly-select-all-expected.txt b/LayoutTests/fast/forms/input-readonly-select-all-expected.txt
new file mode 100644 (file)
index 0000000..764282b
--- /dev/null
@@ -0,0 +1,17 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderText {#text} at (0,0) size 585x18
+        text run at (0,0) width 585: "This tests that select all works in a readonly text field, without selecting the surrounding text. "
+      RenderBR {BR} at (0,0) size 0x0
+      RenderTextControl {INPUT} at (2,20) size 148x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+      RenderText {#text} at (0,0) size 0x0
+      RenderText {#text} at (0,0) size 0x0
+layer at (13,31) size 142x13 scrollWidth 153
+  RenderBlock {DIV} at (3,3) size 142x13
+    RenderText {#text} at (1,0) size 152x13
+      text run at (1,0) width 152: "This text should be selected"
+selection start: position 0 of child 0 {#text} of child 0 {DIV} of child 3 {INPUT} of child 1 {BODY} of child 0 {HTML} of document
+selection end:   position 28 of child 0 {#text} of child 0 {DIV} of child 3 {INPUT} of child 1 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/fast/forms/input-readonly-select-all.html b/LayoutTests/fast/forms/input-readonly-select-all.html
new file mode 100644 (file)
index 0000000..3fbaa3d
--- /dev/null
@@ -0,0 +1,17 @@
+<html>
+<head>
+    <script>
+        function test()
+        {
+            var tf = document.getElementById('tf');
+            tf.focus();
+            document.execCommand("SelectAll");
+        }
+    </script>
+</head>
+<body onload="test()">
+    This tests that select all works in a readonly text field, without selecting the surrounding text.
+    <br>
+    <input id="tf" readonly value="This text should be selected"></input>
+</body>
+</html>
diff --git a/LayoutTests/fast/forms/textarea-readonly-select-all-expected.checksum b/LayoutTests/fast/forms/textarea-readonly-select-all-expected.checksum
new file mode 100644 (file)
index 0000000..e1c2678
--- /dev/null
@@ -0,0 +1 @@
+6aeb3a077068317812e9ea79708491a8
\ No newline at end of file
diff --git a/LayoutTests/fast/forms/textarea-readonly-select-all-expected.png b/LayoutTests/fast/forms/textarea-readonly-select-all-expected.png
new file mode 100644 (file)
index 0000000..a329d99
Binary files /dev/null and b/LayoutTests/fast/forms/textarea-readonly-select-all-expected.png differ
diff --git a/LayoutTests/fast/forms/textarea-readonly-select-all-expected.txt b/LayoutTests/fast/forms/textarea-readonly-select-all-expected.txt
new file mode 100644 (file)
index 0000000..2925ffd
--- /dev/null
@@ -0,0 +1,18 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderText {#text} at (0,0) size 579x18
+        text run at (0,0) width 579: "This tests that select all works in a readonly textarea, without selecting the surrounding text. "
+      RenderBR {BR} at (0,0) size 0x0
+      RenderTextControl {TEXTAREA} at (2,20) size 163x28 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
+      RenderText {#text} at (0,0) size 0x0
+      RenderText {#text} at (0,0) size 0x0
+      RenderText {#text} at (0,0) size 0x0
+layer at (11,29) size 161x26
+  RenderBlock {DIV} at (1,1) size 161x26
+    RenderText {#text} at (3,0) size 152x13
+      text run at (3,0) width 152: "This text should be selected"
+selection start: position 0 of child 0 {#text} of child 0 {DIV} of child 3 {TEXTAREA} of child 1 {BODY} of child 0 {HTML} of document
+selection end:   position 28 of child 0 {#text} of child 0 {DIV} of child 3 {TEXTAREA} of child 1 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/fast/forms/textarea-readonly-select-all.html b/LayoutTests/fast/forms/textarea-readonly-select-all.html
new file mode 100644 (file)
index 0000000..8c71395
--- /dev/null
@@ -0,0 +1,18 @@
+<html>
+<head>
+    <script>
+        function test()
+        {
+            var ta = document.getElementById('ta');
+            ta.focus();
+            document.execCommand("SelectAll");
+        }
+    </script>
+</head>
+<body onload="test()">
+    This tests that select all works in a readonly textarea, without selecting the surrounding text.
+    <br>
+    <textarea id="ta" readonly>This text should be selected</textarea>
+</body>
+</html>
+
index 9c4a464..e448d5c 100644 (file)
@@ -1,3 +1,22 @@
+2007-06-29  Adele Peterson  <adele@apple.com>
+
+        Reviewed by Ada and Kevin McCullough.
+
+        Fix for <rdar://problem/5301322> REGRESSION: Select All selects the whole page when used in readonly textareas
+
+        Implemented canSelectAll and selectAll for text fields and textareas, since they're special cases even when they're not editable.
+
+        Tests:
+        fast/forms/input-readonly-select-all.html
+        fast/forms/textarea-readonly-select-all.html
+
+        * html/HTMLInputElement.h:
+        (WebCore::HTMLInputElement::canSelectAll):
+        (WebCore::HTMLInputElement::selectAll):
+        * html/HTMLTextAreaElement.h:
+        (WebCore::HTMLTextAreaElement::canSelectAll):
+        (WebCore::HTMLTextAreaElement::selectAll):
+
 2007-06-29  Adam Roben  <aroben@apple.com>
 
         Build fix
index aba26b0..d844905 100644 (file)
@@ -66,7 +66,8 @@ public:
     virtual void dispatchBlurEvent();
     virtual void updateFocusAppearance(bool restorePreviousSelection = false);
     virtual void aboutToUnload();
-
+    virtual bool canSelectAll() const { return isTextField(); }
+    virtual void selectAll() { select(); }
     virtual const AtomicString& name() const;
 
     bool autoComplete() const { return m_autocomplete; }
index 30c7197..1d9d6d2 100644 (file)
@@ -74,7 +74,9 @@ public:
     virtual bool isKeyboardFocusable(KeyboardEvent*) const;
     virtual void focus(bool restorePreviousSelection = true);
     virtual void updateFocusAppearance(bool restorePreviousSelection = true);
-
+    virtual bool canSelectAll() const { return true; }
+    virtual void selectAll() { select(); }
+    
     String value() const;
     void setValue(const String&);
     String defaultValue() const;