[webkit-changes] cvs commit: WebCore/layout-tests/fast/parser
comments-expected.txt comments.html
David
harrison at opensource.apple.com
Tue Aug 23 12:25:07 PDT 2005
harrison 05/08/23 12:25:06
Modified: . ChangeLog
khtml/html htmltokenizer.cpp
Added: layout-tests/fast/parser comments-expected.txt comments.html
Log:
Reviewed by Darin.
<rdar://problem/4226539> REGRESSION: Blank content at http://www.the-leaky-cauldron.org/ with Denver and TOT
Test cases added:
* layout-tests/fast/parser/comments-expected.txt: Added.
* layout-tests/fast/parser/comments.html: Added.
* khtml/html/htmltokenizer.cpp:
(khtml::HTMLTokenizer::parseComment):
When non-space follows comment end, ignore that comment end.
Revision Changes Path
1.4619 +14 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.4618
retrieving revision 1.4619
diff -u -r1.4618 -r1.4619
--- ChangeLog 23 Aug 2005 18:32:30 -0000 1.4618
+++ ChangeLog 23 Aug 2005 19:25:01 -0000 1.4619
@@ -1,3 +1,17 @@
+2005-08-23 David Harrison <harrison at apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/4226539> REGRESSION: Blank content at http://www.the-leaky-cauldron.org/ with Denver and TOT
+
+ Test cases added:
+ * layout-tests/fast/parser/comments-expected.txt: Added.
+ * layout-tests/fast/parser/comments.html: Added.
+
+ * khtml/html/htmltokenizer.cpp:
+ (khtml::HTMLTokenizer::parseComment):
+ When non-space follows comment end, ignore that comment end.
+
2005-08-23 Justin Garcia <justin.garcia at apple.com>
Reviewed by mjs
1.106 +21 -13 WebCore/khtml/html/htmltokenizer.cpp
Index: htmltokenizer.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/htmltokenizer.cpp,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -r1.105 -r1.106
--- htmltokenizer.cpp 9 Aug 2005 22:22:21 -0000 1.105
+++ htmltokenizer.cpp 23 Aug 2005 19:25:05 -0000 1.106
@@ -585,19 +585,7 @@
QConstString((QChar*)src.current(), kMin(16, src.length())).string().latin1());
#endif
- if (strict) {
- if (src->unicode() == '-') {
- delimiterCount++;
- if (delimiterCount == 2) {
- delimiterCount = 0;
- canClose = !canClose;
- }
- }
- else
- delimiterCount = 0;
- }
-
- if ((!strict || canClose) && src->unicode() == '>') {
+ if ((!strict || canClose) && *src == '>') {
bool handleBrokenComments = brokenComments && !(script || style);
int endCharsCount = 1; // start off with one for the '>' character
if (!strict) {
@@ -633,6 +621,26 @@
return; // Finished parsing comment
}
}
+
+ if (strict) {
+ if (*src == '-') {
+ delimiterCount++;
+ if (delimiterCount == 2) {
+ delimiterCount = 0;
+ canClose = !canClose;
+ }
+ } else {
+ delimiterCount = 0;
+ // Bad markup. Non-space between the comment end and the markup
+ // declaration close ('>'). Keep scanning as comment, but set
+ // the state back to where we need to see another comment end
+ // followed by a declaration close.
+ // This is not exactly to spec, but is better for compatiblility.
+ if (canClose && *src != ' ')
+ canClose = false;
+ }
+ }
+
++src;
}
}
1.1 WebCore/layout-tests/fast/parser/comments-expected.txt
Index: comments-expected.txt
===================================================================
layer at (0,0) size 800x600
RenderCanvas at (0,0) size 800x600
layer at (0,0) size 800x539
RenderBlock {HTML} at (0,0) size 800x539
RenderBody {BODY} at (8,21) size 784x510
RenderBlock {H1} at (0,0) size 784x37
RenderText {TEXT} at (0,0) size 189x37
text run at (0,0) width 189: "Success cases:"
RenderBlock {P} at (0,58) size 784x18
RenderText {TEXT} at (0,0) size 100x18
text run at (0,0) width 100: "basic comments"
RenderBlock {P} at (0,92) size 784x0
RenderBlock {P} at (0,92) size 784x18
RenderText {TEXT} at (0,0) size 97x18
text run at (0,0) width 97: "comment series"
RenderBlock {P} at (0,126) size 784x0
RenderBlock {P} at (0,126) size 784x18
RenderText {TEXT} at (0,0) size 60x18
text run at (0,0) width 60: "dash runs"
RenderBlock {P} at (0,160) size 784x0
RenderBlock {P} at (0,160) size 784x18
RenderText {TEXT} at (0,0) size 107x18
text run at (0,0) width 107: "empty comments"
RenderBlock {P} at (0,194) size 784x0
RenderBlock {P} at (0,194) size 784x18
RenderText {TEXT} at (0,0) size 84x18
text run at (0,0) width 84: "multiple lines"
RenderBlock {P} at (0,228) size 784x0
RenderBlock {P} at (0,228) size 784x18
RenderText {TEXT} at (0,0) size 82x18
text run at (0,0) width 82: "compatibility"
RenderBlock {P} at (0,262) size 784x0
RenderBlock {H1} at (0,267) size 784x37
RenderText {TEXT} at (0,0) size 187x37
text run at (0,0) width 187: "Failure cases:"
RenderBlock {P} at (0,325) size 784x18
RenderText {TEXT} at (0,0) size 149x18
text run at (0,0) width 149: "tab after comment close"
RenderBlock {P} at (0,359) size 784x0
RenderBlock {P} at (0,359) size 784x18
RenderText {TEXT} at (0,0) size 153x18
text run at (0,0) width 153: "text after comment close"
RenderBlock {P} at (0,393) size 784x0
RenderBlock {H1} at (0,398) size 784x37
RenderText {TEXT} at (0,0) size 356x37
text run at (0,0) width 356: "Failure cases with output:"
RenderBlock (anonymous) at (0,456) size 784x54
RenderText {TEXT} at (0,0) size 331x18
text run at (0,0) width 331: "extra comment end and markup declaration close -->"
RenderBR {BR} at (0,0) size 0x0
RenderText {TEXT} at (0,18) size 386x18
text run at (0,18) width 386: "extra comment end w/space and markup declaration close -->"
RenderBR {BR} at (0,0) size 0x0
RenderText {TEXT} at (0,36) size 161x18
text run at (0,36) width 161: "outer nested comment -->"
RenderText {TEXT} at (0,0) size 0x0
1.1 WebCore/layout-tests/fast/parser/comments.html
Index: comments.html
===================================================================
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<body>
<h1>Success cases:</h1>
<p>basic comments<p>
<!-- basic comment -->
<!-- basic comment with spaces after comment end -- >
<p>comment series<p>
<!-- comment -- -- series-->
<!-- comment -- -- series with spaces after comment end-- >
<p>dash runs<p>
<!------ Hello -->
<!------ Hello -- >
<!-- --- Hello -->
<!-- Hello --->
<p>empty comments<p>
<!---->
<!---- >
<!>
<p>multiple lines<p>
<!-- here's a comment, a little longer,
which occupies more than one line -->
<!-- here's a comment, a little longer,
which occupies more than one line -- >
<p>compatibility<p>
<!-- Compatibility: comment series with --extraneous-- text -- between -- the comments -->
<!-- Compatibility: comment series with --extraneous-- text -- between -- the comments -- >
<!-- Compatibility: <!--extra comment start like www.the-leaky-cauldron.com has <rdar://problem/4226539>-->
<!-- Compatibility: <!--extra comment start like www.the-leaky-cauldron.com has <rdar://problem/4226539> -- >
<h1>Failure cases:</h1>
<p>tab after comment close<p>
<!-- tab after comment close-- ><p> error! </p>-->
<p>text after comment close<p>
<!-- text after comment close--ouch><p> error! </p>-->
<h1>Failure cases with output:</h1>
<!-- this must fail --> extra comment end and markup declaration close --><br>
<!-- this must fail -- > extra comment end w/space and markup declaration close --><br>
<!-- nested: <!--inner comment --> outer nested comment -->
</body>
</html>
More information about the webkit-changes
mailing list