Reviewed by Sam Weinig.

Fixes: https://bugs.webkit.org/show_bug.cgi?id=22334

Add WMLBRElement, correcting <br/> behaviour in WML.
Enable entity replacment for WML documents.
Handle WML specific <p> 'mode' attribute.

Generate layout tests results for fast/wml.

Tests cases that pass now:
fast/wml/br-element-in-table.wml
fast/wml/br-element-in-text.wml
fast/wml/case-sensitivity.wml
fast/wml/cdata-section.wml
fast/wml/comment.wml
fast/wml/entity.wml
fast/wml/p-align.wml
fast/wml/p-mode.wml
fast/wml/text-emphasis.wml
fast/wml/validate-dtd.wml


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@38577 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 0008371..385ebd37 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,103 @@
+2008-11-18  Nikolas Zimmermann  <nikolas.zimmermann@torchmobile.com>
+
+        Reviewed by Sam Weinig.
+
+        Add results for all WML tests, including pixel results.
+
+        * fast/wml/p-mode.wml:
+        * fast/wml/validate-dtd.wml:
+        * platform/mac/fast/wml: Added.
+        * platform/mac/fast/wml/br-element-in-table-expected.checksum: Added.
+        * platform/mac/fast/wml/br-element-in-table-expected.png: Added.
+        * platform/mac/fast/wml/br-element-in-table-expected.txt: Added.
+        * platform/mac/fast/wml/br-element-in-text-expected.checksum: Added.
+        * platform/mac/fast/wml/br-element-in-text-expected.png: Added.
+        * platform/mac/fast/wml/br-element-in-text-expected.txt: Added.
+        * platform/mac/fast/wml/card-element-expected.checksum: Added.
+        * platform/mac/fast/wml/card-element-expected.png: Added.
+        * platform/mac/fast/wml/card-element-expected.txt: Added.
+        * platform/mac/fast/wml/case-sensitivity-expected.checksum: Added.
+        * platform/mac/fast/wml/case-sensitivity-expected.png: Added.
+        * platform/mac/fast/wml/case-sensitivity-expected.txt: Added.
+        * platform/mac/fast/wml/cdata-section-expected.checksum: Added.
+        * platform/mac/fast/wml/cdata-section-expected.png: Added.
+        * platform/mac/fast/wml/cdata-section-expected.txt: Added.
+        * platform/mac/fast/wml/comment-expected.checksum: Added.
+        * platform/mac/fast/wml/comment-expected.png: Added.
+        * platform/mac/fast/wml/comment-expected.txt: Added.
+        * platform/mac/fast/wml/do-element-optional-attr-expected.checksum: Added.
+        * platform/mac/fast/wml/do-element-optional-attr-expected.png: Added.
+        * platform/mac/fast/wml/do-element-optional-attr-expected.txt: Added.
+        * platform/mac/fast/wml/do-shadow-expected.checksum: Added.
+        * platform/mac/fast/wml/do-shadow-expected.png: Added.
+        * platform/mac/fast/wml/do-shadow-expected.txt: Added.
+        * platform/mac/fast/wml/do-template-expected.checksum: Added.
+        * platform/mac/fast/wml/do-template-expected.png: Added.
+        * platform/mac/fast/wml/do-template-expected.txt: Added.
+        * platform/mac/fast/wml/entity-expected.checksum: Added.
+        * platform/mac/fast/wml/entity-expected.png: Added.
+        * platform/mac/fast/wml/entity-expected.txt: Added.
+        * platform/mac/fast/wml/err-event-binding-conflict-expected.checksum: Added.
+        * platform/mac/fast/wml/err-event-binding-conflict-expected.png: Added.
+        * platform/mac/fast/wml/err-event-binding-conflict-expected.txt: Added.
+        * platform/mac/fast/wml/err-invalid-location-for-varref-expected.checksum: Added.
+        * platform/mac/fast/wml/err-invalid-location-for-varref-expected.png: Added.
+        * platform/mac/fast/wml/err-invalid-location-for-varref-expected.txt: Added.
+        * platform/mac/fast/wml/err-invalid-tablecolumn-number-expected.checksum: Added.
+        * platform/mac/fast/wml/err-invalid-tablecolumn-number-expected.png: Added.
+        * platform/mac/fast/wml/err-invalid-tablecolumn-number-expected.txt: Added.
+        * platform/mac/fast/wml/err-invalid-variable-name-expected.checksum: Added.
+        * platform/mac/fast/wml/err-invalid-variable-name-expected.png: Added.
+        * platform/mac/fast/wml/err-invalid-variable-name-expected.txt: Added.
+        * platform/mac/fast/wml/err-multi-access-expected.checksum: Added.
+        * platform/mac/fast/wml/err-multi-access-expected.png: Added.
+        * platform/mac/fast/wml/err-multi-access-expected.txt: Added.
+        * platform/mac/fast/wml/err-multi-http-equiv-in-meta-expected.checksum: Added.
+        * platform/mac/fast/wml/err-multi-http-equiv-in-meta-expected.png: Added.
+        * platform/mac/fast/wml/err-multi-http-equiv-in-meta-expected.txt: Added.
+        * platform/mac/fast/wml/err-multi-name-in-meta-expected.checksum: Added.
+        * platform/mac/fast/wml/err-multi-name-in-meta-expected.png: Added.
+        * platform/mac/fast/wml/err-multi-name-in-meta-expected.txt: Added.
+        * platform/mac/fast/wml/err-multi-timer-expected.checksum: Added.
+        * platform/mac/fast/wml/err-multi-timer-expected.png: Added.
+        * platform/mac/fast/wml/err-multi-timer-expected.txt: Added.
+        * platform/mac/fast/wml/err-samename-do-expected.checksum: Added.
+        * platform/mac/fast/wml/err-samename-do-expected.png: Added.
+        * platform/mac/fast/wml/err-samename-do-expected.txt: Added.
+        * platform/mac/fast/wml/err-unallowed-task-in-anchor-expected.checksum: Added.
+        * platform/mac/fast/wml/err-unallowed-task-in-anchor-expected.png: Added.
+        * platform/mac/fast/wml/err-unallowed-task-in-anchor-expected.txt: Added.
+        * platform/mac/fast/wml/img-localsrc-expected.checksum: Added.
+        * platform/mac/fast/wml/img-localsrc-expected.png: Added.
+        * platform/mac/fast/wml/img-localsrc-expected.txt: Added.
+        * platform/mac/fast/wml/img-src-expected.checksum: Added.
+        * platform/mac/fast/wml/img-src-expected.png: Added.
+        * platform/mac/fast/wml/img-src-expected.txt: Added.
+        * platform/mac/fast/wml/img-src-localsrc-alt-expected.checksum: Added.
+        * platform/mac/fast/wml/img-src-localsrc-alt-expected.png: Added.
+        * platform/mac/fast/wml/img-src-localsrc-alt-expected.txt: Added.
+        * platform/mac/fast/wml/p-align-expected.checksum: Added.
+        * platform/mac/fast/wml/p-align-expected.png: Added.
+        * platform/mac/fast/wml/p-align-expected.txt: Added.
+        * platform/mac/fast/wml/p-mode-expected.checksum: Added.
+        * platform/mac/fast/wml/p-mode-expected.png: Added.
+        * platform/mac/fast/wml/p-mode-expected.txt: Added.
+        * platform/mac/fast/wml/show-first-card-expected.checksum: Added.
+        * platform/mac/fast/wml/show-first-card-expected.png: Added.
+        * platform/mac/fast/wml/show-first-card-expected.txt: Added.
+        * platform/mac/fast/wml/table-element-expected.checksum: Added.
+        * platform/mac/fast/wml/table-element-expected.png: Added.
+        * platform/mac/fast/wml/table-element-expected.txt: Added.
+        * platform/mac/fast/wml/test-expected.checksum: Added.
+        * platform/mac/fast/wml/test-expected.png: Added.
+        * platform/mac/fast/wml/test-expected.txt: Added.
+        * platform/mac/fast/wml/text-emphasis-expected.checksum: Added.
+        * platform/mac/fast/wml/text-emphasis-expected.png: Added.
+        * platform/mac/fast/wml/text-emphasis-expected.txt: Added.
+        * platform/mac/fast/wml/validate-dtd-expected.checksum: Added.
+        * platform/mac/fast/wml/validate-dtd-expected.png: Added.
+        * platform/mac/fast/wml/validate-dtd-expected.txt: Added.
+
 2008-11-18  Geoffrey Garen  <ggaren@apple.com>
 
         Reviewed by Alexey Proskuryakov.
diff --git a/LayoutTests/fast/wml/p-mode.wml b/LayoutTests/fast/wml/p-mode.wml
index cbd16fd..14c1713 100644
--- a/LayoutTests/fast/wml/p-mode.wml
+++ b/LayoutTests/fast/wml/p-mode.wml
@@ -19,5 +19,17 @@
 <br/>
 HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
 </p>
+<![CDATA[ The next two paragraphs shouldn't be wrapped ]]>
+<p>
+Here you can learn various mobile technologies like WAP / WAP 2.0, WML, WMLScript, XHTML MP, WCSS / WAP CSS, UAProf and SMS through our free tutorials, articles and examples. This web site can help web programmers who wish to extend their knowledge to the wireless world. 
+<br/>
+HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
+</p>
+<br/>
+<p>
+Here you can learn various mobile technologies like WAP / WAP 2.0, WML, WMLScript, XHTML MP, WCSS / WAP CSS, UAProf and SMS through our free tutorials, articles and examples. This web site can help web programmers who wish to extend their knowledge to the wireless world. 
+<br/>
+HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
+</p>
 </card>
 </wml>
diff --git a/LayoutTests/fast/wml/validate-dtd.wml b/LayoutTests/fast/wml/validate-dtd.wml
index c8b968c..d48ba1b 100644
--- a/LayoutTests/fast/wml/validate-dtd.wml
+++ b/LayoutTests/fast/wml/validate-dtd.wml
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
-<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
+<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML NOT EXISTANT 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
 <wml>
 <card id="no1" title="Card 1"> 
-<p>Test for DTD validation of WML file<br/>If the DTCTYPE is incorrect or missing, this test failes.</p>
+<p>Test for DTD validation of WML file<br/>If the DOCTYPE is incorrect or missing, this test failes.</p>
 </card>
 </wml>
diff --git a/LayoutTests/platform/mac/fast/wml/br-element-in-table-expected.checksum b/LayoutTests/platform/mac/fast/wml/br-element-in-table-expected.checksum
new file mode 100644
index 0000000..536776f
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/br-element-in-table-expected.checksum
@@ -0,0 +1 @@
+98903948fdc8c8050d34f6c0dbbffd1c
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/br-element-in-table-expected.png b/LayoutTests/platform/mac/fast/wml/br-element-in-table-expected.png
new file mode 100644
index 0000000..bd98471
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/br-element-in-table-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/br-element-in-table-expected.txt b/LayoutTests/platform/mac/fast/wml/br-element-in-table-expected.txt
new file mode 100644
index 0000000..06e767c
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/br-element-in-table-expected.txt
@@ -0,0 +1,34 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x136
+  RenderBlock {wml} at (0,0) size 800x136
+    RenderBlock {card} at (8,16) size 784x112
+      RenderBlock {p} at (0,0) size 784x36
+        RenderText {#text} at (0,0) size 765x36
+          text run at (0,0) width 765: "This test case is used to test br element in a table. each cell is aligned to left, and the BR will break the \"xxxxxxxx\" text in"
+          text run at (0,18) width 60: "the last td"
+      RenderTable {table} at (0,52) size 155x60
+        RenderTableSection (anonymous) at (0,0) size 155x60
+          RenderTableRow {tr} at (0,2) size 155x18
+            RenderTableCell {td} at (2,2) size 53x18 [r=0 c=0 rs=1 cs=1]
+              RenderText {#text} at (0,0) size 53x18
+                text run at (0,0) width 53: "Cell one"
+            RenderTableCell {td} at (57,2) size 54x18 [r=0 c=1 rs=1 cs=1]
+              RenderText {#text} at (0,0) size 54x18
+                text run at (0,0) width 54: "Cell two"
+            RenderTableCell {td} at (113,2) size 40x18 [r=0 c=2 rs=1 cs=1]
+              RenderText {#text} at (0,0) size 15x18
+                text run at (0,0) width 15: "c3"
+          RenderTableRow {tr} at (0,22) size 155x36
+            RenderTableCell {td} at (2,31) size 53x18 [r=1 c=0 rs=1 cs=1]
+              RenderText {#text} at (0,0) size 33x18
+                text run at (0,0) width 33: "cell a"
+            RenderTableCell {td} at (57,31) size 54x18 [r=1 c=1 rs=1 cs=1]
+              RenderText {#text} at (0,0) size 34x18
+                text run at (0,0) width 34: "cell b"
+            RenderTableCell {td} at (113,22) size 40x36 [r=1 c=2 rs=1 cs=1]
+              RenderText {#text} at (0,0) size 40x18
+                text run at (0,0) width 40: "xxxxx"
+              RenderBR {br} at (40,0) size 0x18
+              RenderText {#text} at (0,18) size 24x18
+                text run at (0,18) width 24: "xxx"
diff --git a/LayoutTests/platform/mac/fast/wml/br-element-in-text-expected.checksum b/LayoutTests/platform/mac/fast/wml/br-element-in-text-expected.checksum
new file mode 100644
index 0000000..ad8619f
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/br-element-in-text-expected.checksum
@@ -0,0 +1 @@
+f403c86e34a8c67488a8d06d19e65495
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/br-element-in-text-expected.png b/LayoutTests/platform/mac/fast/wml/br-element-in-text-expected.png
new file mode 100644
index 0000000..2d24ab7
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/br-element-in-text-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/br-element-in-text-expected.txt b/LayoutTests/platform/mac/fast/wml/br-element-in-text-expected.txt
new file mode 100644
index 0000000..983af44
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/br-element-in-text-expected.txt
@@ -0,0 +1,14 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x94
+  RenderBlock {wml} at (0,0) size 800x94
+    RenderBlock {card} at (8,16) size 784x70
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 285x18
+          text run at (0,0) width 285: "This test case is used to test br element in text"
+      RenderBlock (anonymous) at (0,34) size 784x36
+        RenderText {#text} at (0,0) size 138x18
+          text run at (0,0) width 138: "This is a piece of text "
+        RenderBR {br} at (138,0) size 0x18
+        RenderText {#text} at (0,18) size 105x18
+          text run at (0,18) width 105: "with a line break"
diff --git a/LayoutTests/platform/mac/fast/wml/card-element-expected.checksum b/LayoutTests/platform/mac/fast/wml/card-element-expected.checksum
new file mode 100644
index 0000000..6131f3a
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/card-element-expected.checksum
@@ -0,0 +1 @@
+df65faf047f2ca47c89cebc781be7555
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/card-element-expected.png b/LayoutTests/platform/mac/fast/wml/card-element-expected.png
new file mode 100644
index 0000000..0da9778
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/card-element-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/card-element-expected.txt b/LayoutTests/platform/mac/fast/wml/card-element-expected.txt
new file mode 100644
index 0000000..5d078e6
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/card-element-expected.txt
@@ -0,0 +1,10 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x60
+  RenderBlock {wml} at (0,0) size 800x60
+    RenderBlock {card} at (8,8) size 784x18
+      RenderText {#text} at (0,0) size 100x18
+        text run at (0,0) width 100: "This is card one"
+    RenderBlock {card} at (8,34) size 784x18
+      RenderText {#text} at (0,0) size 101x18
+        text run at (0,0) width 101: "This is card two"
diff --git a/LayoutTests/platform/mac/fast/wml/case-sensitivity-expected.checksum b/LayoutTests/platform/mac/fast/wml/case-sensitivity-expected.checksum
new file mode 100644
index 0000000..79f40b4
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/case-sensitivity-expected.checksum
@@ -0,0 +1 @@
+b0bf81bdd1685a3928fd0227953db698
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/case-sensitivity-expected.png b/LayoutTests/platform/mac/fast/wml/case-sensitivity-expected.png
new file mode 100644
index 0000000..5090375
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/case-sensitivity-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/case-sensitivity-expected.txt b/LayoutTests/platform/mac/fast/wml/case-sensitivity-expected.txt
new file mode 100644
index 0000000..c6402eb
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/case-sensitivity-expected.txt
@@ -0,0 +1,30 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x170
+  RenderBlock {wml} at (0,0) size 800x170
+    RenderBlock {card} at (8,16) size 784x146
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 210x18
+          text run at (0,0) width 210: "Test for Case sensitivity in WML"
+      RenderBlock {p} at (0,34) size 784x36
+        RenderText {#text} at (0,0) size 426x18
+          text run at (0,0) width 426: "compare the result of inserting <br/> and <BR/> into the same text, "
+        RenderBR {br} at (426,0) size 0x18
+        RenderText {#text} at (0,18) size 289x18
+          text run at (0,18) width 289: "the former should work, and the latter doesn't."
+      RenderTable {table} at (0,86) size 188x60
+        RenderTableSection (anonymous) at (0,0) size 188x60
+          RenderTableRow {tr} at (0,2) size 188x36
+            RenderTableCell {td} at (2,2) size 184x36 [r=0 c=0 rs=1 cs=1]
+              RenderText {#text} at (0,0) size 62x18
+                text run at (0,0) width 62: "Test case "
+              RenderBR {br} at (62,0) size 0x18
+              RenderText {#text} at (0,18) size 122x18
+                text run at (0,18) width 122: "sensitivity in WML"
+          RenderTableRow {tr} at (0,40) size 188x18
+            RenderTableCell {td} at (2,40) size 184x18 [r=1 c=0 rs=1 cs=1]
+              RenderText {#text} at (0,0) size 62x18
+                text run at (0,0) width 62: "Test case "
+              RenderInline {BR} at (0,0) size 0x18
+              RenderText {#text} at (62,0) size 122x18
+                text run at (62,0) width 122: "sensitivity in WML"
diff --git a/LayoutTests/platform/mac/fast/wml/cdata-section-expected.checksum b/LayoutTests/platform/mac/fast/wml/cdata-section-expected.checksum
new file mode 100644
index 0000000..d22c169
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/cdata-section-expected.checksum
@@ -0,0 +1 @@
+167f3739274a1b2bfbac2c5c439f8f8e
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/cdata-section-expected.png b/LayoutTests/platform/mac/fast/wml/cdata-section-expected.png
new file mode 100644
index 0000000..f46b414
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/cdata-section-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/cdata-section-expected.txt b/LayoutTests/platform/mac/fast/wml/cdata-section-expected.txt
new file mode 100644
index 0000000..9055803
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/cdata-section-expected.txt
@@ -0,0 +1,15 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x94
+  RenderBlock {wml} at (0,0) size 800x94
+    RenderBlock {card} at (8,16) size 784x70
+      RenderBlock {p} at (0,0) size 784x36
+        RenderText {#text} at (0,0) size 220x18
+          text run at (0,0) width 220: "Test for CDATA Section in WML"
+        RenderBR {br} at (220,0) size 0x18
+        RenderText {#text} at (0,18) size 271x18
+          text run at (0,18) width 271: "If it passes, you can see the following text :"
+      RenderBlock (anonymous) at (0,52) size 784x18
+        RenderText {#cdata-section} at (0,0) size 172x18
+          text run at (0,0) width 172: "This is <B> a CDATA test"
+        RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/wml/comment-expected.checksum b/LayoutTests/platform/mac/fast/wml/comment-expected.checksum
new file mode 100644
index 0000000..0e9eafb
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/comment-expected.checksum
@@ -0,0 +1 @@
+d8c9298c48e37036d7e017ed7bcebca6
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/comment-expected.png b/LayoutTests/platform/mac/fast/wml/comment-expected.png
new file mode 100644
index 0000000..d5a597b
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/comment-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/comment-expected.txt b/LayoutTests/platform/mac/fast/wml/comment-expected.txt
new file mode 100644
index 0000000..39d3db6
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/comment-expected.txt
@@ -0,0 +1,12 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x102
+  RenderBlock {wml} at (0,0) size 800x102
+    RenderBlock {card} at (8,16) size 784x70
+      RenderBlock {p} at (0,0) size 784x36
+        RenderText {#text} at (0,0) size 743x36
+          text run at (0,0) width 743: "Test comment in WML, the text in the comment should not be displayed, if it passes, you can only see the text: \"Hello"
+          text run at (0,18) width 137: "World!\" after this line"
+      RenderBlock {p} at (0,52) size 784x18
+        RenderText {#text} at (0,0) size 84x18
+          text run at (0,0) width 84: "Hello World!"
diff --git a/LayoutTests/platform/mac/fast/wml/do-element-optional-attr-expected.checksum b/LayoutTests/platform/mac/fast/wml/do-element-optional-attr-expected.checksum
new file mode 100644
index 0000000..684f5a7
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/do-element-optional-attr-expected.checksum
@@ -0,0 +1 @@
+9ad8f0a55d4acf4e1e5e801798bc12b7
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/do-element-optional-attr-expected.png b/LayoutTests/platform/mac/fast/wml/do-element-optional-attr-expected.png
new file mode 100644
index 0000000..af613d1
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/do-element-optional-attr-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/do-element-optional-attr-expected.txt b/LayoutTests/platform/mac/fast/wml/do-element-optional-attr-expected.txt
new file mode 100644
index 0000000..138c1ff
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/do-element-optional-attr-expected.txt
@@ -0,0 +1,30 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x152
+  RenderBlock {wml} at (0,0) size 800x152
+    RenderBlock {card} at (8,16) size 784x52
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 181x18
+          text run at (0,0) width 181: "Test for do element in WML"
+      RenderBlock {p} at (0,34) size 784x18
+        RenderText {#text} at (0,0) size 731x18
+          text run at (0,0) width 731: "There are two do element in this card, the first one will display, the second won't because its optional attribute is true"
+      RenderBlock (anonymous) at (0,68) size 784x0
+        RenderInline {do} at (0,0) size 0x0 [bgcolor=#D3D3D3]
+          RenderText {#text} at (0,0) size 0x0
+          RenderInline {go} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+        RenderInline {do} at (0,0) size 0x0 [bgcolor=#D3D3D3]
+          RenderText {#text} at (0,0) size 0x0
+          RenderInline {go} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+    RenderBlock {card} at (8,84) size 784x18
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 144x18
+          text run at (0,0) width 144: "This is the second card"
+    RenderBlock {card} at (8,118) size 784x18
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 129x18
+          text run at (0,0) width 129: "This is the third card"
diff --git a/LayoutTests/platform/mac/fast/wml/do-shadow-expected.checksum b/LayoutTests/platform/mac/fast/wml/do-shadow-expected.checksum
new file mode 100644
index 0000000..619267d
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/do-shadow-expected.checksum
@@ -0,0 +1 @@
+90bfa862a685a39817e2e9c83d95c23d
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/do-shadow-expected.png b/LayoutTests/platform/mac/fast/wml/do-shadow-expected.png
new file mode 100644
index 0000000..2a06807
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/do-shadow-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/do-shadow-expected.txt b/LayoutTests/platform/mac/fast/wml/do-shadow-expected.txt
new file mode 100644
index 0000000..90672a6
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/do-shadow-expected.txt
@@ -0,0 +1,63 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x272
+  RenderBlock {wml} at (0,0) size 800x272
+    RenderBlock (anonymous) at (0,0) size 800x0
+      RenderInline {template} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+        RenderInline {do} at (0,0) size 0x0 [bgcolor=#D3D3D3]
+          RenderText {#text} at (0,0) size 0x0
+          RenderInline {prev} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+      RenderText {#text} at (0,0) size 0x0
+    RenderBlock {card} at (8,16) size 784x86
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 182x18
+          text run at (0,0) width 182: "Test for do-shadow in WML"
+      RenderBlock {p} at (0,34) size 784x18
+        RenderText {#text} at (0,0) size 329x18
+          text run at (0,0) width 329: "This is first card, which won't shadow deck-level do"
+      RenderBlock (anonymous) at (0,68) size 784x18
+        RenderInline {anchor} at (0,0) size 79x18
+          RenderText {#text} at (0,0) size 0x0
+          RenderInline {go} at (0,0) size 79x18
+            RenderText {#text} at (0,0) size 79x18
+              text run at (0,0) width 79: "Go to card 2"
+          RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+    RenderBlock {card} at (8,118) size 784x52
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 415x18
+          text run at (0,0) width 415: "deck-level do is shadowed with noop. It is not exposed to the user"
+      RenderBlock (anonymous) at (0,34) size 784x18
+        RenderInline {do} at (0,0) size 0x0 [bgcolor=#D3D3D3]
+          RenderText {#text} at (0,0) size 0x0
+          RenderInline {noop} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+        RenderInline {anchor} at (0,0) size 79x18
+          RenderText {#text} at (0,0) size 0x0
+          RenderInline {go} at (0,0) size 79x18
+            RenderText {#text} at (0,0) size 79x18
+              text run at (0,0) width 79: "Go to card 3"
+          RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+    RenderBlock {card} at (8,186) size 784x70
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 588x18
+          text run at (0,0) width 588: "deck-level do is shadowed. It is replaced by a card-level do because they have the same name"
+      RenderBlock {p} at (0,34) size 784x36
+        RenderInline {do} at (0,0) size 0x0 [bgcolor=#D3D3D3]
+          RenderText {#text} at (0,0) size 0x0
+          RenderInline {go} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+        RenderBR {br} at (0,0) size 0x18
+        RenderInline {anchor} at (0,0) size 79x18
+          RenderText {#text} at (0,0) size 0x0
+          RenderInline {go} at (0,0) size 79x18
+            RenderText {#text} at (0,18) size 79x18
+              text run at (0,18) width 79: "Go to card 1"
+          RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/wml/do-template-expected.checksum b/LayoutTests/platform/mac/fast/wml/do-template-expected.checksum
new file mode 100644
index 0000000..d9f8292
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/do-template-expected.checksum
@@ -0,0 +1 @@
+0a44d2752c5fdc0a5a0f7f7e7139a79f
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/do-template-expected.png b/LayoutTests/platform/mac/fast/wml/do-template-expected.png
new file mode 100644
index 0000000..de66093
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/do-template-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/do-template-expected.txt b/LayoutTests/platform/mac/fast/wml/do-template-expected.txt
new file mode 100644
index 0000000..26e4509
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/do-template-expected.txt
@@ -0,0 +1,61 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x416
+  RenderBlock {wml} at (0,0) size 800x416
+    RenderBlock (anonymous) at (0,0) size 800x0
+      RenderInline {template} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+        RenderInline {do} at (0,0) size 0x0 [bgcolor=#D3D3D3]
+          RenderText {#text} at (0,0) size 0x0
+          RenderInline {go} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+      RenderText {#text} at (0,0) size 0x0
+    RenderBlock {card} at (8,16) size 784x120
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 254x18
+          text run at (0,0) width 254: "Test for do element in template in WML"
+      RenderBlock {p} at (0,34) size 784x18
+        RenderText {#text} at (0,0) size 522x18
+          text run at (0,0) width 522: "Whichever card you entered, you can see the template do button because it's global"
+      RenderBlock {p} at (0,68) size 784x18
+        RenderText {#text} at (0,0) size 124x18
+          text run at (0,0) width 124: "This is the first card"
+      RenderBlock {p} at (0,102) size 784x18
+        RenderInline {anchor} at (0,0) size 75x18
+          RenderInline {go} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 75x18
+            text run at (0,0) width 75: "Go to card2"
+    RenderBlock {card} at (8,152) size 784x120
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 254x18
+          text run at (0,0) width 254: "Test for do element in template in WML"
+      RenderBlock {p} at (0,34) size 784x18
+        RenderText {#text} at (0,0) size 522x18
+          text run at (0,0) width 522: "Whichever card you entered, you can see the template do button because it's global"
+      RenderBlock {p} at (0,68) size 784x18
+        RenderText {#text} at (0,0) size 144x18
+          text run at (0,0) width 144: "This is the second card"
+      RenderBlock (anonymous) at (0,102) size 784x18
+        RenderInline {anchor} at (0,0) size 79x18
+          RenderText {#text} at (0,0) size 79x18
+            text run at (0,0) width 79: "Go to card 3"
+          RenderInline {go} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+    RenderBlock {card} at (8,288) size 784x120
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 254x18
+          text run at (0,0) width 254: "Test for do element in template in WML"
+      RenderBlock {p} at (0,34) size 784x18
+        RenderText {#text} at (0,0) size 522x18
+          text run at (0,0) width 522: "Whichever card you entered, you can see the template do button because it's global"
+      RenderBlock {p} at (0,68) size 784x18
+        RenderText {#text} at (0,0) size 129x18
+          text run at (0,0) width 129: "This is the third card"
+      RenderBlock (anonymous) at (0,102) size 784x18
+        RenderInline {anchor} at (0,0) size 33x18
+          RenderText {#text} at (0,0) size 33x18
+            text run at (0,0) width 33: "Back"
+          RenderInline {prev} at (0,0) size 0x18
+        RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/wml/entity-expected.checksum b/LayoutTests/platform/mac/fast/wml/entity-expected.checksum
new file mode 100644
index 0000000..3a228e3
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/entity-expected.checksum
@@ -0,0 +1 @@
+1f903e3a45108d7265245cdfa85c06a0
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/entity-expected.png b/LayoutTests/platform/mac/fast/wml/entity-expected.png
new file mode 100644
index 0000000..a5302c3
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/entity-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/entity-expected.txt b/LayoutTests/platform/mac/fast/wml/entity-expected.txt
new file mode 100644
index 0000000..c34195e
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/entity-expected.txt
@@ -0,0 +1,63 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x308
+  RenderBlock {html} at (0,0) size 800x308
+    RenderBody {body} at (8,16) size 784x284
+      RenderBlock {parsererror} at (16,0) size 752x148 [bgcolor=#FFDDDD] [border: (2px solid #CC7777)]
+        RenderBlock {h3} at (18,20) size 716x22
+          RenderText {#text} at (0,0) size 324x22
+            text run at (0,0) width 324: "This page contains the following errors:"
+        RenderBlock {div} at (18,60) size 716x28
+          RenderText {#text} at (0,0) size 399x28
+            text run at (0,0) width 399: "error on line 18 at column 109: Entity 'nbsp' not defined"
+            text run at (399,0) width 0: " "
+            text run at (0,14) width 392: "error on line 20 at column 125: Entity 'shy' not defined"
+            text run at (392,14) width 0: " "
+        RenderBlock {h3} at (18,106) size 716x22
+          RenderText {#text} at (0,0) size 429x22
+            text run at (0,0) width 429: "Below is a rendering of the page up to the first error."
+      RenderBlock (anonymous) at (0,164) size 784x0
+        RenderInline {wml} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+      RenderBlock (anonymous) at (0,164) size 784x120
+        RenderBlock {card} at (8,0) size 768x86
+          RenderBlock {p} at (0,0) size 768x18
+            RenderText {#text} at (0,0) size 193x18
+              text run at (0,0) width 193: "Test for Entities in WML page"
+          RenderBlock (anonymous) at (0,34) size 768x18
+            RenderText {#text} at (0,0) size 22x18
+              text run at (0,0) width 11: "\" "
+              text run at (11,0) width 11: "\" "
+            RenderInline {br} at (0,0) size 0x0
+            RenderText {#text} at (22,0) size 32x18
+              text run at (22,0) width 16: "& "
+              text run at (38,0) width 16: "& "
+            RenderInline {br} at (0,0) size 0x0
+            RenderText {#text} at (54,0) size 14x18
+              text run at (54,0) width 7: "' "
+              text run at (61,0) width 7: "' "
+            RenderInline {br} at (0,0) size 0x0
+            RenderText {#text} at (68,0) size 26x18
+              text run at (68,0) width 13: "< "
+              text run at (81,0) width 13: "< "
+            RenderInline {br} at (0,0) size 0x0
+            RenderText {#text} at (94,0) size 26x18
+              text run at (94,0) width 13: "> "
+              text run at (107,0) width 13: "> "
+            RenderInline {br} at (0,0) size 0x0
+            RenderText {#text} at (120,0) size 35x18
+              text run at (120,0) width 35: "== = "
+            RenderInline {br} at (0,0) size 0x0
+            RenderText {#text} at (155,0) size 72x18
+              text run at (155,0) width 48: "AAAA"
+              text run at (203,0) width 24: "AA"
+            RenderInline {br} at (0,0) size 0x0
+            RenderText {#text} at (0,0) size 0x0
+          RenderBlock {p} at (0,68) size 768x18
+            RenderText {#text} at (0,0) size 49x18
+              text run at (0,0) width 49: "<hello>"
+        RenderBlock {card} at (8,102) size 768x18
+          RenderText {#text} at (0,0) size 85x18
+            text run at (0,0) width 85: "This is card 2"
+      RenderBlock (anonymous) at (0,292) size 784x0
+        RenderInline {wml} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/wml/err-event-binding-conflict-expected.checksum b/LayoutTests/platform/mac/fast/wml/err-event-binding-conflict-expected.checksum
new file mode 100644
index 0000000..ecf5ba9
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-event-binding-conflict-expected.checksum
@@ -0,0 +1 @@
+6f780541d5c1d3eb12cf50cf3a519ebc
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/err-event-binding-conflict-expected.png b/LayoutTests/platform/mac/fast/wml/err-event-binding-conflict-expected.png
new file mode 100644
index 0000000..17f4b46
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-event-binding-conflict-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/err-event-binding-conflict-expected.txt b/LayoutTests/platform/mac/fast/wml/err-event-binding-conflict-expected.txt
new file mode 100644
index 0000000..5cf10f4
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-event-binding-conflict-expected.txt
@@ -0,0 +1,22 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x76
+  RenderBlock {wml} at (0,0) size 800x76
+    RenderBlock {card} at (8,16) size 784x52
+      RenderBlock (anonymous) at (0,0) size 784x0
+        RenderInline {onevent} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+          RenderInline {refresh} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+        RenderInline {onevent} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+          RenderInline {prev} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 248x18
+          text run at (0,0) width 248: "Test for the error event-binding conflict"
+      RenderBlock (anonymous) at (0,34) size 784x18
+        RenderText {#text} at (0,0) size 563x18
+          text run at (0,0) width 563: "You should NOT see this text, because of the error of event-binding error in card element"
diff --git a/LayoutTests/platform/mac/fast/wml/err-invalid-location-for-varref-expected.checksum b/LayoutTests/platform/mac/fast/wml/err-invalid-location-for-varref-expected.checksum
new file mode 100644
index 0000000..d720ab5
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-invalid-location-for-varref-expected.checksum
@@ -0,0 +1 @@
+157fe47cd5a8e7780368f6e7eb76a550
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/err-invalid-location-for-varref-expected.png b/LayoutTests/platform/mac/fast/wml/err-invalid-location-for-varref-expected.png
new file mode 100644
index 0000000..a9982d2
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-invalid-location-for-varref-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/err-invalid-location-for-varref-expected.txt b/LayoutTests/platform/mac/fast/wml/err-invalid-location-for-varref-expected.txt
new file mode 100644
index 0000000..6da6a59
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-invalid-location-for-varref-expected.txt
@@ -0,0 +1,20 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x84
+  RenderBlock {wml} at (0,0) size 800x84
+    RenderBlock {card} at (8,16) size 784x52
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 231x18
+          text run at (0,0) width 231: "Test for variable reference validation"
+      RenderBlock {p} at (0,34) size 784x18
+        RenderText {#text} at (0,0) size 645x18
+          text run at (0,0) width 645: "An error will occur when loading the card because the variable reference is placed in a invalid location"
+      RenderBlock (anonymous) at (0,68) size 784x0
+        RenderInline {do} at (0,0) size 0x0 [bgcolor=#D3D3D3]
+          RenderText {#text} at (0,0) size 0x0
+          RenderInline {refresh} at (0,0) size 0x0
+            RenderText {#text} at (0,0) size 0x0
+            RenderInline {setvar} at (0,0) size 0x0
+            RenderText {#text} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/wml/err-invalid-tablecolumn-number-expected.checksum b/LayoutTests/platform/mac/fast/wml/err-invalid-tablecolumn-number-expected.checksum
new file mode 100644
index 0000000..7dbd510
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-invalid-tablecolumn-number-expected.checksum
@@ -0,0 +1 @@
+92398d530c8e7bc4f3cb368196b0172f
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/err-invalid-tablecolumn-number-expected.png b/LayoutTests/platform/mac/fast/wml/err-invalid-tablecolumn-number-expected.png
new file mode 100644
index 0000000..1bd8654
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-invalid-tablecolumn-number-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/err-invalid-tablecolumn-number-expected.txt b/LayoutTests/platform/mac/fast/wml/err-invalid-tablecolumn-number-expected.txt
new file mode 100644
index 0000000..a27ef14
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-invalid-tablecolumn-number-expected.txt
@@ -0,0 +1,20 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x114
+  RenderBlock {wml} at (0,0) size 800x114
+    RenderBlock {card} at (8,16) size 784x90
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 252x18
+          text run at (0,0) width 252: "Test for table column number validation"
+      RenderBlock {p} at (0,34) size 784x18
+        RenderText {#text} at (0,0) size 538x18
+          text run at (0,0) width 538: "The table won't be displayed because of the invalid columns attruibte of table element"
+      RenderTable {table} at (0,68) size 82x22
+        RenderTableSection (anonymous) at (0,0) size 82x22
+          RenderTableRow {tr} at (0,2) size 82x18
+            RenderTableCell {td} at (2,2) size 38x18 [r=0 c=0 rs=1 cs=1]
+              RenderText {#text} at (0,0) size 38x18
+                text run at (0,0) width 38: "Cell 1"
+            RenderTableCell {td} at (42,2) size 38x18 [r=0 c=1 rs=1 cs=1]
+              RenderText {#text} at (0,0) size 38x18
+                text run at (0,0) width 38: "Cell 2"
diff --git a/LayoutTests/platform/mac/fast/wml/err-invalid-variable-name-expected.checksum b/LayoutTests/platform/mac/fast/wml/err-invalid-variable-name-expected.checksum
new file mode 100644
index 0000000..8b21a8b
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-invalid-variable-name-expected.checksum
@@ -0,0 +1 @@
+131183d1b978afcf6c978cd9465251d8
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/err-invalid-variable-name-expected.png b/LayoutTests/platform/mac/fast/wml/err-invalid-variable-name-expected.png
new file mode 100644
index 0000000..98c81d0
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-invalid-variable-name-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/err-invalid-variable-name-expected.txt b/LayoutTests/platform/mac/fast/wml/err-invalid-variable-name-expected.txt
new file mode 100644
index 0000000..8ca6700
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-invalid-variable-name-expected.txt
@@ -0,0 +1,17 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x50
+  RenderBlock {wml} at (0,0) size 800x50
+    RenderBlock {card} at (8,16) size 784x18
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 207x18
+          text run at (0,0) width 207: "Test for variable name validation"
+      RenderBlock (anonymous) at (0,34) size 784x0
+        RenderInline {do} at (0,0) size 0x0 [bgcolor=#D3D3D3]
+          RenderText {#text} at (0,0) size 0x0
+          RenderInline {refresh} at (0,0) size 0x0
+            RenderText {#text} at (0,0) size 0x0
+            RenderInline {setvar} at (0,0) size 0x0
+            RenderText {#text} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/wml/err-multi-access-expected.checksum b/LayoutTests/platform/mac/fast/wml/err-multi-access-expected.checksum
new file mode 100644
index 0000000..bcbb1fc
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-multi-access-expected.checksum
@@ -0,0 +1 @@
+977525a2b91990cd4954ff442f8e862d
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/err-multi-access-expected.png b/LayoutTests/platform/mac/fast/wml/err-multi-access-expected.png
new file mode 100644
index 0000000..5beada9
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-multi-access-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/err-multi-access-expected.txt b/LayoutTests/platform/mac/fast/wml/err-multi-access-expected.txt
new file mode 100644
index 0000000..567d1e9
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-multi-access-expected.txt
@@ -0,0 +1,11 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x76
+  RenderBlock {wml} at (0,0) size 800x76
+    RenderBlock {card} at (8,16) size 784x52
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 164x18
+          text run at (0,0) width 164: "Test for multi-access error"
+      RenderBlock (anonymous) at (0,34) size 784x18
+        RenderText {#text} at (0,0) size 508x18
+          text run at (0,0) width 508: "You should not see this text, because of the error of multi-access in head element"
diff --git a/LayoutTests/platform/mac/fast/wml/err-multi-http-equiv-in-meta-expected.checksum b/LayoutTests/platform/mac/fast/wml/err-multi-http-equiv-in-meta-expected.checksum
new file mode 100644
index 0000000..25528af
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-multi-http-equiv-in-meta-expected.checksum
@@ -0,0 +1 @@
+3464f213012dcfc5a7d495e34bf6e30c
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/err-multi-http-equiv-in-meta-expected.png b/LayoutTests/platform/mac/fast/wml/err-multi-http-equiv-in-meta-expected.png
new file mode 100644
index 0000000..474eecb
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-multi-http-equiv-in-meta-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/err-multi-http-equiv-in-meta-expected.txt b/LayoutTests/platform/mac/fast/wml/err-multi-http-equiv-in-meta-expected.txt
new file mode 100644
index 0000000..8f9c8e4
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-multi-http-equiv-in-meta-expected.txt
@@ -0,0 +1,19 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x166
+  RenderBlock {html} at (0,0) size 800x166
+    RenderBody {body} at (8,16) size 784x134
+      RenderBlock {parsererror} at (16,0) size 752x134 [bgcolor=#FFDDDD] [border: (2px solid #CC7777)]
+        RenderBlock {h3} at (18,20) size 716x22
+          RenderText {#text} at (0,0) size 324x22
+            text run at (0,0) width 324: "This page contains the following errors:"
+        RenderBlock {div} at (18,60) size 716x14
+          RenderText {#text} at (0,0) size 420x14
+            text run at (0,0) width 420: "error on line 5 at column 47: Attribute http-equiv redefined"
+            text run at (420,0) width 0: " "
+        RenderBlock {h3} at (18,92) size 716x22
+          RenderText {#text} at (0,0) size 429x22
+            text run at (0,0) width 429: "Below is a rendering of the page up to the first error."
+      RenderBlock (anonymous) at (0,150) size 784x0
+        RenderInline {wml} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/wml/err-multi-name-in-meta-expected.checksum b/LayoutTests/platform/mac/fast/wml/err-multi-name-in-meta-expected.checksum
new file mode 100644
index 0000000..6e155b0
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-multi-name-in-meta-expected.checksum
@@ -0,0 +1 @@
+f6c7e52218d4b964fcf439cfb656f34e
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/err-multi-name-in-meta-expected.png b/LayoutTests/platform/mac/fast/wml/err-multi-name-in-meta-expected.png
new file mode 100644
index 0000000..027a991
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-multi-name-in-meta-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/err-multi-name-in-meta-expected.txt b/LayoutTests/platform/mac/fast/wml/err-multi-name-in-meta-expected.txt
new file mode 100644
index 0000000..9762478
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-multi-name-in-meta-expected.txt
@@ -0,0 +1,19 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x166
+  RenderBlock {html} at (0,0) size 800x166
+    RenderBody {body} at (8,16) size 784x134
+      RenderBlock {parsererror} at (16,0) size 752x134 [bgcolor=#FFDDDD] [border: (2px solid #CC7777)]
+        RenderBlock {h3} at (18,20) size 716x22
+          RenderText {#text} at (0,0) size 324x22
+            text run at (0,0) width 324: "This page contains the following errors:"
+        RenderBlock {div} at (18,60) size 716x14
+          RenderText {#text} at (0,0) size 378x14
+            text run at (0,0) width 378: "error on line 5 at column 35: Attribute name redefined"
+            text run at (378,0) width 0: " "
+        RenderBlock {h3} at (18,92) size 716x22
+          RenderText {#text} at (0,0) size 429x22
+            text run at (0,0) width 429: "Below is a rendering of the page up to the first error."
+      RenderBlock (anonymous) at (0,150) size 784x0
+        RenderInline {wml} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/wml/err-multi-timer-expected.checksum b/LayoutTests/platform/mac/fast/wml/err-multi-timer-expected.checksum
new file mode 100644
index 0000000..4930a7a
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-multi-timer-expected.checksum
@@ -0,0 +1 @@
+ec325e125c7d147318bc7d519440914c
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/err-multi-timer-expected.png b/LayoutTests/platform/mac/fast/wml/err-multi-timer-expected.png
new file mode 100644
index 0000000..e9bc7c8
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-multi-timer-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/err-multi-timer-expected.txt b/LayoutTests/platform/mac/fast/wml/err-multi-timer-expected.txt
new file mode 100644
index 0000000..c0d64b0
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-multi-timer-expected.txt
@@ -0,0 +1,16 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x76
+  RenderBlock {wml} at (0,0) size 800x76
+    RenderBlock {card} at (8,16) size 784x52
+      RenderBlock (anonymous) at (0,0) size 784x0
+        RenderInline {timer} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+        RenderInline {timer} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 281x18
+          text run at (0,0) width 281: "Test for error of meta multi-timer in one card"
+      RenderBlock (anonymous) at (0,34) size 784x18
+        RenderText {#text} at (0,0) size 585x18
+          text run at (0,0) width 585: "You should NOT see this text, because of the error that more than one timer exist in one card"
diff --git a/LayoutTests/platform/mac/fast/wml/err-samename-do-expected.checksum b/LayoutTests/platform/mac/fast/wml/err-samename-do-expected.checksum
new file mode 100644
index 0000000..92e672f
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-samename-do-expected.checksum
@@ -0,0 +1 @@
+8796ce7673186a37e3dea6b5a772c0dd
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/err-samename-do-expected.png b/LayoutTests/platform/mac/fast/wml/err-samename-do-expected.png
new file mode 100644
index 0000000..ee16091
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-samename-do-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/err-samename-do-expected.txt b/LayoutTests/platform/mac/fast/wml/err-samename-do-expected.txt
new file mode 100644
index 0000000..ab51b47
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-samename-do-expected.txt
@@ -0,0 +1,22 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x76
+  RenderBlock {wml} at (0,0) size 800x76
+    RenderBlock {card} at (8,16) size 784x52
+      RenderBlock (anonymous) at (0,0) size 784x0
+        RenderInline {do} at (0,0) size 0x0 [bgcolor=#D3D3D3]
+          RenderText {#text} at (0,0) size 0x0
+          RenderInline {refresh} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+        RenderInline {do} at (0,0) size 0x0 [bgcolor=#D3D3D3]
+          RenderText {#text} at (0,0) size 0x0
+          RenderInline {refresh} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 399x18
+          text run at (0,0) width 399: "Test for the error that more than one do element has same name"
+      RenderBlock (anonymous) at (0,34) size 784x18
+        RenderText {#text} at (0,0) size 518x18
+          text run at (0,0) width 518: "You should NOT see this text, because of the error of name-conflict of do element"
diff --git a/LayoutTests/platform/mac/fast/wml/err-unallowed-task-in-anchor-expected.checksum b/LayoutTests/platform/mac/fast/wml/err-unallowed-task-in-anchor-expected.checksum
new file mode 100644
index 0000000..d20eeb5
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-unallowed-task-in-anchor-expected.checksum
@@ -0,0 +1 @@
+7fb8b89b45160c5aa01ae5e48d8a9cbe
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/err-unallowed-task-in-anchor-expected.png b/LayoutTests/platform/mac/fast/wml/err-unallowed-task-in-anchor-expected.png
new file mode 100644
index 0000000..95294c7
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-unallowed-task-in-anchor-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/err-unallowed-task-in-anchor-expected.txt b/LayoutTests/platform/mac/fast/wml/err-unallowed-task-in-anchor-expected.txt
new file mode 100644
index 0000000..f999601
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/err-unallowed-task-in-anchor-expected.txt
@@ -0,0 +1,17 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x76
+  RenderBlock {wml} at (0,0) size 800x76
+    RenderBlock {card} at (8,16) size 784x52
+      RenderBlock (anonymous) at (0,0) size 784x0
+        RenderInline {anchor} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+          RenderInline {noop} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 383x18
+          text run at (0,0) width 383: "Test for the error that specifying noop task to anchor element"
+      RenderBlock (anonymous) at (0,34) size 784x18
+        RenderText {#text} at (0,0) size 632x18
+          text run at (0,0) width 632: "You should NOT see this text, because of the error that specifying unallowed task to anchor element"
diff --git a/LayoutTests/platform/mac/fast/wml/img-localsrc-expected.checksum b/LayoutTests/platform/mac/fast/wml/img-localsrc-expected.checksum
new file mode 100644
index 0000000..53af00a
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/img-localsrc-expected.checksum
@@ -0,0 +1 @@
+be09d7960fa3768576306a65dc2d9a75
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/img-localsrc-expected.png b/LayoutTests/platform/mac/fast/wml/img-localsrc-expected.png
new file mode 100644
index 0000000..e82e3a85
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/img-localsrc-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/img-localsrc-expected.txt b/LayoutTests/platform/mac/fast/wml/img-localsrc-expected.txt
new file mode 100644
index 0000000..ba09be2
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/img-localsrc-expected.txt
@@ -0,0 +1,26 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x170
+  RenderBlock {wml} at (0,0) size 800x170
+    RenderBlock {card} at (8,16) size 784x138
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 189x18
+          text run at (0,0) width 189: "Test for img element in WML"
+      RenderBlock {p} at (0,34) size 784x18
+        RenderText {#text} at (0,0) size 369x18
+          text run at (0,0) width 369: "This image is specified by localsrc attribute of img element"
+      RenderBlock (anonymous) at (0,68) size 784x36
+        RenderText {#text} at (0,0) size 59x18
+          text run at (0,0) width 59: "test code:"
+        RenderText {#cdata-section} at (59,0) size 784x36
+          text run at (59,0) width 4: " "
+          text run at (63,0) width 721: "<p>Local<img height=\"60\" width=\"40\" vspace=\"40\" hspace=\"60\" align=\"middle\" localsrc=\"resources/smile.gif\""
+          text run at (0,18) width 157: "alt=\"smile\"/>Image</p> "
+        RenderText {#text} at (0,0) size 0x0
+        RenderBR {br} at (0,0) size 0x0
+      RenderBlock {p} at (0,120) size 784x18
+        RenderText {#text} at (0,0) size 36x18
+          text run at (0,0) width 36: "Local"
+        RenderInline {img} at (0,0) size 0x18
+        RenderText {#text} at (36,0) size 39x18
+          text run at (36,0) width 39: "Image"
diff --git a/LayoutTests/platform/mac/fast/wml/img-src-expected.checksum b/LayoutTests/platform/mac/fast/wml/img-src-expected.checksum
new file mode 100644
index 0000000..9e19cd5
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/img-src-expected.checksum
@@ -0,0 +1 @@
+b9bdcd6d0124b902aa6cd23ca01394d1
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/img-src-expected.png b/LayoutTests/platform/mac/fast/wml/img-src-expected.png
new file mode 100644
index 0000000..53b53eb
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/img-src-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/img-src-expected.txt b/LayoutTests/platform/mac/fast/wml/img-src-expected.txt
new file mode 100644
index 0000000..9a99347
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/img-src-expected.txt
@@ -0,0 +1,26 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x170
+  RenderBlock {wml} at (0,0) size 800x170
+    RenderBlock {card} at (8,16) size 784x138
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 189x18
+          text run at (0,0) width 189: "Test for img element in WML"
+      RenderBlock {p} at (0,34) size 784x18
+        RenderText {#text} at (0,0) size 339x18
+          text run at (0,0) width 339: "This image is specified by src attribute of img element"
+      RenderBlock (anonymous) at (0,68) size 784x36
+        RenderText {#text} at (0,0) size 59x18
+          text run at (0,0) width 59: "test code:"
+        RenderText {#cdata-section} at (59,0) size 616x36
+          text run at (59,0) width 4: " "
+          text run at (63,0) width 553: "<p>Network <img height=\"60\" width=\"40\" vspace=\"40\" hspace=\"60\" align=\"middle\""
+          text run at (0,18) width 388: "src=\"http://wap.baidu.com/logo.gif\" alt=\"smile\"/>Image</p> "
+        RenderText {#text} at (0,0) size 0x0
+        RenderBR {br} at (0,0) size 0x0
+      RenderBlock {p} at (0,120) size 784x18
+        RenderText {#text} at (0,0) size 60x18
+          text run at (0,0) width 60: "Network "
+        RenderInline {img} at (0,0) size 0x18
+        RenderText {#text} at (60,0) size 39x18
+          text run at (60,0) width 39: "Image"
diff --git a/LayoutTests/platform/mac/fast/wml/img-src-localsrc-alt-expected.checksum b/LayoutTests/platform/mac/fast/wml/img-src-localsrc-alt-expected.checksum
new file mode 100644
index 0000000..864843f
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/img-src-localsrc-alt-expected.checksum
@@ -0,0 +1 @@
+cdf7af33db178b73850afbf8263158eb
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/img-src-localsrc-alt-expected.png b/LayoutTests/platform/mac/fast/wml/img-src-localsrc-alt-expected.png
new file mode 100644
index 0000000..70fb879
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/img-src-localsrc-alt-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/img-src-localsrc-alt-expected.txt b/LayoutTests/platform/mac/fast/wml/img-src-localsrc-alt-expected.txt
new file mode 100644
index 0000000..67f29ff
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/img-src-localsrc-alt-expected.txt
@@ -0,0 +1,38 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x208
+  RenderBlock {wml} at (0,0) size 800x208
+    RenderBlock {card} at (8,16) size 784x176
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 189x18
+          text run at (0,0) width 189: "Test for img element in WML"
+      RenderBlock {p} at (0,34) size 784x18
+        RenderText {#text} at (0,0) size 487x18
+          text run at (0,0) width 487: "This image can be specified by both src and localsrc attributes of img element"
+      RenderBlock {p} at (0,68) size 784x108
+        RenderText {#text} at (0,0) size 289x18
+          text run at (0,0) width 289: "1) localsrc takes precedence over src attribute "
+        RenderBR {br} at (289,0) size 0x18
+        RenderText {#text} at (0,18) size 39x18
+          text run at (0,18) width 39: "Image"
+        RenderInline {img} at (0,0) size 0x18
+        RenderText {#text} at (39,18) size 43x18
+          text run at (39,18) width 43: "Image "
+        RenderBR {br} at (0,0) size 0x0
+        RenderText {#text} at (0,36) size 277x18
+          text run at (0,36) width 277: "2) localsrc can't locate the image, src works "
+        RenderBR {br} at (277,36) size 0x18
+        RenderText {#text} at (0,54) size 39x18
+          text run at (0,54) width 39: "Image"
+        RenderInline {img} at (0,0) size 0x18
+        RenderText {#text} at (39,54) size 43x18
+          text run at (39,54) width 43: "Image "
+        RenderBR {br} at (0,0) size 0x0
+        RenderText {#text} at (0,72) size 361x18
+          text run at (0,72) width 361: "3) neither localsrc nor src can locate the image, alt works "
+        RenderBR {br} at (361,72) size 0x18
+        RenderText {#text} at (0,90) size 39x18
+          text run at (0,90) width 39: "Image"
+        RenderInline {img} at (0,0) size 0x18
+        RenderText {#text} at (39,90) size 39x18
+          text run at (39,90) width 39: "Image"
diff --git a/LayoutTests/platform/mac/fast/wml/p-align-expected.checksum b/LayoutTests/platform/mac/fast/wml/p-align-expected.checksum
new file mode 100644
index 0000000..deee1ac
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/p-align-expected.checksum
@@ -0,0 +1 @@
+38b7a16644a71c930596fd519cb9bc83
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/p-align-expected.png b/LayoutTests/platform/mac/fast/wml/p-align-expected.png
new file mode 100644
index 0000000..9285ad9
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/p-align-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/p-align-expected.txt b/LayoutTests/platform/mac/fast/wml/p-align-expected.txt
new file mode 100644
index 0000000..c1fdc44
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/p-align-expected.txt
@@ -0,0 +1,47 @@
+layer at (0,0) size 1176x585
+  RenderView at (0,0) size 800x585
+layer at (0,0) size 1176x470
+  RenderBlock {wml} at (0,0) size 800x470
+    RenderBlock {card} at (8,16) size 784x438
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 280x18
+          text run at (0,0) width 280: "Test for align attribute of p element in WML"
+      RenderBlock (anonymous) at (0,34) size 784x36
+        RenderBR {br} at (0,0) size 0x18
+        RenderText {#cdata-section} at (0,18) size 122x18
+          text run at (0,18) width 122: "<p align=\"center\">"
+        RenderText {#text} at (0,0) size 0x0
+      RenderBlock {p} at (0,86) size 784x72
+        RenderText {#text} at (10,0) size 763x54
+          text run at (10,0) width 763: "Here you can learn various mobile technologies like WAP / WAP 2.0, WML, WMLScript, XHTML MP, WCSS / WAP"
+          text run at (16,18) width 752: "CSS, UAProf and SMS through our free tutorials, articles and examples. This web site can help web programmers who"
+          text run at (221,36) width 341: "wish to extend their knowledge to the wireless world. "
+        RenderBR {br} at (0,0) size 0x0
+        RenderText {#text} at (0,54) size 1168x18
+          text run at (0,54) width 1168: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
+      RenderBlock (anonymous) at (0,174) size 784x36
+        RenderBR {br} at (0,0) size 0x18
+        RenderText {#cdata-section} at (0,18) size 113x18
+          text run at (0,18) width 113: "<p align=\"right\">"
+        RenderText {#text} at (0,0) size 0x0
+      RenderBlock {p} at (0,226) size 784x72
+        RenderText {#text} at (21,0) size 763x54
+          text run at (21,0) width 763: "Here you can learn various mobile technologies like WAP / WAP 2.0, WML, WMLScript, XHTML MP, WCSS / WAP"
+          text run at (32,18) width 752: "CSS, UAProf and SMS through our free tutorials, articles and examples. This web site can help web programmers who"
+          text run at (443,36) width 341: "wish to extend their knowledge to the wireless world. "
+        RenderBR {br} at (0,0) size 0x0
+        RenderText {#text} at (0,54) size 1168x18
+          text run at (0,54) width 1168: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
+      RenderBlock (anonymous) at (0,314) size 784x36
+        RenderBR {br} at (0,0) size 0x18
+        RenderText {#cdata-section} at (0,18) size 104x18
+          text run at (0,18) width 104: "<p align=\"left\">"
+        RenderText {#text} at (0,0) size 0x0
+      RenderBlock {p} at (0,366) size 784x72
+        RenderText {#text} at (0,0) size 763x54
+          text run at (0,0) width 763: "Here you can learn various mobile technologies like WAP / WAP 2.0, WML, WMLScript, XHTML MP, WCSS / WAP"
+          text run at (0,18) width 752: "CSS, UAProf and SMS through our free tutorials, articles and examples. This web site can help web programmers who"
+          text run at (0,36) width 341: "wish to extend their knowledge to the wireless world. "
+        RenderBR {br} at (0,0) size 0x0
+        RenderText {#text} at (0,54) size 1168x18
+          text run at (0,54) width 1168: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
diff --git a/LayoutTests/platform/mac/fast/wml/p-mode-expected.checksum b/LayoutTests/platform/mac/fast/wml/p-mode-expected.checksum
new file mode 100644
index 0000000..d98956f
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/p-mode-expected.checksum
@@ -0,0 +1 @@
+54fe0aba81228be1a2af56b9eb5cb68c
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/p-mode-expected.png b/LayoutTests/platform/mac/fast/wml/p-mode-expected.png
new file mode 100644
index 0000000..161a5e5
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/p-mode-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/p-mode-expected.txt b/LayoutTests/platform/mac/fast/wml/p-mode-expected.txt
new file mode 100644
index 0000000..3467374
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/p-mode-expected.txt
@@ -0,0 +1,54 @@
+layer at (0,0) size 1964x585
+  RenderView at (0,0) size 800x585
+layer at (0,0) size 1964x492
+  RenderBlock {wml} at (0,0) size 800x492
+    RenderBlock {card} at (8,8) size 784x468
+      RenderBlock (anonymous) at (0,0) size 784x18
+        RenderText {#cdata-section} at (0,0) size 314x18
+          text run at (0,0) width 314: "<p> default mode is \"wrap\" for the first p element"
+        RenderText {#text} at (0,0) size 0x0
+      RenderBlock {p} at (0,34) size 784x18
+        RenderText {#text} at (0,0) size 284x18
+          text run at (0,0) width 284: "Test for mode attribute of p element in WML"
+      RenderBlock (anonymous) at (0,68) size 784x36
+        RenderBR {br} at (0,0) size 0x18
+        RenderText {#cdata-section} at (0,18) size 348x18
+          text run at (0,18) width 348: "<p> it will use the mode of previous paragraph element"
+        RenderText {#text} at (0,0) size 0x0
+      RenderBlock {p} at (0,120) size 784x72
+        RenderText {#text} at (0,0) size 763x54
+          text run at (0,0) width 763: "Here you can learn various mobile technologies like WAP / WAP 2.0, WML, WMLScript, XHTML MP, WCSS / WAP"
+          text run at (0,18) width 752: "CSS, UAProf and SMS through our free tutorials, articles and examples. This web site can help web programmers who"
+          text run at (0,36) width 341: "wish to extend their knowledge to the wireless world. "
+        RenderBR {br} at (0,0) size 0x0
+        RenderText {#text} at (0,54) size 1956x18
+          text run at (0,54) width 1956: "HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH"
+      RenderBlock (anonymous) at (0,208) size 784x36
+        RenderBR {br} at (0,0) size 0x18
+        RenderText {#cdata-section} at (0,18) size 136x18
+          text run at (0,18) width 136: "<p mode=\"nowrap\">"
+        RenderText {#text} at (0,0) size 0x0
+      RenderBlock {p} at (0,260) size 784x36
+        RenderText {#text} at (0,0) size 1860x18
+          text run at (0,0) width 1860: "Here you can learn various mobile technologies like WAP / WAP 2.0, WML, WMLScript, XHTML MP, WCSS / WAP CSS, UAProf and SMS through our free tutorials, articles and examples. This web site can help web programmers who wish to extend their knowledge to the wireless world."
+        RenderBR {br} at (0,0) size 0x0
+        RenderText {#text} at (0,18) size 1956x18
+          text run at (0,18) width 1956: "HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH"
+      RenderBlock (anonymous) at (0,312) size 784x18
+        RenderText {#cdata-section} at (0,0) size 296x18
+          text run at (0,0) width 296: "The next two paragraphs shouldn't be wrapped"
+        RenderText {#text} at (0,0) size 0x0
+      RenderBlock {p} at (0,346) size 784x36
+        RenderText {#text} at (0,0) size 1860x18
+          text run at (0,0) width 1860: "Here you can learn various mobile technologies like WAP / WAP 2.0, WML, WMLScript, XHTML MP, WCSS / WAP CSS, UAProf and SMS through our free tutorials, articles and examples. This web site can help web programmers who wish to extend their knowledge to the wireless world."
+        RenderBR {br} at (0,0) size 0x0
+        RenderText {#text} at (0,18) size 1956x18
+          text run at (0,18) width 1956: "HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH"
+      RenderBlock (anonymous) at (0,398) size 784x18
+        RenderBR {br} at (0,0) size 0x18
+      RenderBlock {p} at (0,432) size 784x36
+        RenderText {#text} at (0,0) size 1860x18
+          text run at (0,0) width 1860: "Here you can learn various mobile technologies like WAP / WAP 2.0, WML, WMLScript, XHTML MP, WCSS / WAP CSS, UAProf and SMS through our free tutorials, articles and examples. This web site can help web programmers who wish to extend their knowledge to the wireless world."
+        RenderBR {br} at (0,0) size 0x0
+        RenderText {#text} at (0,18) size 1956x18
+          text run at (0,18) width 1956: "HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH"
diff --git a/LayoutTests/platform/mac/fast/wml/show-first-card-expected.checksum b/LayoutTests/platform/mac/fast/wml/show-first-card-expected.checksum
new file mode 100644
index 0000000..59d5e90
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/show-first-card-expected.checksum
@@ -0,0 +1 @@
+3bf6fbdfca6b949976a3232c4d32b61a
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/show-first-card-expected.png b/LayoutTests/platform/mac/fast/wml/show-first-card-expected.png
new file mode 100644
index 0000000..f3d5aea
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/show-first-card-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/show-first-card-expected.txt b/LayoutTests/platform/mac/fast/wml/show-first-card-expected.txt
new file mode 100644
index 0000000..606bf20
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/show-first-card-expected.txt
@@ -0,0 +1,14 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x102
+  RenderBlock {wml} at (0,0) size 800x102
+    RenderBlock {card} at (8,16) size 784x52
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 674x18
+          text run at (0,0) width 674: "Test for showing the first card of wml deck in default when you doesn't specify any correct URL fragment."
+      RenderBlock (anonymous) at (0,34) size 784x18
+        RenderText {#text} at (0,0) size 261x18
+          text run at (0,0) width 261: "If the test passes, you should see this text."
+    RenderBlock {card} at (8,76) size 784x18
+      RenderText {#text} at (0,0) size 431x18
+        text run at (0,0) width 431: "This is card 2, you should NOT see these text while running this test"
diff --git a/LayoutTests/platform/mac/fast/wml/table-element-expected.checksum b/LayoutTests/platform/mac/fast/wml/table-element-expected.checksum
new file mode 100644
index 0000000..911313d
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/table-element-expected.checksum
@@ -0,0 +1 @@
+d3ea90efb57be3e0a6c431a6b283709c
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/table-element-expected.png b/LayoutTests/platform/mac/fast/wml/table-element-expected.png
new file mode 100644
index 0000000..d820415
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/table-element-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/table-element-expected.txt b/LayoutTests/platform/mac/fast/wml/table-element-expected.txt
new file mode 100644
index 0000000..05204aa
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/table-element-expected.txt
@@ -0,0 +1,54 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x230
+  RenderBlock {wml} at (0,0) size 800x230
+    RenderBlock {card} at (8,16) size 784x198
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 195x18
+          text run at (0,0) width 195: "Test for table element in WML"
+      RenderBlock {p} at (0,34) size 784x18
+        RenderText {#text} at (0,0) size 79x18
+          text run at (0,0) width 79: "source code:"
+      RenderBlock (anonymous) at (0,68) size 784x36
+        RenderText {#cdata-section} at (0,0) size 765x36
+          text run at (0,0) width 230: "<table columns=\"3\" align=\"LRR\"> "
+          text run at (230,0) width 31: "<tr> "
+          text run at (261,0) width 121: "<td>Cell one</td> "
+          text run at (382,0) width 192: "<td>C<br/>ell<br/> two</td> "
+          text run at (574,0) width 129: "<td>Cell three</td> "
+          text run at (703,0) width 35: "</tr> "
+          text run at (738,0) width 27: "<tr>"
+          text run at (0,18) width 99: "<td> one </td> "
+          text run at (99,18) width 38: "<td/> "
+          text run at (137,18) width 114: "<td>C three</td> "
+          text run at (251,18) width 35: "</tr> "
+          text run at (286,18) width 56: "</table> "
+        RenderText {#text} at (0,0) size 0x0
+        RenderBR {br} at (0,0) size 0x0
+      RenderBlock {p} at (0,120) size 784x78
+        RenderTable {table} at (0,0) size 146x78
+          RenderTableSection (anonymous) at (0,0) size 146x78
+            RenderTableRow {tr} at (0,2) size 146x54
+              RenderTableCell {td} at (2,20) size 53x18 [r=0 c=0 rs=1 cs=1]
+                RenderText {#text} at (0,0) size 53x18
+                  text run at (0,0) width 53: "Cell one"
+              RenderTableCell {td} at (57,2) size 24x54 [r=0 c=1 rs=1 cs=1]
+                RenderText {#text} at (0,0) size 11x18
+                  text run at (0,0) width 11: "C"
+                RenderBR {br} at (11,0) size 0x18
+                RenderText {#text} at (0,18) size 15x18
+                  text run at (0,18) width 15: "ell"
+                RenderBR {br} at (15,18) size 0x18
+                RenderText {#text} at (0,36) size 24x18
+                  text run at (0,36) width 24: "two"
+              RenderTableCell {td} at (83,20) size 61x18 [r=0 c=2 rs=1 cs=1]
+                RenderText {#text} at (0,0) size 61x18
+                  text run at (0,0) width 61: "Cell three"
+            RenderTableRow {tr} at (0,58) size 146x18
+              RenderTableCell {td} at (2,58) size 53x18 [r=1 c=0 rs=1 cs=1]
+                RenderText {#text} at (0,0) size 23x18
+                  text run at (0,0) width 23: "one"
+              RenderTableCell {td} at (57,67) size 24x0 [r=1 c=1 rs=1 cs=1]
+              RenderTableCell {td} at (83,58) size 61x18 [r=1 c=2 rs=1 cs=1]
+                RenderText {#text} at (0,0) size 46x18
+                  text run at (0,0) width 46: "C three"
diff --git a/LayoutTests/platform/mac/fast/wml/test-expected.checksum b/LayoutTests/platform/mac/fast/wml/test-expected.checksum
new file mode 100644
index 0000000..827d25e
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/test-expected.checksum
@@ -0,0 +1 @@
+1144001144f895f1202acf3d37bf64de
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/test-expected.png b/LayoutTests/platform/mac/fast/wml/test-expected.png
new file mode 100644
index 0000000..21675f2
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/test-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/test-expected.txt b/LayoutTests/platform/mac/fast/wml/test-expected.txt
new file mode 100644
index 0000000..c8ace89
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/test-expected.txt
@@ -0,0 +1,17 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x110
+  RenderBlock {wml} at (0,0) size 800x110
+    RenderBlock {card} at (8,16) size 784x86
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 375x18
+          text run at (0,0) width 375: "This page is assistant page. Many test pages will jump here."
+      RenderBlock {p} at (0,34) size 784x18
+        RenderText {#text} at (0,0) size 286x18
+          text run at (0,0) width 286: "Click \"Back\" to go back to the previous page"
+      RenderBlock (anonymous) at (0,68) size 784x18
+        RenderInline {anchor} at (0,0) size 33x18
+          RenderText {#text} at (0,0) size 33x18
+            text run at (0,0) width 33: "Back"
+          RenderInline {prev} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/wml/text-emphasis-expected.checksum b/LayoutTests/platform/mac/fast/wml/text-emphasis-expected.checksum
new file mode 100644
index 0000000..7542043
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/text-emphasis-expected.checksum
@@ -0,0 +1 @@
+587f8add732b9668a09c17c198a92194
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/text-emphasis-expected.png b/LayoutTests/platform/mac/fast/wml/text-emphasis-expected.png
new file mode 100644
index 0000000..ec0bb81
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/text-emphasis-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/text-emphasis-expected.txt b/LayoutTests/platform/mac/fast/wml/text-emphasis-expected.txt
new file mode 100644
index 0000000..662ea14
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/text-emphasis-expected.txt
@@ -0,0 +1,40 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x214
+  RenderBlock {wml} at (0,0) size 800x214
+    RenderBlock {card} at (8,16) size 784x182
+      RenderBlock {p} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 198x18
+          text run at (0,0) width 198: "Test for text emphasis of WML"
+      RenderBlock {p} at (0,34) size 784x148
+        RenderText {#text} at (0,0) size 44x18
+          text run at (0,0) width 44: "normal"
+        RenderBR {br} at (44,0) size 0x18
+        RenderInline {em} at (0,0) size 74x18
+          RenderText {#text} at (0,18) size 74x18
+            text run at (0,18) width 74: "emphasized"
+        RenderBR {br} at (74,18) size 0x18
+        RenderInline {strong} at (0,0) size 43x18
+          RenderText {#text} at (0,36) size 43x18
+            text run at (0,36) width 43: "strong"
+        RenderBR {br} at (43,36) size 0x18
+        RenderInline {b} at (0,0) size 30x18
+          RenderText {#text} at (0,54) size 30x18
+            text run at (0,54) width 30: "bold"
+        RenderBR {br} at (30,54) size 0x18
+        RenderInline {i} at (0,0) size 31x18
+          RenderText {#text} at (0,72) size 31x18
+            text run at (0,72) width 31: "italic"
+        RenderBR {br} at (31,72) size 0x18
+        RenderInline {u} at (0,0) size 59x18
+          RenderText {#text} at (0,90) size 59x18
+            text run at (0,90) width 59: "underline"
+        RenderBR {br} at (59,90) size 0x18
+        RenderInline {big} at (0,0) size 25x22
+          RenderText {#text} at (0,108) size 25x22
+            text run at (0,108) width 25: "big"
+        RenderBR {br} at (25,111) size 0x18
+        RenderInline {small} at (0,0) size 29x15
+          RenderText {#text} at (0,132) size 29x15
+            text run at (0,132) width 29: "small"
+        RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/wml/validate-dtd-expected.checksum b/LayoutTests/platform/mac/fast/wml/validate-dtd-expected.checksum
new file mode 100644
index 0000000..a4859bb
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/validate-dtd-expected.checksum
@@ -0,0 +1 @@
+aa323d9db98617f8b54f395d1b17dd7d
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/wml/validate-dtd-expected.png b/LayoutTests/platform/mac/fast/wml/validate-dtd-expected.png
new file mode 100644
index 0000000..fbba0c7
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/validate-dtd-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/wml/validate-dtd-expected.txt b/LayoutTests/platform/mac/fast/wml/validate-dtd-expected.txt
new file mode 100644
index 0000000..cfdf113
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/wml/validate-dtd-expected.txt
@@ -0,0 +1,15 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x166
+  RenderBlock {html} at (0,0) size 800x166
+    RenderBody {body} at (8,16) size 784x134
+      RenderBlock {parsererror} at (16,0) size 752x134 [bgcolor=#FFDDDD] [border: (2px solid #CC7777)]
+        RenderBlock {h3} at (18,20) size 716x22
+          RenderText {#text} at (0,0) size 324x22
+            text run at (0,0) width 324: "This page contains the following errors:"
+        RenderBlock {div} at (18,60) size 716x14
+          RenderText {#text} at (0,0) size 364x14
+            text run at (0,0) width 364: "error on line 2 at column 103: Invalid DTD Public ID"
+        RenderBlock {h3} at (18,92) size 716x22
+          RenderText {#text} at (0,0) size 429x22
+            text run at (0,0) width 429: "Below is a rendering of the page up to the first error."
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 8629ed7..9bf10cd 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,51 @@
+2008-11-18  Nikolas Zimmermann  <nikolas.zimmermann@torchmobile.com>
+
+        Reviewed by Sam Weinig.
+
+        Fixes: https://bugs.webkit.org/show_bug.cgi?id=22334
+
+        Add WMLBRElement, correcting <br/> behaviour in WML.
+        Enable entity replacment for WML documents.
+        Handle WML specific <p> 'mode' attribute.
+
+        Generate layout tests results for fast/wml.
+
+        Tests cases that pass now:
+        fast/wml/br-element-in-table.wml
+        fast/wml/br-element-in-text.wml
+        fast/wml/case-sensitivity.wml
+        fast/wml/cdata-section.wml
+        fast/wml/comment.wml
+        fast/wml/entity.wml
+        fast/wml/p-align.wml
+        fast/wml/p-mode.wml
+        fast/wml/text-emphasis.wml
+        fast/wml/validate-dtd.wml
+
+        * GNUmakefile.am:
+        * WebCore.pro:
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/XMLTokenizer.cpp:
+        (WebCore::XMLTokenizer::isWMLDocument):
+        (WebCore::XMLTokenizer::insertErrorMessageBlock):
+        * dom/XMLTokenizer.h:
+        * dom/XMLTokenizerLibxml2.cpp:
+        (WebCore::XMLTokenizer::internalSubset):
+        (WebCore::getEntityHandler):
+        * dom/XMLTokenizerQt.cpp:
+        (WebCore::XMLTokenizer::parse):
+        * wml/WMLBRElement.cpp: Added.
+        (WebCore::WMLBRElement::WMLBRElement):
+        (WebCore::WMLBRElement::mapToEntry):
+        (WebCore::WMLBRElement::parseMappedAttribute):
+        (WebCore::WMLBRElement::createRenderer):
+        * wml/WMLBRElement.h: Added.
+        * wml/WMLPElement.cpp:
+        (WebCore::WMLPElement::parseMappedAttribute):
+        (WebCore::WMLPElement::insertedIntoDocument):
+        * wml/WMLPElement.h:
+        * wml/WMLTagNames.in:
+
 2008-11-18  Aaron Boodman  aa@chromium.org
 
         Reviewed by Maciej Stachowiak.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index d4d90bb..a875611 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -2785,6 +2785,7 @@
 
 webcore_sources += \
 	WebCore/wml/WMLAElement.cpp \
+	WebCore/wml/WMLBRElement.cpp \
 	WebCore/wml/WMLCardElement.cpp \
 	WebCore/wml/WMLElement.cpp \
 	WebCore/wml/WMLDocument.cpp \
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 01adc7e..e75c7b46 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -1370,6 +1370,7 @@
 contains(DEFINES, ENABLE_WML=1) {
     SOURCES += \
         wml/WMLAElement.cpp \
+        wml/WMLBRElement.cpp \
         wml/WMLCardElement.cpp \
         wml/WMLElement.cpp \
         wml/WMLDocument.cpp \
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 92a4197..9f92bd0 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -55,6 +55,8 @@
 		088C977C0ECB6E29000534BA /* WMLTagNames.in in Resources */ = {isa = PBXBuildFile; fileRef = 4C6B99430E52E37300487BB7 /* WMLTagNames.in */; };
 		089582550E857A7E00F82C83 /* ImageLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 089582530E857A7E00F82C83 /* ImageLoader.cpp */; };
 		089582560E857A7E00F82C83 /* ImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 089582540E857A7E00F82C83 /* ImageLoader.h */; };
+		0897C14C0ED2EBA500AE06DB /* WMLBRElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0897C14A0ED2EBA400AE06DB /* WMLBRElement.cpp */; };
+		0897C14D0ED2EBA500AE06DB /* WMLBRElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 0897C14B0ED2EBA400AE06DB /* WMLBRElement.h */; };
 		08A484770E5272C500C3FE76 /* ScriptElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08A484750E5272C500C3FE76 /* ScriptElement.cpp */; };
 		08A484780E5272C500C3FE76 /* ScriptElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 08A484760E5272C500C3FE76 /* ScriptElement.h */; };
 		08A48A6E0E86CF6D00E225DD /* JSSVGElementInstanceCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08A48A6D0E86CF6D00E225DD /* JSSVGElementInstanceCustom.cpp */; };
@@ -4773,6 +4775,8 @@
 		0893E4660ECB68F400A28563 /* WMLPageState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLPageState.h; sourceTree = "<group>"; };
 		089582530E857A7E00F82C83 /* ImageLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageLoader.cpp; sourceTree = "<group>"; };
 		089582540E857A7E00F82C83 /* ImageLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageLoader.h; sourceTree = "<group>"; };
+		0897C14A0ED2EBA400AE06DB /* WMLBRElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLBRElement.cpp; sourceTree = "<group>"; };
+		0897C14B0ED2EBA400AE06DB /* WMLBRElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLBRElement.h; sourceTree = "<group>"; };
 		08A484750E5272C500C3FE76 /* ScriptElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptElement.cpp; sourceTree = "<group>"; };
 		08A484760E5272C500C3FE76 /* ScriptElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptElement.h; sourceTree = "<group>"; };
 		08A48A6D0E86CF6D00E225DD /* JSSVGElementInstanceCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGElementInstanceCustom.cpp; sourceTree = "<group>"; };
@@ -9428,6 +9432,8 @@
 			children = (
 				4C6B99180E52E37300487BB7 /* WMLAElement.cpp */,
 				4C6B99190E52E37300487BB7 /* WMLAElement.h */,
+				0897C14A0ED2EBA400AE06DB /* WMLBRElement.cpp */,
+				0897C14B0ED2EBA400AE06DB /* WMLBRElement.h */,
 				4C6B991C0E52E37300487BB7 /* WMLAttributeNames.in */,
 				4C6B991F0E52E37300487BB7 /* WMLCardElement.cpp */,
 				4C6B99200E52E37300487BB7 /* WMLCardElement.h */,
@@ -16296,6 +16302,7 @@
 				E108224B0EC3153A00E93953 /* WorkerTask.h in Headers */,
 				0FD723820EC8BD9300CA5DD7 /* FloatQuad.h in Headers */,
 				E14799A70ECDE3A400292BF3 /* WorkerMessagingProxy.h in Headers */,
+				0897C14D0ED2EBA500AE06DB /* WMLBRElement.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -18215,6 +18222,7 @@
 				E108224F0EC3156700E93953 /* WorkerTask.cpp in Sources */,
 				0FD723830EC8BD9300CA5DD7 /* FloatQuad.cpp in Sources */,
 				E14799B40ECDE9D800292BF3 /* WorkerMessagingProxy.cpp in Sources */,
+				0897C14C0ED2EBA500AE06DB /* WMLBRElement.cpp in Sources */,
 				E182504F0ED2F20200499A8F /* FrameLoaderClient.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
diff --git a/WebCore/dom/XMLTokenizer.cpp b/WebCore/dom/XMLTokenizer.cpp
index fcc5adf8..4dcd35e 100644
--- a/WebCore/dom/XMLTokenizer.cpp
+++ b/WebCore/dom/XMLTokenizer.cpp
@@ -90,6 +90,16 @@
     return 0;
 }
 
+#if ENABLE(WML)
+bool XMLTokenizer::isWMLDocument() const
+{
+    if (m_doc)
+        return m_doc->isWMLDocument();
+
+    return false;
+}
+#endif
+
 void XMLTokenizer::setCurrentNode(Node* n)
 {
     bool nodeNeedsReference = n && n != m_doc;
@@ -285,7 +295,7 @@
     }
 #endif
 #if ENABLE(WML)
-    else if (doc->isWMLDocument()) {
+    else if (isWMLDocument()) {
         RefPtr<Node> rootElement = doc->createElementNS(HTMLNames::xhtmlNamespaceURI, "html", ec);
         RefPtr<Node> body = doc->createElementNS(HTMLNames::xhtmlNamespaceURI, "body", ec);
         rootElement->appendChild(body, ec);
diff --git a/WebCore/dom/XMLTokenizer.h b/WebCore/dom/XMLTokenizer.h
index 822ab2d..98e5d04 100644
--- a/WebCore/dom/XMLTokenizer.h
+++ b/WebCore/dom/XMLTokenizer.h
@@ -72,6 +72,9 @@
 
         void setIsXHTMLDocument(bool isXHTML) { m_isXHTMLDocument = isXHTML; }
         bool isXHTMLDocument() const { return m_isXHTMLDocument; }
+#if ENABLE(WML)
+        bool isWMLDocument() const;
+#endif
 
         // from CachedResourceClient
         virtual void notifyFinished(CachedResource* finishedObj);
diff --git a/WebCore/dom/XMLTokenizerLibxml2.cpp b/WebCore/dom/XMLTokenizerLibxml2.cpp
index 23a468d..e7ff3c1 100644
--- a/WebCore/dom/XMLTokenizerLibxml2.cpp
+++ b/WebCore/dom/XMLTokenizerLibxml2.cpp
@@ -954,7 +954,7 @@
     if (m_doc) {
 #if ENABLE(WML)
         String extId = toString(externalID);
-        if (m_doc->isWMLDocument()
+        if (isWMLDocument()
             && extId != "-//WAPFORUM//DTD WML 1.3//EN"
             && extId != "-//WAPFORUM//DTD WML 1.2//EN"
             && extId != "-//WAPFORUM//DTD WML 1.1//EN"
@@ -1098,7 +1098,11 @@
     }
 
     ent = xmlGetDocEntity(ctxt->myDoc, name);
-    if (!ent && getTokenizer(closure)->isXHTMLDocument()) {
+    if (!ent && (getTokenizer(closure)->isXHTMLDocument()
+#if ENABLE(WML)
+                 || getTokenizer(closure)->isWMLDocument()
+#endif
+       )) {
         ent = getXHTMLEntity(name);
         if (ent)
             ent->etype = XML_INTERNAL_GENERAL_ENTITY;
diff --git a/WebCore/dom/XMLTokenizerQt.cpp b/WebCore/dom/XMLTokenizerQt.cpp
index 4f9a2cf..9fb5e0f 100644
--- a/WebCore/dom/XMLTokenizerQt.cpp
+++ b/WebCore/dom/XMLTokenizerQt.cpp
@@ -446,7 +446,11 @@
         case QXmlStreamReader::EntityReference: {
             //qDebug()<<"---------- ENTITY = "<<m_stream.name().toString()
             //        <<", t = "<<m_stream.text().toString();
-            if (isXHTMLDocument()) {
+            if (isXHTMLDocument()
+#if ENABLE(WML)
+                || isWMLDocument()
+#endif
+               ) {
                 QString entity = m_stream.name().toString();
                 UChar c = decodeNamedEntity(entity.toUtf8().constData());
                 if (m_currentNode->isTextNode() || enterText()) {
diff --git a/WebCore/wml/WMLBRElement.cpp b/WebCore/wml/WMLBRElement.cpp
new file mode 100644
index 0000000..46299a5
--- /dev/null
+++ b/WebCore/wml/WMLBRElement.cpp
@@ -0,0 +1,77 @@
+/**
+ * Copyright (C) 2008 Torch Mobile Inc. All rights reserved.
+ *               http://www.torchmobile.com/
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *           (C) 2000 Simon Hausmann <hausmann@kde.org>
+ * Copyright (C) 2003, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+
+#if ENABLE(WML)
+#include "WMLBRElement.h"
+
+#include "CSSPropertyNames.h"
+#include "HTMLNames.h"
+#include "RenderBR.h"
+
+namespace WebCore {
+
+WMLBRElement::WMLBRElement(const QualifiedName& tagName, Document* doc)
+    : WMLElement(tagName, doc)
+{
+}
+
+bool WMLBRElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const
+{
+    if (attrName == HTMLNames::clearAttr) {
+        result = eUniversal;
+        return false;
+    }
+
+    return WMLElement::mapToEntry(attrName, result);
+}
+
+void WMLBRElement::parseMappedAttribute(MappedAttribute* attr)
+{
+    if (attr->name() == HTMLNames::clearAttr) {
+        // If the string is empty, then don't add the clear property. 
+        // <br clear> and <br clear=""> are just treated like <br> by Gecko, Mac IE, etc. -dwh
+        const AtomicString& value = attr->value();
+        if (value.isEmpty())
+            return;
+
+        if (equalIgnoringCase(value, "all"))
+            addCSSProperty(attr, CSSPropertyClear, "both");
+        else
+            addCSSProperty(attr, CSSPropertyClear, value);
+    } else
+        WMLElement::parseMappedAttribute(attr);
+}
+
+RenderObject* WMLBRElement::createRenderer(RenderArena* arena, RenderStyle*)
+{
+    return new (arena) RenderBR(this);
+}
+
+}
+
+#endif
diff --git a/WebCore/wml/WMLBRElement.h b/WebCore/wml/WMLBRElement.h
new file mode 100644
index 0000000..580c6d1
--- /dev/null
+++ b/WebCore/wml/WMLBRElement.h
@@ -0,0 +1,47 @@
+/**
+ * Copyright (C) 2008 Torch Mobile Inc. All rights reserved.
+ *               http://www.torchmobile.com/
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *           (C) 2000 Simon Hausmann <hausmann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WMLBRElement_h
+#define WMLBRElement_h
+
+#if ENABLE(WML)
+#include "WMLElement.h"
+
+namespace WebCore {
+
+class WMLBRElement : public WMLElement {
+public:
+    WMLBRElement(const QualifiedName& tagName, Document*);
+
+    virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
+    virtual void parseMappedAttribute(MappedAttribute*);
+
+    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+};
+
+}
+
+#endif
+#endif
diff --git a/WebCore/wml/WMLPElement.cpp b/WebCore/wml/WMLPElement.cpp
index 51e2037..582e7d4 100644
--- a/WebCore/wml/WMLPElement.cpp
+++ b/WebCore/wml/WMLPElement.cpp
@@ -29,7 +29,9 @@
 
 #include "CSSPropertyNames.h"
 #include "CSSValueKeywords.h"
+#include "Document.h"
 #include "HTMLNames.h"
+#include "NodeList.h"
 #include "WMLNames.h"
 
 namespace WebCore {
@@ -54,19 +56,58 @@
 void WMLPElement::parseMappedAttribute(MappedAttribute* attr)
 {
     if (attr->name() == HTMLNames::alignAttr) {
-        String v = attr->value();
-        if (equalIgnoringCase(attr->value(), "middle") || equalIgnoringCase(attr->value(), "center"))
+        const AtomicString& value = attr->value();
+        if (equalIgnoringCase(value, "middle") || equalIgnoringCase(value, "center"))
             addCSSProperty(attr, CSSPropertyTextAlign, CSSValueWebkitCenter);
-        else if (equalIgnoringCase(attr->value(), "left"))
+        else if (equalIgnoringCase(value, "left"))
             addCSSProperty(attr, CSSPropertyTextAlign, CSSValueWebkitLeft);
-        else if (equalIgnoringCase(attr->value(), "right"))
+        else if (equalIgnoringCase(value, "right"))
             addCSSProperty(attr, CSSPropertyTextAlign, CSSValueWebkitRight);
         else
-            addCSSProperty(attr, CSSPropertyTextAlign, v);
+            addCSSProperty(attr, CSSPropertyTextAlign, value);
+    } else if (attr->name() == modeAttr) {
+        m_mode = attr->value();
+        if (m_mode == "wrap")
+            addCSSProperty(attr, CSSPropertyWordWrap, CSSValueBreakWord);
+        else if (m_mode == "nowrap")
+            addCSSProperty(attr, CSSPropertyWhiteSpace, CSSValueNowrap);
     } else
         WMLElement::parseMappedAttribute(attr);
 }
 
+void WMLPElement::insertedIntoDocument()
+{
+    WMLElement::insertedIntoDocument();
+
+    // If not explicitly specified, the linewrap mode is identical to 
+    // the line-wrap mode of the previous paragraph in the text flow of
+    // a card. The default mode for the first paragraph in a card is wrap.
+    if (!m_mode.isEmpty())
+        return;
+
+    RefPtr<NodeList> nodeList = document()->getElementsByTagNameNS(wmlNamespaceURI, "p");
+    if (!nodeList)
+        return;
+
+    int length = nodeList->length();
+    if (length < 2)
+        return;
+
+    // Assure we're the last inserted paragraph element
+    // This only works while parsing, otherwhise this statement is never true.
+    if (nodeList->item(length - 1) != this)
+        return;
+
+    WMLPElement* lastParagraph = static_cast<WMLPElement*>(nodeList->item(length - 2));
+    ASSERT(lastParagraph);
+
+    String lastMode = lastParagraph->getAttribute(modeAttr);
+    if (lastMode.isEmpty() || lastMode == "wrap") // Default value, do nothing.
+        return;
+
+    setAttribute(modeAttr, lastMode);
+}
+
 }
 
 #endif
diff --git a/WebCore/wml/WMLPElement.h b/WebCore/wml/WMLPElement.h
index f1dc148..099de0f 100644
--- a/WebCore/wml/WMLPElement.h
+++ b/WebCore/wml/WMLPElement.h
@@ -36,6 +36,11 @@
 
     virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
     virtual void parseMappedAttribute(MappedAttribute*);
+
+    virtual void insertedIntoDocument();
+
+private:
+    String m_mode;
 };
 
 }
diff --git a/WebCore/wml/WMLTagNames.in b/WebCore/wml/WMLTagNames.in
index 3087b88..de429d0 100644
--- a/WebCore/wml/WMLTagNames.in
+++ b/WebCore/wml/WMLTagNames.in
@@ -3,6 +3,7 @@
 guardFactoryWith="ENABLE(WML)"
 
 a
+br interfaceName=WMLBRElement
 card
 p
 
@@ -10,7 +11,6 @@
 # These elements don't need a correponsponding WML*Element class.
 b
 big
-br
 em
 i
 small