Patch by David Kilzer, reviewed by Darin.
authorap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 12 Mar 2006 08:29:20 +0000 (08:29 +0000)
committerap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 12 Mar 2006 08:29:20 +0000 (08:29 +0000)
        - Fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=7724
        Minor refactoring to HTMLParser::handleError() to remove duplicate code

WebCore:
        * khtml/html/htmlparser.cpp:
        (WebCore::HTMLParser::handleError): Refactored code.

LayoutTests:
        These tests cover the changed code.  No change in behavior.

        * fast/invalid/missing-address-end-tag-expected.checksum: Added.
        * fast/invalid/missing-address-end-tag-expected.png: Added.
        * fast/invalid/missing-address-end-tag-expected.txt: Added.
        * fast/invalid/missing-address-end-tag.html: Added.
        * fast/invalid/missing-dl-end-tag-expected.checksum: Added.
        * fast/invalid/missing-dl-end-tag-expected.png: Added.
        * fast/invalid/missing-dl-end-tag-expected.txt: Added.
        * fast/invalid/missing-dl-end-tag.html: Added.
        * fast/invalid/missing-dt-end-tag-expected.checksum: Added.
        * fast/invalid/missing-dt-end-tag-expected.png: Added.
        * fast/invalid/missing-dt-end-tag-expected.txt: Added.
        * fast/invalid/missing-dt-end-tag.html: Added.
        * fast/invalid/missing-font-end-tag-expected.checksum: Added.
        * fast/invalid/missing-font-end-tag-expected.png: Added.
        * fast/invalid/missing-font-end-tag-expected.txt: Added.
        * fast/invalid/missing-font-end-tag.html: Added.

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

19 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/invalid/missing-address-end-tag-expected.checksum [new file with mode: 0644]
LayoutTests/fast/invalid/missing-address-end-tag-expected.png [new file with mode: 0644]
LayoutTests/fast/invalid/missing-address-end-tag-expected.txt [new file with mode: 0644]
LayoutTests/fast/invalid/missing-address-end-tag.html [new file with mode: 0644]
LayoutTests/fast/invalid/missing-dl-end-tag-expected.checksum [new file with mode: 0644]
LayoutTests/fast/invalid/missing-dl-end-tag-expected.png [new file with mode: 0644]
LayoutTests/fast/invalid/missing-dl-end-tag-expected.txt [new file with mode: 0644]
LayoutTests/fast/invalid/missing-dl-end-tag.html [new file with mode: 0644]
LayoutTests/fast/invalid/missing-dt-end-tag-expected.checksum [new file with mode: 0644]
LayoutTests/fast/invalid/missing-dt-end-tag-expected.png [new file with mode: 0644]
LayoutTests/fast/invalid/missing-dt-end-tag-expected.txt [new file with mode: 0644]
LayoutTests/fast/invalid/missing-dt-end-tag.html [new file with mode: 0644]
LayoutTests/fast/invalid/missing-font-end-tag-expected.checksum [new file with mode: 0644]
LayoutTests/fast/invalid/missing-font-end-tag-expected.png [new file with mode: 0644]
LayoutTests/fast/invalid/missing-font-end-tag-expected.txt [new file with mode: 0644]
LayoutTests/fast/invalid/missing-font-end-tag.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/khtml/html/htmlparser.cpp

index 40547a5542dc3af9ffac22659ca7703658db7ab2..b9207b2bb6608a5ad79de697b9bc1e249237b35e 100644 (file)
@@ -1,3 +1,29 @@
+2006-03-12  David Kilzer  <ddkilzer@kilzer.net>
+
+        Reviewed by Darin, landed by ap.
+
+        - Tests for http://bugzilla.opendarwin.org/show_bug.cgi?id=7724
+        Minor refactoring to HTMLParser::handleError() to remove duplicate code
+
+        These tests cover the changed code.  No change in behavior.
+
+        * fast/invalid/missing-address-end-tag-expected.checksum: Added.
+        * fast/invalid/missing-address-end-tag-expected.png: Added.
+        * fast/invalid/missing-address-end-tag-expected.txt: Added.
+        * fast/invalid/missing-address-end-tag.html: Added.
+        * fast/invalid/missing-dl-end-tag-expected.checksum: Added.
+        * fast/invalid/missing-dl-end-tag-expected.png: Added.
+        * fast/invalid/missing-dl-end-tag-expected.txt: Added.
+        * fast/invalid/missing-dl-end-tag.html: Added.
+        * fast/invalid/missing-dt-end-tag-expected.checksum: Added.
+        * fast/invalid/missing-dt-end-tag-expected.png: Added.
+        * fast/invalid/missing-dt-end-tag-expected.txt: Added.
+        * fast/invalid/missing-dt-end-tag.html: Added.
+        * fast/invalid/missing-font-end-tag-expected.checksum: Added.
+        * fast/invalid/missing-font-end-tag-expected.png: Added.
+        * fast/invalid/missing-font-end-tag-expected.txt: Added.
+        * fast/invalid/missing-font-end-tag.html: Added.
+
 2006-03-10  Darin Adler  <darin@apple.com>
 
         Reviewed by Geoff, except for frame-name-reset, which was done by Alexey.
diff --git a/LayoutTests/fast/invalid/missing-address-end-tag-expected.checksum b/LayoutTests/fast/invalid/missing-address-end-tag-expected.checksum
new file mode 100644 (file)
index 0000000..78699ff
--- /dev/null
@@ -0,0 +1,2 @@
+96c372cb88ae5f9ab28523027c3f7c82
+\ No newline at end of file
diff --git a/LayoutTests/fast/invalid/missing-address-end-tag-expected.png b/LayoutTests/fast/invalid/missing-address-end-tag-expected.png
new file mode 100644 (file)
index 0000000..518c731
Binary files /dev/null and b/LayoutTests/fast/invalid/missing-address-end-tag-expected.png differ
diff --git a/LayoutTests/fast/invalid/missing-address-end-tag-expected.txt b/LayoutTests/fast/invalid/missing-address-end-tag-expected.txt
new file mode 100644 (file)
index 0000000..71fb405
--- /dev/null
@@ -0,0 +1,19 @@
+layer at (0,0) size 800x600
+  RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {DIV} at (0,0) size 784x18
+        RenderText {TEXT} at (0,0) size 53x18
+          text run at (0,0) width 53: "Test for "
+        RenderInline {A} at (0,0) size 120x18 [color=#0000EE]
+          RenderText {TEXT} at (53,0) size 120x18
+            text run at (53,0) width 120: "Bugzilla Bug 7724"
+        RenderText {TEXT} at (173,0) size 475x18
+          text run at (173,0) width 475: " Minor refactoring to HTMLParser::handleError() to remove duplicate code"
+      RenderBlock {ADDRESS} at (0,18) size 784x18
+        RenderText {TEXT} at (0,0) size 49x18
+          text run at (0,0) width 49: "address"
+      RenderBlock (anonymous) at (0,36) size 784x18
+        RenderText {TEXT} at (0,0) size 9x18
+          text run at (0,0) width 9: "tr"
diff --git a/LayoutTests/fast/invalid/missing-address-end-tag.html b/LayoutTests/fast/invalid/missing-address-end-tag.html
new file mode 100644 (file)
index 0000000..13f837b
--- /dev/null
@@ -0,0 +1,3 @@
+<div>Test for <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=7724">Bugzilla Bug 7724</a>
+Minor refactoring to HTMLParser::handleError() to remove duplicate code</div>
+<address>address<tr>tr
diff --git a/LayoutTests/fast/invalid/missing-dl-end-tag-expected.checksum b/LayoutTests/fast/invalid/missing-dl-end-tag-expected.checksum
new file mode 100644 (file)
index 0000000..0396495
--- /dev/null
@@ -0,0 +1,2 @@
+c279593802c1278c64aeba24e920b70c
+\ No newline at end of file
diff --git a/LayoutTests/fast/invalid/missing-dl-end-tag-expected.png b/LayoutTests/fast/invalid/missing-dl-end-tag-expected.png
new file mode 100644 (file)
index 0000000..5120453
Binary files /dev/null and b/LayoutTests/fast/invalid/missing-dl-end-tag-expected.png differ
diff --git a/LayoutTests/fast/invalid/missing-dl-end-tag-expected.txt b/LayoutTests/fast/invalid/missing-dl-end-tag-expected.txt
new file mode 100644 (file)
index 0000000..fd8468f
--- /dev/null
@@ -0,0 +1,19 @@
+layer at (0,0) size 800x600
+  RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {DIV} at (0,0) size 784x18
+        RenderText {TEXT} at (0,0) size 53x18
+          text run at (0,0) width 53: "Test for "
+        RenderInline {A} at (0,0) size 120x18 [color=#0000EE]
+          RenderText {TEXT} at (53,0) size 120x18
+            text run at (53,0) width 120: "Bugzilla Bug 7724"
+        RenderText {TEXT} at (173,0) size 475x18
+          text run at (173,0) width 475: " Minor refactoring to HTMLParser::handleError() to remove duplicate code"
+      RenderBlock {DL} at (0,34) size 784x18
+        RenderText {TEXT} at (0,0) size 12x18
+          text run at (0,0) width 12: "dl"
+      RenderBlock (anonymous) at (0,68) size 784x18
+        RenderText {TEXT} at (0,0) size 9x18
+          text run at (0,0) width 9: "tr"
diff --git a/LayoutTests/fast/invalid/missing-dl-end-tag.html b/LayoutTests/fast/invalid/missing-dl-end-tag.html
new file mode 100644 (file)
index 0000000..9079323
--- /dev/null
@@ -0,0 +1,3 @@
+<div>Test for <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=7724">Bugzilla Bug 7724</a>
+Minor refactoring to HTMLParser::handleError() to remove duplicate code</div>
+<dl>dl<tr>tr
diff --git a/LayoutTests/fast/invalid/missing-dt-end-tag-expected.checksum b/LayoutTests/fast/invalid/missing-dt-end-tag-expected.checksum
new file mode 100644 (file)
index 0000000..0115751
--- /dev/null
@@ -0,0 +1,2 @@
+4a4e25509a2c4a74c6c1e82381591aa2
+\ No newline at end of file
diff --git a/LayoutTests/fast/invalid/missing-dt-end-tag-expected.png b/LayoutTests/fast/invalid/missing-dt-end-tag-expected.png
new file mode 100644 (file)
index 0000000..3fb7762
Binary files /dev/null and b/LayoutTests/fast/invalid/missing-dt-end-tag-expected.png differ
diff --git a/LayoutTests/fast/invalid/missing-dt-end-tag-expected.txt b/LayoutTests/fast/invalid/missing-dt-end-tag-expected.txt
new file mode 100644 (file)
index 0000000..e2a22d9
--- /dev/null
@@ -0,0 +1,19 @@
+layer at (0,0) size 800x600
+  RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {DIV} at (0,0) size 784x18
+        RenderText {TEXT} at (0,0) size 53x18
+          text run at (0,0) width 53: "Test for "
+        RenderInline {A} at (0,0) size 120x18 [color=#0000EE]
+          RenderText {TEXT} at (53,0) size 120x18
+            text run at (53,0) width 120: "Bugzilla Bug 7724"
+        RenderText {TEXT} at (173,0) size 475x18
+          text run at (173,0) width 475: " Minor refactoring to HTMLParser::handleError() to remove duplicate code"
+      RenderBlock {DT} at (0,18) size 784x18
+        RenderText {TEXT} at (0,0) size 12x18
+          text run at (0,0) width 12: "dt"
+      RenderBlock (anonymous) at (0,36) size 784x18
+        RenderText {TEXT} at (0,0) size 9x18
+          text run at (0,0) width 9: "tr"
diff --git a/LayoutTests/fast/invalid/missing-dt-end-tag.html b/LayoutTests/fast/invalid/missing-dt-end-tag.html
new file mode 100644 (file)
index 0000000..43bf1f4
--- /dev/null
@@ -0,0 +1,3 @@
+<div>Test for <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=7724">Bugzilla Bug 7724</a>
+Minor refactoring to HTMLParser::handleError() to remove duplicate code</div>
+<dt>dt<tr>tr
diff --git a/LayoutTests/fast/invalid/missing-font-end-tag-expected.checksum b/LayoutTests/fast/invalid/missing-font-end-tag-expected.checksum
new file mode 100644 (file)
index 0000000..46c1a61
--- /dev/null
@@ -0,0 +1,2 @@
+0bbb3aed4ac8db6ddb39337a6af38e05
+\ No newline at end of file
diff --git a/LayoutTests/fast/invalid/missing-font-end-tag-expected.png b/LayoutTests/fast/invalid/missing-font-end-tag-expected.png
new file mode 100644 (file)
index 0000000..699cf48
Binary files /dev/null and b/LayoutTests/fast/invalid/missing-font-end-tag-expected.png differ
diff --git a/LayoutTests/fast/invalid/missing-font-end-tag-expected.txt b/LayoutTests/fast/invalid/missing-font-end-tag-expected.txt
new file mode 100644 (file)
index 0000000..0c1e550
--- /dev/null
@@ -0,0 +1,19 @@
+layer at (0,0) size 800x600
+  RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {DIV} at (0,0) size 784x18
+        RenderText {TEXT} at (0,0) size 53x18
+          text run at (0,0) width 53: "Test for "
+        RenderInline {A} at (0,0) size 120x18 [color=#0000EE]
+          RenderText {TEXT} at (53,0) size 120x18
+            text run at (53,0) width 120: "Bugzilla Bug 7724"
+        RenderText {TEXT} at (173,0) size 475x18
+          text run at (173,0) width 475: " Minor refactoring to HTMLParser::handleError() to remove duplicate code"
+      RenderBlock (anonymous) at (0,18) size 784x18
+        RenderInline {FONT} at (0,0) size 25x18
+          RenderText {TEXT} at (0,0) size 25x18
+            text run at (0,0) width 25: "font"
+        RenderText {TEXT} at (25,0) size 9x18
+          text run at (25,0) width 9: "tr"
diff --git a/LayoutTests/fast/invalid/missing-font-end-tag.html b/LayoutTests/fast/invalid/missing-font-end-tag.html
new file mode 100644 (file)
index 0000000..4606fec
--- /dev/null
@@ -0,0 +1,3 @@
+<div>Test for <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=7724">Bugzilla Bug 7724</a>
+Minor refactoring to HTMLParser::handleError() to remove duplicate code</div>
+<font>font<tr>tr
index 9debff81acb1c6b81eee5163061246f82617d05b..965c9989e017d2ba656d66888984fb5bc18df261 100644 (file)
@@ -1,3 +1,18 @@
+2006-03-12  David Kilzer  <ddkilzer@kilzer.net>
+
+        Reviewed by Darin, landed by ap.
+
+        - Fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=7724
+        Minor refactoring to HTMLParser::handleError() to remove duplicate code
+
+        Test: fast/invalid/missing-address-end-tag.html
+        Test: fast/invalid/missing-dl-end-tag.html
+        Test: fast/invalid/missing-dt-end-tag.html
+        Test: fast/invalid/missing-font-end-tag.html
+
+        * khtml/html/htmlparser.cpp:
+        (WebCore::HTMLParser::handleError): Refactored code.
+
 2006-03-10  Darin Adler  <darin@apple.com>
 
         - fix Windows build
index 4fb7a5936b3d85cef969cae0eb49b459a6b2b64a..35582d233c218154c77be4cd11045885fc2b5fd4 100644 (file)
@@ -467,7 +467,8 @@ bool HTMLParser::handleError(NodeImpl* n, bool flat, const AtomicString& localNa
                     handled = true;
                 }
             }
-        } else if (h->hasLocalName(titleTag)) {
+        } else if (h->hasLocalName(addressTag) || h->hasLocalName(dlTag) || h->hasLocalName(dtTag)
+                   || h->hasLocalName(fontTag) || h->hasLocalName(titleTag)) {
             popBlock(currentTagName);
             handled = true;
         } else if (h->hasLocalName(captionTag)) {
@@ -542,9 +543,6 @@ bool HTMLParser::handleError(NodeImpl* n, bool flat, const AtomicString& localNa
             e = new HTMLDivElementImpl(document);
             insertNode(e);
             handled = true;
-        } else if (h->hasLocalName(dlTag) || h->hasLocalName(dtTag)) {
-            popBlock(currentTagName);
-            handled = true;
         } else if (h->hasLocalName(selectTag)) {
             if (isInline(n))
                 return false;
@@ -561,17 +559,11 @@ bool HTMLParser::handleError(NodeImpl* n, bool flat, const AtomicString& localNa
                 // IE treats a nested select as </select>. Let's do the same
                 popBlock(localName);
             }
-        } else if (h->hasLocalName(addressTag)) {
-            popBlock(currentTagName);
-            handled = true;
         } else if (h->hasLocalName(colgroupTag)) {
             if (!n->isTextNode()) {
                 popBlock(currentTagName);
                 handled = true;
             }
-        } else if (h->hasLocalName(fontTag)) {
-            popBlock(currentTagName);
-            handled = true;
         } else if (!h->hasLocalName(bodyTag)) {
             if (isInline(current)) {
                 popInlineBlocks();