Unreviewed, reverting my HTML comment parsing change as it
authorjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Jun 2010 15:26:06 +0000 (15:26 +0000)
committerjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Jun 2010 15:26:06 +0000 (15:26 +0000)
breaks Gtk and Qt.

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

31 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css/word-space-extra.html
LayoutTests/fast/parser/broken-comment-1-expected.txt [deleted file]
LayoutTests/fast/parser/broken-comment-1.html [deleted file]
LayoutTests/fast/parser/broken-comment-2-expected.txt [deleted file]
LayoutTests/fast/parser/broken-comment-2.html [deleted file]
LayoutTests/fast/parser/broken-comment-3-expected.txt [deleted file]
LayoutTests/fast/parser/broken-comment-3.html [deleted file]
LayoutTests/fast/parser/broken-comment-4-expected.txt [deleted file]
LayoutTests/fast/parser/broken-comment-4.html [deleted file]
LayoutTests/fast/parser/broken-comment-5-expected.txt [deleted file]
LayoutTests/fast/parser/broken-comment-5.html [deleted file]
LayoutTests/fast/parser/broken-comment-6-expected.txt [deleted file]
LayoutTests/fast/parser/broken-comment-6.html [deleted file]
LayoutTests/fast/parser/broken-comment-in-head-1-expected.txt [deleted file]
LayoutTests/fast/parser/broken-comment-in-head-1.html [deleted file]
LayoutTests/fast/parser/broken-comment-in-head-2-expected.txt [deleted file]
LayoutTests/fast/parser/broken-comment-in-head-2.html [deleted file]
LayoutTests/fast/parser/broken-comment-in-head-3-expected.txt [deleted file]
LayoutTests/fast/parser/broken-comment-in-head-3.html [deleted file]
LayoutTests/fast/parser/broken-comment-in-head-4-expected.txt [deleted file]
LayoutTests/fast/parser/broken-comment-in-head-4.html [deleted file]
LayoutTests/fast/parser/broken-comment-in-head-5-expected.txt [deleted file]
LayoutTests/fast/parser/broken-comment-in-head-5.html [deleted file]
LayoutTests/fast/parser/broken-comments-vs-parsing-mode.html
LayoutTests/fast/parser/comments-expected.txt
LayoutTests/fast/parser/comments.html
LayoutTests/html5lib/runner-expected.txt
WebCore/ChangeLog
WebCore/html/HTMLTokenizer.cpp
WebCore/html/HTMLTokenizer.h

index 9da8ead..9b8863c 100644 (file)
@@ -1,3 +1,36 @@
+2010-06-07  Julien Chaffraix  <jchaffraix@webkit.org>
+
+        Unreviewed, reverting my HTML comment parsing change as it
+        breaks Gtk and Qt.
+
+        * fast/css/word-space-extra.html:
+        * fast/parser/broken-comment-1-expected.txt: Removed.
+        * fast/parser/broken-comment-1.html: Removed.
+        * fast/parser/broken-comment-2-expected.txt: Removed.
+        * fast/parser/broken-comment-2.html: Removed.
+        * fast/parser/broken-comment-3-expected.txt: Removed.
+        * fast/parser/broken-comment-3.html: Removed.
+        * fast/parser/broken-comment-4-expected.txt: Removed.
+        * fast/parser/broken-comment-4.html: Removed.
+        * fast/parser/broken-comment-5-expected.txt: Removed.
+        * fast/parser/broken-comment-5.html: Removed.
+        * fast/parser/broken-comment-6-expected.txt: Removed.
+        * fast/parser/broken-comment-6.html: Removed.
+        * fast/parser/broken-comment-in-head-1-expected.txt: Removed.
+        * fast/parser/broken-comment-in-head-1.html: Removed.
+        * fast/parser/broken-comment-in-head-2-expected.txt: Removed.
+        * fast/parser/broken-comment-in-head-2.html: Removed.
+        * fast/parser/broken-comment-in-head-3-expected.txt: Removed.
+        * fast/parser/broken-comment-in-head-3.html: Removed.
+        * fast/parser/broken-comment-in-head-4-expected.txt: Removed.
+        * fast/parser/broken-comment-in-head-4.html: Removed.
+        * fast/parser/broken-comment-in-head-5-expected.txt: Removed.
+        * fast/parser/broken-comment-in-head-5.html: Removed.
+        * fast/parser/broken-comments-vs-parsing-mode.html:
+        * fast/parser/comments-expected.txt:
+        * fast/parser/comments.html:
+        * html5lib/runner-expected.txt:
+
 2010-06-07  Robert Hogan  <robert@webkit.org>
 
         Reviewed by Kenneth Rohde Christiansen.
index 9bb0312..72e518c 100644 (file)
@@ -8,7 +8,7 @@
          eg. the distance between 'foo' and 'bar' in <pre>foo bar</pre>, will not be doubled
          in <pre>foo  bar</pre>.  The block size should be approximately 
          numchars*(charwidth+letter_spacing)+(numwords-1)*word_spacing.
-       * <pre>elements too</pre>, <pre>elements <!-- comment - -> too</pre> have a different
+       * <pre>elements too</pre>, <pre>elements <!-- comment -> too</pre> have a different
          number of spaces seperating 'elements' and 'too', hence will have different sized gaps
        * <pre> blocks are already using a monospace font so no difference may be visible in
          the monospace sections within them.
diff --git a/LayoutTests/fast/parser/broken-comment-1-expected.txt b/LayoutTests/fast/parser/broken-comment-1-expected.txt
deleted file mode 100644 (file)
index 1a1e842..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-Test for bug 21945: Space should be allowed between -- and > in comment end
-
-This test check that broken comments in body are correctly parsed. You should see PASSED once.
-
-PASSED
diff --git a/LayoutTests/fast/parser/broken-comment-1.html b/LayoutTests/fast/parser/broken-comment-1.html
deleted file mode 100644 (file)
index 8528bde..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script>
-if (window.layoutTestController)
-    layoutTestController.dumpAsText();
-</script>
-</head>
-<body>
-<p>Test for bug <a href="https://bugs.webkit.org/show_bug.cgi?id=21945">21945</a>: Space should be allowed between -- and > in comment end</p>
-<p>This test check that broken comments in body are correctly parsed. You should see PASSED once.</p>
-PASSED<!-- FAILED
diff --git a/LayoutTests/fast/parser/broken-comment-2-expected.txt b/LayoutTests/fast/parser/broken-comment-2-expected.txt
deleted file mode 100644 (file)
index 1a1e842..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-Test for bug 21945: Space should be allowed between -- and > in comment end
-
-This test check that broken comments in body are correctly parsed. You should see PASSED once.
-
-PASSED
diff --git a/LayoutTests/fast/parser/broken-comment-2.html b/LayoutTests/fast/parser/broken-comment-2.html
deleted file mode 100644 (file)
index 9befaa1..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script>
-if (window.layoutTestController)
-    layoutTestController.dumpAsText();
-</script>
-</head>
-<body>
-<p>Test for bug <a href="https://bugs.webkit.org/show_bug.cgi?id=21945">21945</a>: Space should be allowed between -- and > in comment end</p>
-<p>This test check that broken comments in body are correctly parsed. You should see PASSED once.</p>
-PASSED<!--
diff --git a/LayoutTests/fast/parser/broken-comment-3-expected.txt b/LayoutTests/fast/parser/broken-comment-3-expected.txt
deleted file mode 100644 (file)
index 1a1e842..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-Test for bug 21945: Space should be allowed between -- and > in comment end
-
-This test check that broken comments in body are correctly parsed. You should see PASSED once.
-
-PASSED
diff --git a/LayoutTests/fast/parser/broken-comment-3.html b/LayoutTests/fast/parser/broken-comment-3.html
deleted file mode 100644 (file)
index 9d49509..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script>
-if (window.layoutTestController)
-    layoutTestController.dumpAsText();
-</script>
-</head>
-<body>
-<p>Test for bug <a href="https://bugs.webkit.org/show_bug.cgi?id=21945">21945</a>: Space should be allowed between -- and > in comment end</p>
-<p>This test check that broken comments in body are correctly parsed. You should see PASSED once.</p>
-PASSED<!----
diff --git a/LayoutTests/fast/parser/broken-comment-4-expected.txt b/LayoutTests/fast/parser/broken-comment-4-expected.txt
deleted file mode 100644 (file)
index 1a1e842..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-Test for bug 21945: Space should be allowed between -- and > in comment end
-
-This test check that broken comments in body are correctly parsed. You should see PASSED once.
-
-PASSED
diff --git a/LayoutTests/fast/parser/broken-comment-4.html b/LayoutTests/fast/parser/broken-comment-4.html
deleted file mode 100644 (file)
index 509d4a3..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script>
-if (window.layoutTestController)
-    layoutTestController.dumpAsText();
-</script>
-</head>
-<body>
-<p>Test for bug <a href="https://bugs.webkit.org/show_bug.cgi?id=21945">21945</a>: Space should be allowed between -- and > in comment end</p>
-<p>This test check that broken comments in body are correctly parsed. You should see PASSED once.</p>
-PASSED<!-- FAILED - -
diff --git a/LayoutTests/fast/parser/broken-comment-5-expected.txt b/LayoutTests/fast/parser/broken-comment-5-expected.txt
deleted file mode 100644 (file)
index 1a1e842..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-Test for bug 21945: Space should be allowed between -- and > in comment end
-
-This test check that broken comments in body are correctly parsed. You should see PASSED once.
-
-PASSED
diff --git a/LayoutTests/fast/parser/broken-comment-5.html b/LayoutTests/fast/parser/broken-comment-5.html
deleted file mode 100644 (file)
index 25147b7..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script>
-if (window.layoutTestController)
-    layoutTestController.dumpAsText();
-</script>
-</head>
-<body>
-<p>Test for bug <a href="https://bugs.webkit.org/show_bug.cgi?id=21945">21945</a>: Space should be allowed between -- and > in comment end</p>
-<p>This test check that broken comments in body are correctly parsed. You should see PASSED once.</p>
-PASSED <!-- FAILED --
diff --git a/LayoutTests/fast/parser/broken-comment-6-expected.txt b/LayoutTests/fast/parser/broken-comment-6-expected.txt
deleted file mode 100644 (file)
index 1a1e842..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-Test for bug 21945: Space should be allowed between -- and > in comment end
-
-This test check that broken comments in body are correctly parsed. You should see PASSED once.
-
-PASSED
diff --git a/LayoutTests/fast/parser/broken-comment-6.html b/LayoutTests/fast/parser/broken-comment-6.html
deleted file mode 100644 (file)
index dfe3216..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script>
-if (window.layoutTestController)
-    layoutTestController.dumpAsText();
-</script>
-</head>
-<body>
-<p>Test for bug <a href="https://bugs.webkit.org/show_bug.cgi?id=21945">21945</a>: Space should be allowed between -- and > in comment end</p>
-<p>This test check that broken comments in body are correctly parsed. You should see PASSED once.</p>
-PASSED <!-- FAILED --     
-
diff --git a/LayoutTests/fast/parser/broken-comment-in-head-1-expected.txt b/LayoutTests/fast/parser/broken-comment-in-head-1-expected.txt
deleted file mode 100644 (file)
index 8b13789..0000000
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/LayoutTests/fast/parser/broken-comment-in-head-1.html b/LayoutTests/fast/parser/broken-comment-in-head-1.html
deleted file mode 100644 (file)
index be7a82a..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<title> Bug 21945 - Space should be allowed between -- and > in comment end. You should not see anything </title>
-<script>
-if (window.layoutTestController)
-    layoutTestController.dumpAsText();
-</script>
-<!-- FAILED: This should be part of the comment
diff --git a/LayoutTests/fast/parser/broken-comment-in-head-2-expected.txt b/LayoutTests/fast/parser/broken-comment-in-head-2-expected.txt
deleted file mode 100644 (file)
index 8b13789..0000000
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/LayoutTests/fast/parser/broken-comment-in-head-2.html b/LayoutTests/fast/parser/broken-comment-in-head-2.html
deleted file mode 100644 (file)
index b8db4e5..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<title> Bug 21945 - Space should be allowed between -- and > in comment end. You should not see anything </title>
-<script>
-if (window.layoutTestController)
-    layoutTestController.dumpAsText();
-</script>
-<!-- FAILED: This should be part of the comment -
diff --git a/LayoutTests/fast/parser/broken-comment-in-head-3-expected.txt b/LayoutTests/fast/parser/broken-comment-in-head-3-expected.txt
deleted file mode 100644 (file)
index 8b13789..0000000
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/LayoutTests/fast/parser/broken-comment-in-head-3.html b/LayoutTests/fast/parser/broken-comment-in-head-3.html
deleted file mode 100644 (file)
index aa9d48d..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<title> Bug 21945 - Space should be allowed between -- and > in comment end. You should not see anything </title>
-<script>
-if (window.layoutTestController)
-    layoutTestController.dumpAsText();
-</script>
-<!-- FAILED: This should be part of the comment --
diff --git a/LayoutTests/fast/parser/broken-comment-in-head-4-expected.txt b/LayoutTests/fast/parser/broken-comment-in-head-4-expected.txt
deleted file mode 100644 (file)
index 8b13789..0000000
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/LayoutTests/fast/parser/broken-comment-in-head-4.html b/LayoutTests/fast/parser/broken-comment-in-head-4.html
deleted file mode 100644 (file)
index ad32223..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<title> Bug 21945 - Space should be allowed between -- and > in comment end. You should not see anything </title>
-<script>
-if (window.layoutTestController)
-    layoutTestController.dumpAsText();
-</script>
-<!-- FAILED: This should be part of the comment - ->
diff --git a/LayoutTests/fast/parser/broken-comment-in-head-5-expected.txt b/LayoutTests/fast/parser/broken-comment-in-head-5-expected.txt
deleted file mode 100644 (file)
index 8b13789..0000000
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/LayoutTests/fast/parser/broken-comment-in-head-5.html b/LayoutTests/fast/parser/broken-comment-in-head-5.html
deleted file mode 100644 (file)
index f73cfd7..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<title> Bug 21945 - Space should be allowed between -- and > in comment end. You should not see anything </title>
-<script>
-if (window.layoutTestController)
-    layoutTestController.dumpAsText();
-</script>
-<!-- FAILED: This should be part of the comment --          
-
index 62c2c70..a872499 100644 (file)
@@ -1,9 +1,5 @@
 <html>
-<head>
-<title>
 <!-- A broken comment ->
-</title>
-</head>
 <body>
 <p><a href="https://bugs.webkit.org/show_bug.cgi?id=8626">bug 8626</a>: 
 Strict mode erroneously triggered by a broken comment.</p>
index 5e13471..eef7dc8 100644 (file)
@@ -1,29 +1,24 @@
-Output of this test should match HTML5 (no strict SGML comment parsing).
+Output of this test should match WinIE (no strict SGML comment parsing).
 
-Basic comments (2 PASSED):
-PASSED PASSED
-Comment series (3 PASSED):
+Basic comments (1 PASSED):
+PASSED
+Comment series (1 PASSED):
+PASSED
+Dash runs (3 PASSED):
 PASSED PASSED PASSED
 
-Dash runs (5 PASSED):
-PASSED PASSED PASSED PASSED PASSED
-
-Empty comments (5 PASSED):
-PASSED PASSED PASSED PASSED PASSED
-
-Multiple lines (4 PASSED):
-PASSED PASSED PASSED PASSED
+Empty comments (2 PASSED):
+PASSED PASSED
 
-Compatibility (7 PASSED):
-PASSED PASSED PASSED PASSED PASSED PASSED PASSED
+Multiple lines (1 PASSED):
+PASSED
 
-White space after comment close (4 PASSED):
-PASSED PASSED PASSED PASSED
+Compatibility (2 PASSED):
+PASSED PASSED
 
+Tab after comment close:
 Text after comment close:
-Extra comment after markup declaration close (2 PASSED):
+Extra comment after markup declaration close:
 FAILED: extra comment end and markup declaration close -->
-PASSED PASSED
-
 Nested comment (1 PASSED):
 PASSED (outer nested comment) -->
index a23b686..fe5afa3 100644 (file)
@@ -1,76 +1,50 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html>
 <body>
-<p>Output of this test should match HTML5 (no strict SGML comment parsing).</p>
+<p>Output of this test should match WinIE (no strict SGML comment parsing).</p>
 
 <script>
 if (window.layoutTestController)
     layoutTestController.dumpAsText();
 </script>
-<p>Basic comments (2 PASSED):<br>
+<p>Basic comments (1 PASSED):<br>
 <!-- basic comment -->PASSED
-<!-- basic comment with spaces after comment end --    >PASSED
-<!-- basic comment with spaces after comment end - -    >FAILED--></p>
-<p>Comment series (3 PASSED):<br>
+<!-- basic comment with spaces after comment end --    >FAILED--></p>
+<p>Comment series (1 PASSED):<br>
 <!-- comment -- -- series-->PASSED
-<!-- comment -- -- series with space after comment end-- >PASSED
-<!-- comment -- -- series with spaces after comment end--  >PASSED</p>
-<!-- comment -- -- series with spaces after comment end- -  >FAILED--></p>
-<p>Dash runs (5 PASSED):<br>
+<!-- comment -- -- series with spaces after comment end-- >FAILED--></p>
+<p>Dash runs (3 PASSED):<br>
 <!------ Hello -->PASSED
-<!------ Hello -- >PASSED
-<!------ Hello --  >PASSED
-<!------ Hello - -  >FAILED
+<!------ Hello -- >FAILED
 <!-- --- Hello -->PASSED
 <!-- Hello --->PASSED</p>
-<p>Empty comments (5 PASSED):<br>
+<p>Empty comments (2 PASSED):<br>
 <!---->PASSED
-<!---- >PASSED
-<!>PASSED
-<!-->PASSED
-<!--->PASSED</p>
-<p>Multiple lines (4 PASSED):<br>
+<!---- >FAILED-->
+<!>PASSED</p>
+<p>Multiple lines (1 PASSED):<br>
 <!-- here's a comment, a little longer,
     which occupies more than one line -->PASSED
 <!-- here's a comment, a little longer,
-    which occupies more than one line -- >PASSED
-<!-- here's a comment, a little longer,
-    which occupies more than one line --        >PASSED
-<!-- here's a comment, a little longer,
-    which occupies more than one line --        
-    >PASSED
-<!-- here's a comment, a little longer,
-    which occupies more than one line - -       >FAILED-->
+    which occupies more than one line -- >FAILED-->
 </p>
 
-<p>Compatibility (7 PASSED):<br>
+<p>Compatibility (2 PASSED):<br>
 <!-- Compatibility: comment series with --extraneous-- text -- between -- the comments -->PASSED
-<!-- Compatibility: comment series with --extraneous-- text -- between -- the comments -- >PASSED
-<!-- Compatibility: comment series with --extraneous-- text -- between -- the comments --  >PASSED
-<!-- Compatibility: comment series with --extraneous-- text -- between -- the comments - -  >FAILED-->
+<!-- Compatibility: comment series with --extraneous-- text -- between -- the comments -- >FAILED-->
 <!-- Compatibility: <!--extra comment start like www.the-leaky-cauldron.com has <rdar://problem/4226539>-->PASSED
-<!-- Compatibility: <!--extra comment start like www.the-leaky-cauldron.com has <rdar://problem/4226539>-- >PASSED
-<!-- Compatibility: <!--extra comment start like www.the-leaky-cauldron.com has <rdar://problem/4226539> --  >PASSED
-<!-- Compatibility: <!--extra comment start like www.the-leaky-cauldron.com has <rdar://problem/4226539> --  >PASSED
-<!-- Compatibility: <!--extra comment start like www.the-leaky-cauldron.com has <rdar://problem/4226539> - -  >FAILED-->
+<!-- Compatibility: <!--extra comment start like www.the-leaky-cauldron.com has <rdar://problem/4226539> -- >FAILED-->
 </p>
 
-<p>White space after comment close (4 PASSED):<br>
-<!-- tab after comment close-- >PASSED
-<!-- LF after comment close--\f>PASSED
-<!-- CR after comment close--
->PASSED
-<!-- tab after comment close-- >PASSED</p>
-
-
+<p>Tab after comment close:<br>
+<!-- tab after comment close-- >FAILED: should be part of the comment --></p>
 <p>Text after comment close:<br>
 <!-- text after comment close--ouch>FAILED: should be part of the comment --></p>
 
 
-<p>Extra comment after markup declaration close (2 PASSED):<br>
+<p>Extra comment after markup declaration close:<br>
 <!-- Comment --> FAILED: extra comment end and markup declaration close --><br>
-<!-- Comment with a whitespace in markup declaration close -- >PASSED
-<!-- Comment with a whitespace in markup declaration close --    >PASSED</p>
+<!-- Comment with a whitespace in markup declaration close -- > FAILED: extra comment end w/space and markup declaration close --></p>
 
 <p>Nested comment (1 PASSED):<br>
 <!-- nested: <!--FAILED (inner comment)--> PASSED (outer nested comment) --></p>
index ba5f613..9f55890 100644 (file)
@@ -4,6 +4,7 @@ CONSOLE MESSAGE: line 3: PASS
 CONSOLE MESSAGE: line 3: FOO<span>BAR</span>BAZ
 resources/tests1.dat:
 25
+27
 29
 30
 32
@@ -66,13 +67,16 @@ resources/tests2.dat:
 22
 29
 32
+33
 36
+40
 42
 44
 45
 53
 54
 56
+57
 59
 
 resources/tests3.dat:
@@ -103,6 +107,7 @@ resources/tests6.dat:
 1
 4
 5
+6
 8
 9
 10
@@ -444,6 +449,10 @@ resources/entities02.dat:
 5
 
 resources/comments01.dat:
+3
+6
+8
+9
 10
 11
 12
index 51911db..69b18bc 100644 (file)
@@ -1,3 +1,13 @@
+2010-06-07  Julien Chaffraix  <jchaffraix@webkit.org>
+
+        Unreviewed, reverting my HTML comment parsing change as it
+        breaks Gtk and Qt.
+
+        * html/HTMLTokenizer.cpp:
+        (WebCore::HTMLTokenizer::parseComment):
+        (WebCore::HTMLTokenizer::parseTag):
+        * html/HTMLTokenizer.h:
+
 2010-06-07  Martin Robinson  <mrobinson@igalia.com>
 
         Reviewed by Xan Lopez.
index e9b507d..629e7f4 100644 (file)
@@ -607,148 +607,43 @@ HTMLTokenizer::State HTMLTokenizer::parseComment(SegmentedString& src, State sta
 {
     // FIXME: Why does this code even run for comments inside <script> and <style>? This seems bogus.
     checkScriptBuffer(src.length());
-    CommentParserState commentState = CommentStartState;
     while (!src.isEmpty()) {
         UChar ch = *src;
-        switch (commentState) {
-        case CommentStartState:
-            if (ch == '>') {
-                // FIXME: We should emit a parse error.
-                return emitCommentToken(src, state, commentState);
-            }
-            if (ch == '-')
-                commentState = CommentStartDashState;
-            else {
-                m_scriptCode[m_scriptCodeSize++] = ch;
-                commentState = CommentState;
-            }
-            break;
-        case CommentStartDashState:
-            if (ch == '>') {
-                // FIXME: We should emit a parse error.
-                return emitCommentToken(src, state, commentState);
-            }
-            if (ch == '-')
-                commentState = CommentEndState;
-            else {
-                m_scriptCode[m_scriptCodeSize++] = '-';
-                m_scriptCode[m_scriptCodeSize++] = ch;
-                commentState = CommentState;
-            }
-            break;
-        case CommentState:
-            if (ch == '-')
-                commentState = CommentEndDashState;
-            else
-                m_scriptCode[m_scriptCodeSize++] = ch;
-            break;
-        case CommentEndDashState:
-            if (ch == '-')
-                commentState = CommentEndState;
-            else {
-                m_scriptCode[m_scriptCodeSize++] = '-';
-                m_scriptCode[m_scriptCodeSize++] = ch;
-                commentState = CommentState;
-            }
-            break;
-        case CommentEndState:
-            if (ch == '>')
-                return emitCommentToken(src, state, commentState);
-
-            if (ch == '\t' || ch == '\n' || ch == '\f' || ch == ' ') {
-                // FIXME: We should emit a parse error.
-                m_scriptCode[m_scriptCodeSize++] = '-';
-                m_scriptCode[m_scriptCodeSize++] = '-';
-                m_scriptCode[m_scriptCodeSize++] = ch;
-                commentState = CommentEndSpaceState;
-            } else if (ch == '!') {
-                // FIXME: We should emit a parse error.
-                commentState = CommentEndBangState;
-            } else if (ch == '-')
-                m_scriptCode[m_scriptCodeSize++] = ch;
-            else {
-                // FIXME: We should emit a parse error.
-                m_scriptCode[m_scriptCodeSize++] = '-';
-                m_scriptCode[m_scriptCodeSize++] = '-';
-                m_scriptCode[m_scriptCodeSize++] = ch;
-                commentState = CommentState;
-            }
-            break;
-        case CommentEndBangState:
-            if (ch == '>')
-                return emitCommentToken(src, state, commentState);
-            if (ch == '-') {
-                m_scriptCode[m_scriptCodeSize++] = '-';
-                m_scriptCode[m_scriptCodeSize++] = '-';
-                m_scriptCode[m_scriptCodeSize++] = '!';
-                commentState = CommentEndState;
-            } else {
-                m_scriptCode[m_scriptCodeSize++] = '-';
-                m_scriptCode[m_scriptCodeSize++] = '-';
-                m_scriptCode[m_scriptCodeSize++] = '!';
-                commentState = CommentState;
+        m_scriptCode[m_scriptCodeSize++] = ch;
+        if (ch == '>') {
+            bool handleBrokenComments = m_brokenComments && !(state.inScript() || state.inStyle());
+            int endCharsCount = 1; // start off with one for the '>' character
+            if (m_scriptCodeSize > 2 && m_scriptCode[m_scriptCodeSize-3] == '-' && m_scriptCode[m_scriptCodeSize-2] == '-') {
+                endCharsCount = 3;
+            } else if (m_scriptCodeSize > 3 && m_scriptCode[m_scriptCodeSize-4] == '-' && m_scriptCode[m_scriptCodeSize-3] == '-' && 
+                m_scriptCode[m_scriptCodeSize-2] == '!') {
+                // Other browsers will accept --!> as a close comment, even though it's
+                // not technically valid.
+                endCharsCount = 4;
             }
-            break;
-        case CommentEndSpaceState:
-            if (ch == '>')
-                return emitCommentToken(src, state, commentState);
-            if (ch == '\t' || ch == '\n' || ch == '\f' || ch == ' ')
-                m_scriptCode[m_scriptCodeSize++] = ch;
-            else if (ch == '-')
-                commentState = CommentEndDashState;
-            else {
-                m_scriptCode[m_scriptCodeSize++] = ch;
-                commentState = CommentState;
+            if (handleBrokenComments || endCharsCount > 1) {
+                src.advancePastNonNewline();
+                if (!(state.inTitle() || state.inScript() || state.inXmp() || state.inTextArea() || state.inStyle() || state.inIFrame())) {
+                    checkScriptBuffer();
+                    m_scriptCode[m_scriptCodeSize] = 0;
+                    m_scriptCode[m_scriptCodeSize + 1] = 0;
+                    m_currentToken.tagName = commentAtom;
+                    m_currentToken.beginTag = true;
+                    state = processListing(SegmentedString(m_scriptCode, m_scriptCodeSize - endCharsCount), state);
+                    processToken();
+                    m_currentToken.tagName = commentAtom;
+                    m_currentToken.beginTag = false;
+                    processToken();
+                    m_scriptCodeSize = 0;
+                }
+                state.setInComment(false);
+                return state; // Finished parsing comment
             }
-            break;
         }
         src.advance(m_lineNumber);
     }
-    ASSERT(src.isEmpty());
-    // FIXME: We should emit a parse error.
-    return emitCommentToken(src, state, commentState);
-}
 
-HTMLTokenizer::State HTMLTokenizer::emitCommentToken(SegmentedString& src, State state, CommentParserState commentState)
-{
-    if (!src.isEmpty())
-        src.advancePastNonNewline();
-
-    // FIXME: We should not be parsing HTML comments in these states in the first place. The else statement is trying to recover
-    // from this broken behaviour.
-    if (!(state.inTitle() || state.inScript() || state.inXmp() || state.inTextArea() || state.inStyle() || state.inIFrame())) {
-        checkScriptBuffer();
-        m_scriptCode[m_scriptCodeSize] = 0;
-        m_scriptCode[m_scriptCodeSize + 1] = 0;
-        m_currentToken.tagName = commentAtom;
-        m_currentToken.beginTag = true;
-        state = processListing(SegmentedString(m_scriptCode, m_scriptCodeSize), state);
-        processToken();
-        m_currentToken.tagName = commentAtom;
-        m_currentToken.beginTag = false;
-        processToken();
-        m_scriptCodeSize = 0;
-    } else {
-        // This behaviour is needed to properly parse broken comments.
-        if (src.isEmpty())
-            return state;
-
-        // We need to properly reconstruct the original comment.
-        // FIXME: Drop the commentState parameter from the method when this code is removed.
-        checkScriptBuffer();
-        if (commentState != CommentStartState) {
-            m_scriptCode[m_scriptCodeSize++] = '-';
-            if (commentState != CommentStartDashState)
-                m_scriptCode[m_scriptCodeSize++] = '-';
-        }
-        if (commentState == CommentEndBangState)
-            m_scriptCode[m_scriptCodeSize++] = '!';
-
-        m_scriptCode[m_scriptCodeSize++] = '>';
-    }
-
-    state.setInComment(false);
-    return state; // Finished parsing comment
+    return state;
 }
 
 HTMLTokenizer::State HTMLTokenizer::parseServer(SegmentedString& src, State state)
@@ -1243,7 +1138,18 @@ HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state)
                         m_dest = m_buffer; // ignore the previous part of this tag
                         state.setInComment(true);
                         state.setTagState(NoTag);
-                        state = parseComment(src, state);
+
+                        // Fix bug 34302 at kde.bugs.org.  Go ahead and treat
+                        // <!--> as a valid comment, since both mozilla and IE on windows
+                        // can handle this case.  Only do this in quirks mode. -dwh
+                        if (!src.isEmpty() && *src == '>' && m_doc->inCompatMode()) {
+                            state.setInComment(false);
+                            src.advancePastNonNewline();
+                            if (!src.isEmpty())
+                                m_cBuffer[cBufferPos++] = *src;
+                        } else
+                          state = parseComment(src, state);
+
                         m_cBufferPos = cBufferPos;
                         return state; // Finished parsing tag!
                     }
index b361e03..dc03cf2 100644 (file)
@@ -193,19 +193,6 @@ private:
     State scriptExecution(const ScriptSourceCode&, State);
     void setSrc(const SegmentedString&);
  
-    // HTML5 Comment state.
-    enum CommentParserState {
-        CommentStartState,
-        CommentStartDashState,
-        CommentState,
-        CommentEndDashState,
-        CommentEndState,
-        CommentEndBangState,
-        CommentEndSpaceState
-    };
-
-    State emitCommentToken(SegmentedString&, State, CommentParserState);
-
     // check if we have enough space in the buffer.
     // if not enlarge it
     inline void checkBuffer(int len = 10)