2011-01-12 Tony Chang <tony@chromium.org>
authortony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Jan 2011 22:26:21 +0000 (22:26 +0000)
committertony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Jan 2011 22:26:21 +0000 (22:26 +0000)
        Reviewed by Ojan Vafai.

        output the value of input and textarea nodes when using dump-as-markup
        https://bugs.webkit.org/show_bug.cgi?id=52319

        * editing/inserting/5607069-2-expected.txt:
        * editing/inserting/5607069-3-expected.txt:
        * editing/selection/dump-as-markup-expected.txt:
        * editing/selection/dump-as-markup-form-text-expected.txt: Added.
        * editing/selection/dump-as-markup-form-text.html: Added.
        * fast/parser/object-with-textarea-fallback-expected.txt:
        * html5lib/runner.html:
        * html5lib/webkit-resumer.html:
        * resources/dump-as-markup.js:
        (Markup.useHTML5libOutputFormat): Add a flag for html5lib compatibility
        (Markup._get):

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

LayoutTests/ChangeLog
LayoutTests/editing/inserting/5607069-2-expected.txt
LayoutTests/editing/inserting/5607069-3-expected.txt
LayoutTests/editing/selection/dump-as-markup-expected.txt
LayoutTests/editing/selection/dump-as-markup-form-text-expected.txt [new file with mode: 0644]
LayoutTests/editing/selection/dump-as-markup-form-text.html [new file with mode: 0644]
LayoutTests/fast/parser/object-with-textarea-fallback-expected.txt
LayoutTests/html5lib/runner.html
LayoutTests/html5lib/webkit-resumer.html
LayoutTests/resources/dump-as-markup.js

index 39b44b1..f949038 100644 (file)
@@ -1,3 +1,22 @@
+2011-01-12  Tony Chang  <tony@chromium.org>
+
+        Reviewed by Ojan Vafai.
+
+        output the value of input and textarea nodes when using dump-as-markup
+        https://bugs.webkit.org/show_bug.cgi?id=52319
+
+        * editing/inserting/5607069-2-expected.txt:
+        * editing/inserting/5607069-3-expected.txt:
+        * editing/selection/dump-as-markup-expected.txt:
+        * editing/selection/dump-as-markup-form-text-expected.txt: Added.
+        * editing/selection/dump-as-markup-form-text.html: Added.
+        * fast/parser/object-with-textarea-fallback-expected.txt:
+        * html5lib/runner.html:
+        * html5lib/webkit-resumer.html:
+        * resources/dump-as-markup.js:
+        (Markup.useHTML5libOutputFormat): Add a flag for html5lib compatibility
+        (Markup._get):
+
 2011-01-12  Robert Hogan  <robert@webkit.org>
 
         Unreviewed, add expected results.
index 402e2d8..a3ad853 100644 (file)
@@ -1,6 +1,8 @@
 This tests for a bug where InsertLineBreak would insert a '\n' instead of a <br> if the caret was set just before an input field. There should be a br element between two input elements.
 | <input>
 |   type="text"
+|   this.value=""
 | <br>
 | <input>
 |   type="text"
+|   this.value=""
index f8a1ec6..90c0fe9 100644 (file)
@@ -3,8 +3,10 @@ This tests for a bug in InsertParagraph where it would split and clone a <form>
 |   style="border: 1px solid blue;"
 |   <input>
 |     type="text"
+|     this.value=""
 |   "x"
 |   <br>
 |   "<#selection-caret>x"
 |   <input>
 |     type="text"
+|     this.value=""
index b816901..0051557 100644 (file)
@@ -17,6 +17,7 @@ Tests basic dump-as-markup functionality.
 "
 |     <input>
 |       type="text"
+|       this.value=""
 |     "
 "
 |     <div>
diff --git a/LayoutTests/editing/selection/dump-as-markup-form-text-expected.txt b/LayoutTests/editing/selection/dump-as-markup-form-text-expected.txt
new file mode 100644 (file)
index 0000000..155cc92
--- /dev/null
@@ -0,0 +1,29 @@
+Tests dump-as-markup for input and textarea forms.
+| <!DOCTYPE html>
+| <html>
+|   <head>
+|     <script>
+|       src="../../resources/dump-as-markup.js"
+|     "
+
+"
+|   <body>
+|     <input>
+|       value="original"
+|       this.value="replaced"
+|     "
+"
+|     <textarea>
+|       this.value="replaced"
+|       "original"
+|     "
+"
+|     <script>
+|       "
+Markup.description("Tests dump-as-markup for input and textarea forms.");
+
+document.getElementsByTagName("input")[0].value = "replaced";
+document.getElementsByTagName("textarea")[0].value = "replaced";
+"
+|     "
+"
diff --git a/LayoutTests/editing/selection/dump-as-markup-form-text.html b/LayoutTests/editing/selection/dump-as-markup-form-text.html
new file mode 100644 (file)
index 0000000..f61e9a0
--- /dev/null
@@ -0,0 +1,11 @@
+<!DocType html>
+<script src="../../resources/dump-as-markup.js"></script>
+
+<input value="original" />
+<textarea>original</textarea>
+<script>
+Markup.description("Tests dump-as-markup for input and textarea forms.");
+
+document.getElementsByTagName("input")[0].value = "replaced";
+document.getElementsByTagName("textarea")[0].value = "replaced";
+</script>
index 5e9b32a..3f8a9f6 100644 (file)
@@ -12,6 +12,7 @@
 "
 |       <textarea>
 |         name="editor1"
+|         this.value=""
 |       "
 "
 |     "
index b54de4e..27ef9f7 100644 (file)
@@ -34,6 +34,7 @@ display: none;
 <iframe></iframe>
 <script>
 Markup.noAutoDump();
+Markup.useHTML5libOutputFormat();
 
 var test_files = [
         'resources/pending-spec-changes-plain-text-unsafe.dat',
index bd961a4..5b4510b 100644 (file)
@@ -33,6 +33,7 @@ display: none;
 <iframe></iframe>
 <script>
 Markup.noAutoDump();
+Markup.useHTML5libOutputFormat();
 
 var test_files = [
         // 'resources/tests1.dat',
index f73dddf..e159651 100644 (file)
@@ -119,6 +119,11 @@ Markup.notifyDone = function()
         layoutTestController.notifyDone();
 }
 
+Markup.useHTML5libOutputFormat = function()
+{
+    Markup._useHTML5libOutputFormat = true;
+}
+
 Markup.get = function(node)
 {
     if (!node.firstChild)
@@ -139,7 +144,7 @@ Markup._get = function(node, depth)
     var str = Markup._indent(depth);
 
     switch (node.nodeType) {
-    case 10:
+    case Node.DOCUMENT_TYPE_NODE:
         str += '<!DOCTYPE ' + node.nodeName;
         if (node.publicId || node.systemId) {
             str += ' "' + node.publicId + '"';
@@ -148,7 +153,7 @@ Markup._get = function(node, depth)
         str += '>';
         break;
 
-    case 8:
+    case Node.COMMENT_NODE:
         try {
             str += '<!-- ' + node.nodeValue + ' -->';
         } catch (e) {
@@ -156,19 +161,19 @@ Markup._get = function(node, depth)
         }
         break;
 
-    case 7:
+    case Node.PROCESSING_INSTRUCTION_NODE:
         str += '<?' + node.nodeName + node.nodeValue + '>';
         break;
 
-    case 4:
+    case Node.CDATA_SECTION_NODE:
         str += '<![CDATA[ ' + node.nodeValue + ' ]]>';
         break;
 
-    case 3:
+    case Node.TEXT_NODE:
         str += '"' + Markup._getMarkupForTextNode(node) + '"';
         break;
 
-    case 1:
+    case Node.ELEMENT_NODE:
         str += "<";
         str += Markup._namespace(node)
 
@@ -198,6 +203,11 @@ Markup._get = function(node, depth)
               }
             }
         }
+
+        if (!Markup._useHTML5libOutputFormat)
+            if (node.nodeName == "INPUT" || node.nodeName == "TEXTAREA")
+                str += Markup._indent(depth + 1) + 'this.value="' + node.value + '"';
+
         break;
     }