LayoutTests:
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Jun 2006 05:55:22 +0000 (05:55 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Jun 2006 05:55:22 +0000 (05:55 +0000)
        Reviewed by Maciej and Adele

        Tests for http://bugzilla.opendarwin.org/show_bug.cgi?id=8398
        Updated and extended select/option form tests

        * fast/forms/HTMLOptionElement_label01.html:
        * fast/forms/HTMLOptionElement_label01-expected.txt:
        * fast/forms/HTMLOptionElement_label01-expected.png:
        * fast/forms/HTMLOptionElement_label02.html:
        * fast/forms/HTMLOptionElement_label02-expected.txt:
        * fast/forms/HTMLOptionElement_label02-expected.png:
        * fast/forms/HTMLOptionElement_label03.html:
        * fast/forms/HTMLOptionElement_label03-expected.txt:
        * fast/forms/HTMLOptionElement_label03-expected.png
        * fast/forms/HTMLOptionElement_label04.html:
        * fast/forms/HTMLOptionElement_label04-expected.txt:
        * fast/forms/HTMLOptionElement_label04-expected.png
        * fast/forms/HTMLOptionElement_label05.html:
        * fast/forms/HTMLOptionElement_label05-expected.txt:
        * fast/forms/HTMLOptionElement_label05-expected.png:
        Updated to reflect success and added some description

        * fast/forms/HTMLOptionElement_label06.html:
        * fast/forms/HTMLOptionElement_label06-expected.txt:
        * fast/forms/HTMLOptionElement_label05-expected.png:
        * fast/forms/HTMLOptionElement_label07.html:
        * fast/forms/HTMLOptionElement_label07-expected.txt:
        * fast/forms/HTMLOptionElement_label07-expected.png:
        Added.

WebCore:

        Reviewed by Maciej and Adele

        Fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=8398
        REGRESSION: LABEL in OPTION element is clobbering display #TEXT
        Patch provided by Darin.

        * rendering/RenderSelect.cpp
        (RenderSelect::updateFromElement):
        Changed to use the containing text by default, and not the label text

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

31 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/forms/HTMLOptionElement_label01-expected.checksum
LayoutTests/fast/forms/HTMLOptionElement_label01-expected.png
LayoutTests/fast/forms/HTMLOptionElement_label01-expected.txt
LayoutTests/fast/forms/HTMLOptionElement_label01.html
LayoutTests/fast/forms/HTMLOptionElement_label02-expected.checksum
LayoutTests/fast/forms/HTMLOptionElement_label02-expected.png
LayoutTests/fast/forms/HTMLOptionElement_label02-expected.txt
LayoutTests/fast/forms/HTMLOptionElement_label02.html
LayoutTests/fast/forms/HTMLOptionElement_label03-expected.checksum
LayoutTests/fast/forms/HTMLOptionElement_label03-expected.png
LayoutTests/fast/forms/HTMLOptionElement_label03-expected.txt
LayoutTests/fast/forms/HTMLOptionElement_label03.html
LayoutTests/fast/forms/HTMLOptionElement_label04-expected.checksum
LayoutTests/fast/forms/HTMLOptionElement_label04-expected.png
LayoutTests/fast/forms/HTMLOptionElement_label04-expected.txt
LayoutTests/fast/forms/HTMLOptionElement_label04.html
LayoutTests/fast/forms/HTMLOptionElement_label05-expected.checksum
LayoutTests/fast/forms/HTMLOptionElement_label05-expected.png
LayoutTests/fast/forms/HTMLOptionElement_label05-expected.txt
LayoutTests/fast/forms/HTMLOptionElement_label05.html
LayoutTests/fast/forms/HTMLOptionElement_label06-expected.checksum [new file with mode: 0644]
LayoutTests/fast/forms/HTMLOptionElement_label06-expected.png [new file with mode: 0644]
LayoutTests/fast/forms/HTMLOptionElement_label06-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/HTMLOptionElement_label06.html [new file with mode: 0644]
LayoutTests/fast/forms/HTMLOptionElement_label07-expected.checksum [new file with mode: 0644]
LayoutTests/fast/forms/HTMLOptionElement_label07-expected.png [new file with mode: 0644]
LayoutTests/fast/forms/HTMLOptionElement_label07-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/HTMLOptionElement_label07.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderSelect.cpp

index a5e9f98c1d3918e2a5e2e7986bab0a55977ae219..b9d176e05e1475578e45ab79b524337fe6bb28af 100644 (file)
@@ -1,3 +1,35 @@
+2006-06-01  David Carson  <dacarson@gmail.com>
+
+        Reviewed by Maciej and Adele
+        
+        Tests for http://bugzilla.opendarwin.org/show_bug.cgi?id=8398
+        Updated and extended select/option form tests 
+        
+        * fast/forms/HTMLOptionElement_label01.html:
+        * fast/forms/HTMLOptionElement_label01-expected.txt:
+        * fast/forms/HTMLOptionElement_label01-expected.png:
+        * fast/forms/HTMLOptionElement_label02.html:
+        * fast/forms/HTMLOptionElement_label02-expected.txt:
+        * fast/forms/HTMLOptionElement_label02-expected.png:
+        * fast/forms/HTMLOptionElement_label03.html:
+        * fast/forms/HTMLOptionElement_label03-expected.txt:
+        * fast/forms/HTMLOptionElement_label03-expected.png
+        * fast/forms/HTMLOptionElement_label04.html:
+        * fast/forms/HTMLOptionElement_label04-expected.txt:
+        * fast/forms/HTMLOptionElement_label04-expected.png
+        * fast/forms/HTMLOptionElement_label05.html:
+        * fast/forms/HTMLOptionElement_label05-expected.txt:
+        * fast/forms/HTMLOptionElement_label05-expected.png:
+        Updated to reflect success and added some description
+        
+        * fast/forms/HTMLOptionElement_label06.html:
+        * fast/forms/HTMLOptionElement_label06-expected.txt:
+        * fast/forms/HTMLOptionElement_label05-expected.png:
+        * fast/forms/HTMLOptionElement_label07.html:
+        * fast/forms/HTMLOptionElement_label07-expected.txt:
+        * fast/forms/HTMLOptionElement_label07-expected.png:
+        Added.
+
 2006-06-01  David Carson  <dacarson@gmail.com>
         
         Reviewed by Hyatt
index eb117df8bbe79f33fb7e8174863f4d5e9cd4d04b..3072f8ee8959b87a733d64b272f79562af9a575c 100644 (file)
@@ -1 +1 @@
-75dbc993b3353c9418ecb9ec0f72dc29
\ No newline at end of file
+b2111e5de6977b83d86103ae1dcd7408
\ No newline at end of file
index 18d30cecec57f0555070db08db2fd0f33b87a5b0..e94f8a8e86b1ca2819b49885b5d1a1e0db3d0d0f 100644 (file)
Binary files a/LayoutTests/fast/forms/HTMLOptionElement_label01-expected.png and b/LayoutTests/fast/forms/HTMLOptionElement_label01-expected.png differ
index 72ccdd86f117ad4b7ead7199a0e12db7ea10322d..ed88ae8ef519019aa12de7e5bfc64c91f87aa998 100644 (file)
@@ -3,5 +3,8 @@ layer 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
-      RenderSelect {SELECT} at (2,2) size 38x18
+      RenderText {#text} at (0,0) size 673x18
+        text run at (0,0) width 673: "In the selection list below, the text 'The label for this element is \"1\"' should appear, and not the character '1'"
+      RenderBR {BR} at (673,14) size 0x0
+      RenderSelect {SELECT} at (2,20) size 197x18
       RenderText {#text} at (0,0) size 0x0
index 59aa97a9469b3f12bbac9aba07f9581e9d27c07d..94a502d88c1ffcf7940db9d7c2233c372e339b32 100644 (file)
@@ -1 +1,4 @@
-<select>\r<option label="1">the label for this element is "1"</option>\r</select>\r
\ No newline at end of file
+In the selection list below, the text 'The label for this element is "1"' should appear, and not the character '1'<br>
+<select>
+<option label="1">the label for this element is "1"</option>
+</select>
index 56771bde668641ecbdd5b5cf5cb4475aacaa68ec..2be8e12b55377a23fd56fa28900fd90b20273557 100644 (file)
@@ -1 +1 @@
-f82a02cc8580d0b103828524c66bfbf4
\ No newline at end of file
+889f1936ba4389da5e898b9c4ae87ba2
\ No newline at end of file
index 297132c7783b9bfda182a08208748dd5ddc1256f..99a70aa2f6c88755d5c002158c85bea227f7ddfa 100644 (file)
Binary files a/LayoutTests/fast/forms/HTMLOptionElement_label02-expected.png and b/LayoutTests/fast/forms/HTMLOptionElement_label02-expected.png differ
index c3911d29b94a85affdedb92d0c01067762f2b5d6..119219da665574582f603abbbe43e4ca12984c66 100644 (file)
@@ -3,5 +3,8 @@ layer 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
-      RenderSelect {SELECT} at (2,2) size 36x18
+      RenderText {#text} at (0,0) size 300x18
+        text run at (0,0) width 300: "With the label empty, the enclosing text is used."
+      RenderBR {BR} at (300,14) size 0x0
+      RenderSelect {SELECT} at (2,20) size 309x18
       RenderText {#text} at (0,0) size 0x0
index ae6279de0ac30101cff49db37c2dfb18513daa88..8522d04047cc7762f1aca3b23e86ede06e20006e 100644 (file)
@@ -1 +1,4 @@
-<select>\r<option label="">empty label should display empty string to match IE</option>\r</select>\r
\ No newline at end of file
+With the label empty, the enclosing text is used.<br>
+<select>
+<option label="">empty label should display empty string to match IE</option>
+</select>
index 56771bde668641ecbdd5b5cf5cb4475aacaa68ec..6565cbca58d5b6ea0795cea118f49e7678e36438 100644 (file)
@@ -1 +1 @@
-f82a02cc8580d0b103828524c66bfbf4
\ No newline at end of file
+50f731b6421252a89ab0784a3185c53d
\ No newline at end of file
index 297132c7783b9bfda182a08208748dd5ddc1256f..c02c7ec0f36a78f5574903fb635b70ca028157ae 100644 (file)
Binary files a/LayoutTests/fast/forms/HTMLOptionElement_label03-expected.png and b/LayoutTests/fast/forms/HTMLOptionElement_label03-expected.png differ
index c3911d29b94a85affdedb92d0c01067762f2b5d6..cc96e1b504e58a13125c703ac3928ac251fd4e65 100644 (file)
@@ -3,5 +3,8 @@ layer 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
-      RenderSelect {SELECT} at (2,2) size 36x18
+      RenderText {#text} at (0,0) size 436x18
+        text run at (0,0) width 436: "When the label contains only white space, the containing text is used."
+      RenderBR {BR} at (436,14) size 0x0
+      RenderSelect {SELECT} at (2,20) size 338x18
       RenderText {#text} at (0,0) size 0x0
index 922a700e20a35bef6559000c3e2d5f09e2a33c57..f72ae967f0d88fc04d8ed4bae4410e9efa2a0e00 100644 (file)
@@ -1 +1,4 @@
-<select>\r<option label=" ">white space label should display empty string to match IE</option>\r</select>\r
\ No newline at end of file
+When the label contains only white space, the containing text is used.<br>
+<select>
+<option label=" ">white space label should display empty string to match IE</option>
+</select>
index 56771bde668641ecbdd5b5cf5cb4475aacaa68ec..4e3b1a907bb8888253351f6c77e7d990a17cbe9f 100644 (file)
@@ -1 +1 @@
-f82a02cc8580d0b103828524c66bfbf4
\ No newline at end of file
+b3b94f99be537fe0458811765c33b5c4
\ No newline at end of file
index 297132c7783b9bfda182a08208748dd5ddc1256f..79fca91629abe77e2c4765b704a6efceb89351f1 100644 (file)
Binary files a/LayoutTests/fast/forms/HTMLOptionElement_label04-expected.png and b/LayoutTests/fast/forms/HTMLOptionElement_label04-expected.png differ
index c3911d29b94a85affdedb92d0c01067762f2b5d6..31c9ce7fa1b933938779a462ff0b1404ef2edb15 100644 (file)
@@ -3,5 +3,8 @@ layer 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
-      RenderSelect {SELECT} at (2,2) size 36x18
+      RenderText {#text} at (0,0) size 595x18
+        text run at (0,0) width 595: "The label attribute appears, but is missing the equals value piece, so the containing text is used."
+      RenderBR {BR} at (595,14) size 0x0
+      RenderSelect {SELECT} at (2,20) size 464x18
       RenderText {#text} at (0,0) size 0x0
index 8464c3fb50721e3e537d8ae5132b2557818ebfe1..cf13e743fdf7cd9058009455e74c17b7b2a7295c 100644 (file)
@@ -1 +1,4 @@
-<select>\r<option label>the label attribute is mentioned but no value is specified; this text should appear</option>\r</select>\r
\ No newline at end of file
+The label attribute appears, but is missing the equals value piece, so the containing text is used.<br>
+<select>
+<option label>the label attribute is mentioned but no value is specified; this text should appear</option>
+</select>
index 2cd6646f30c2bac07efd5b7131406d8f56387fad..2bb1d153ad06456bcfa5c9c452675718f582d201 100644 (file)
@@ -1 +1 @@
-1aed407505967364c112395ee76359fb
\ No newline at end of file
+4e5bf2bb603a97f4173e63946bf94d11
\ No newline at end of file
index 5bd9278ee55a0e100fa9f659c01317c992e96a4d..0e854eeb4907bcb9a9584b73d9bdd3f77c2f2432 100644 (file)
Binary files a/LayoutTests/fast/forms/HTMLOptionElement_label05-expected.png and b/LayoutTests/fast/forms/HTMLOptionElement_label05-expected.png differ
index d3a730524483dd1ec66bba04629fbd1345eec1e4..0d9ef229cb81e52334fcdbc662720f43021d81b5 100644 (file)
@@ -3,5 +3,8 @@ layer 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
-      RenderSelect {SELECT} at (2,2) size 149x72
+      RenderText {#text} at (0,0) size 668x18
+        text run at (0,0) width 668: "In the list box below, the text \"This text should appear\" should be shown as the first entry into the list box."
+      RenderBR {BR} at (668,14) size 0x0
+      RenderSelect {SELECT} at (2,20) size 144x72
       RenderText {#text} at (0,0) size 0x0
index 9b4cb1225f087365862c196319c0fb60b8d7ab4b..e17150ccb6063410c8330c8d2462a0ad2b0c721a 100644 (file)
@@ -1 +1,2 @@
-<select size="5"><option label="This label should appear">This text should not appear</option></select>\r
\ No newline at end of file
+In the list box below, the text "This text should appear" should be shown as the first entry into the list box.<br>
+<select size="5"><option label="This label should not appear">This text should appear</option></select>
diff --git a/LayoutTests/fast/forms/HTMLOptionElement_label06-expected.checksum b/LayoutTests/fast/forms/HTMLOptionElement_label06-expected.checksum
new file mode 100644 (file)
index 0000000..65327bb
--- /dev/null
@@ -0,0 +1 @@
+43b7e2d07d9c41409466664d13812d7c
\ No newline at end of file
diff --git a/LayoutTests/fast/forms/HTMLOptionElement_label06-expected.png b/LayoutTests/fast/forms/HTMLOptionElement_label06-expected.png
new file mode 100644 (file)
index 0000000..380d7b4
Binary files /dev/null and b/LayoutTests/fast/forms/HTMLOptionElement_label06-expected.png differ
diff --git a/LayoutTests/fast/forms/HTMLOptionElement_label06-expected.txt b/LayoutTests/fast/forms/HTMLOptionElement_label06-expected.txt
new file mode 100644 (file)
index 0000000..5cbed7b
--- /dev/null
@@ -0,0 +1,10 @@
+layer at (0,0) size 800x600
+  RenderCanvas 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 718x18
+        text run at (0,0) width 718: "The select item below has a label specified, and no enclosed text. There should be no text shown in the select box."
+      RenderBR {BR} at (718,14) size 0x0
+      RenderSelect {SELECT} at (2,20) size 53x18
+      RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/fast/forms/HTMLOptionElement_label06.html b/LayoutTests/fast/forms/HTMLOptionElement_label06.html
new file mode 100644 (file)
index 0000000..cca18e3
--- /dev/null
@@ -0,0 +1,2 @@
+The select item below has a label specified, and no enclosed text. There should be no text shown in the select box.<br>
+<select><option label="text"></option></select>
diff --git a/LayoutTests/fast/forms/HTMLOptionElement_label07-expected.checksum b/LayoutTests/fast/forms/HTMLOptionElement_label07-expected.checksum
new file mode 100644 (file)
index 0000000..aefdca6
--- /dev/null
@@ -0,0 +1 @@
+606805bddcfef40e61bfb8426f74ecd7
\ No newline at end of file
diff --git a/LayoutTests/fast/forms/HTMLOptionElement_label07-expected.png b/LayoutTests/fast/forms/HTMLOptionElement_label07-expected.png
new file mode 100644 (file)
index 0000000..a445511
Binary files /dev/null and b/LayoutTests/fast/forms/HTMLOptionElement_label07-expected.png differ
diff --git a/LayoutTests/fast/forms/HTMLOptionElement_label07-expected.txt b/LayoutTests/fast/forms/HTMLOptionElement_label07-expected.txt
new file mode 100644 (file)
index 0000000..9af018b
--- /dev/null
@@ -0,0 +1,11 @@
+layer at (0,0) size 800x600
+  RenderCanvas 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 781x36
+        text run at (0,0) width 781: "The select item below has a label specified, and enclosed text that is whitespace. There should be no text shown in the select"
+        text run at (0,18) width 28: "box."
+      RenderBR {BR} at (28,32) size 0x0
+      RenderSelect {SELECT} at (2,38) size 36x18
+      RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/fast/forms/HTMLOptionElement_label07.html b/LayoutTests/fast/forms/HTMLOptionElement_label07.html
new file mode 100644 (file)
index 0000000..4d0bab3
--- /dev/null
@@ -0,0 +1,2 @@
+The select item below has a label specified, and enclosed text that is whitespace. There should be no text shown in the select box.<br>
+<select><option label="text"> </option></select>
index d730faf06f326afc7f6d6eb60e3afa5f7a888127..e44d2d7b614cfbe8114bb320ba0f7e116702ed2c 100644 (file)
@@ -1,3 +1,15 @@
+2006-06-01  David Carson  <dacarson@gmail.com>
+
+        Reviewed by Maciej and Adele
+
+        Fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=8398
+        REGRESSION: LABEL in OPTION element is clobbering display #TEXT
+        Patch provided by Darin.
+        
+        * rendering/RenderSelect.cpp
+        (RenderSelect::updateFromElement): 
+        Changed to use the containing text by default, and not the label text
+
 2006-06-01  David Carson  <dacarson@gmail.com>
 
         Reviewed by Hyatt.
index 3b5f21aa00081aa16f20d19b8180280efd1320c0..a2b6018ee7481a10d5fc14c4711ef4205c59d30b 100644 (file)
@@ -133,11 +133,9 @@ void RenderSelect::updateFromElement()
                     static_cast<QComboBox*>(m_widget)->appendGroupLabel(label);
             } else if (listItems[listIndex]->hasTagName(optionTag)) {
                 HTMLOptionElement* optionElement = static_cast<HTMLOptionElement*>(listItems[listIndex]);
-                DeprecatedString itemText;
-                if (optionElement->hasAttribute(labelAttr))
+                DeprecatedString itemText = optionElement->text().deprecatedString();
+                if (itemText.isEmpty())
                     itemText = optionElement->getAttribute(labelAttr).deprecatedString();
-                else
-                    itemText = optionElement->text().deprecatedString();
                 
                 itemText.replace('\\', backslashAsCurrencySymbol());